From 6d7197a81733b052bd8e4faca8bfe881efbe842a Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 27 Feb 2025 05:56:31 +0000 Subject: [PATCH] CodeGen from PR 32871 in Azure/azure-rest-api-specs Merge 65ad9a2bd12495b6340db1b7ff600aa70b69c534 into c2afa6e1f7ced1b3c1fdd3518a9d49b44871d7a7 --- .../computefleet/armcomputefleet/CHANGELOG.md | 10 + .../computefleet/armcomputefleet/README.md | 2 +- .../computefleet/armcomputefleet/constants.go | 20 +- .../armcomputefleet/fake/fleets_server.go | 79 +- .../armcomputefleet/fake/internal.go | 5 + .../armcomputefleet/fake/operations_server.go | 45 +- .../fleets_client_example_test.go | 3 +- .../computefleet/armcomputefleet/go.mod | 2 +- .../computefleet/armcomputefleet/models.go | 57 +- .../operations_client_example_test.go | 2 +- .../armcomputefleet/tsp-location.yaml | 4 +- .../armdatabasefleetmanager/CHANGELOG.md | 8 + .../armdatabasefleetmanager/LICENSE.txt | 21 + .../armdatabasefleetmanager/README.md | 90 + .../armdatabasefleetmanager/ci.yml | 28 + .../armdatabasefleetmanager/client_factory.go | 80 + .../armdatabasefleetmanager/constants.go | 194 + .../fake/firewallrules_server.go | 352 + .../fake/fleetdatabases_server.go | 610 + .../fake/fleets_server.go | 417 + .../fake/fleetspaces_server.go | 512 + .../fake/fleettiers_server.go | 439 + .../armdatabasefleetmanager/fake/internal.go | 84 + .../fake/operations_server.go | 117 + .../fake/server_factory.go | 111 + .../fake/time_rfc3339.go | 109 + .../firewallrules_client.go | 371 + .../firewallrules_client_example_test.go | 176 + .../fleetdatabases_client.go | 733 + .../fleetdatabases_client_example_test.go | 464 + .../armdatabasefleetmanager/fleets_client.go | 464 + .../fleets_client_example_test.go | 302 + .../fleetspaces_client.go | 602 + .../fleetspaces_client_example_test.go | 315 + .../fleettiers_client.go | 504 + .../fleettiers_client_example_test.go | 333 + .../armdatabasefleetmanager/go.mod | 21 + .../armdatabasefleetmanager/go.sum | 29 + .../armdatabasefleetmanager/models.go | 451 + .../armdatabasefleetmanager/models_serde.go | 1144 ++ .../operations_client.go | 84 + .../operations_client_example_test.go | 56 + .../armdatabasefleetmanager/options.go | 231 + .../armdatabasefleetmanager/responses.go | 187 + .../armdatabasefleetmanager/time_rfc3339.go | 109 + .../armdatabasefleetmanager/tsp-location.yaml | 4 + .../armdatabasewatcher/CHANGELOG.md | 8 + .../armdatabasewatcher/LICENSE.txt | 21 + .../armdatabasewatcher/README.md | 90 + .../alertruleresources_client.go | 309 + .../alertruleresources_client_example_test.go | 183 + .../databasewatcher/armdatabasewatcher/ci.yml | 28 + .../armdatabasewatcher/client_factory.go | 80 + .../armdatabasewatcher/constants.go | 277 + .../fake/alertruleresources_server.go | 267 + .../fake/healthvalidations_server.go | 233 + .../armdatabasewatcher/fake/internal.go | 65 + .../fake/operations_server.go | 117 + .../armdatabasewatcher/fake/server_factory.go | 113 + .../fake/sharedprivatelinkresources_server.go | 293 + .../armdatabasewatcher/fake/targets_server.go | 267 + .../armdatabasewatcher/fake/time_rfc3339.go | 109 + .../fake/watchers_server.go | 478 + .../databasewatcher/armdatabasewatcher/go.mod | 21 + .../databasewatcher/armdatabasewatcher/go.sum | 29 + .../healthvalidations_client.go | 255 + .../healthvalidations_client_example_test.go | 172 + .../armdatabasewatcher/interfaces.go | 14 + .../armdatabasewatcher/models.go | 554 + .../armdatabasewatcher/models_serde.go | 1227 ++ .../armdatabasewatcher/operations_client.go | 84 + .../operations_client_example_test.go | 85 + .../armdatabasewatcher/options.go | 143 + .../armdatabasewatcher/polymorphic_helpers.go | 32 + .../armdatabasewatcher/responses.go | 143 + .../sharedprivatelinkresources_client.go | 343 + ...rivatelinkresources_client_example_test.go | 182 + .../armdatabasewatcher/targets_client.go | 307 + .../targets_client_example_test.go | 178 + .../armdatabasewatcher/time_rfc3339.go | 109 + .../armdatabasewatcher/tsp-location.yaml | 4 + .../armdatabasewatcher/watchers_client.go | 606 + .../watchers_client_example_test.go | 871 ++ .../armdeviceregistry/CHANGELOG.md | 4 + .../armdeviceregistry/constants.go | 2 +- .../armdeviceregistry/tsp-location.yaml | 2 +- .../armdevopsinfrastructure/CHANGELOG.md | 16 + .../armdevopsinfrastructure/constants.go | 92 +- .../fake/pools_server.go | 35 + .../imageversions_client.go | 4 +- .../imageversions_client_example_test.go | 2 +- .../armdevopsinfrastructure/models.go | 41 +- .../armdevopsinfrastructure/models_serde.go | 82 + .../operations_client.go | 4 +- .../operations_client_example_test.go | 2 +- .../armdevopsinfrastructure/options.go | 5 + .../armdevopsinfrastructure/pools_client.go | 90 +- .../pools_client_example_test.go | 67 +- .../resourcedetails_client.go | 4 +- .../resourcedetails_client_example_test.go | 2 +- .../armdevopsinfrastructure/responses.go | 6 + .../armdevopsinfrastructure/sku_client.go | 4 +- .../sku_client_example_test.go | 2 +- .../subscriptionusages_client.go | 4 +- .../subscriptionusages_client_example_test.go | 2 +- .../armdevopsinfrastructure/tsp-location.yaml | 4 +- .../armimpactreporting/CHANGELOG.md | 4 + .../armimpactreporting/constants.go | 2 +- .../armimpactreporting/tsp-location.yaml | 2 +- .../armiotoperations/CHANGELOG.md | 4 + .../armiotoperations/constants.go | 2 +- .../dataflowendpoint_client_example_test.go | 186 +- .../iotoperations/armiotoperations/models.go | 8 +- .../armiotoperations/tsp-location.yaml | 4 +- .../mongocluster/armmongocluster/CHANGELOG.md | 9 + .../mongocluster/armmongocluster/constants.go | 20 +- .../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 +- .../armmongocluster/firewallrules_client.go | 20 +- .../firewallrules_client_example_test.go | 8 +- .../mongocluster/armmongocluster/models.go | 20 +- .../armmongocluster/models_serde.go | 35 + .../armmongocluster/mongoclusters_client.go | 46 +- .../mongoclusters_client_example_test.go | 171 +- .../armmongocluster/operations_client.go | 4 +- .../operations_client_example_test.go | 2 +- .../privateendpointconnections_client.go | 20 +- ...endpointconnections_client_example_test.go | 8 +- .../armmongocluster/privatelinks_client.go | 4 +- .../privatelinks_client_example_test.go | 2 +- .../armmongocluster/replicas_client.go | 4 +- .../replicas_client_example_test.go | 2 +- .../armmongocluster/tsp-location.yaml | 4 +- .../CHANGELOG.md | 254 + .../README.md | 2 +- .../autorest.md | 13 - ...siterecoverymanagementserviceapi_client.go | 181 - ...anagementserviceapi_client_example_test.go | 86 - .../build.go | 7 - .../checknameavailability_client.go | 109 + ...cknameavailability_client_example_test.go} | 35 +- .../client_factory.go | 180 +- .../constants.go | 493 +- .../deploymentpreflight_client.go | 114 + ...deploymentpreflight_client_example_test.go | 55 + .../draoperationstatus_client.go | 118 - .../emailconfiguration_client.go | 35 +- .../emailconfiguration_client_example_test.go | 144 +- .../event_client.go | 28 +- .../event_client_example_test.go | 194 +- .../fabric_client.go | 88 +- .../fabric_client_example_test.go | 566 +- .../{dra_client.go => fabricagent_client.go} | 137 +- ....go => fabricagent_client_example_test.go} | 432 +- .../fabricoperationsstatus_client.go | 114 - ...ricoperationsstatus_client_example_test.go | 45 - ...siterecoverymanagementserviceapi_server.go | 156 - .../fake/checknameavailability_server.go | 128 + .../fake/deploymentpreflight_server.go | 132 + .../fake/draoperationstatus_server.go | 108 - .../fake/emailconfiguration_server.go | 65 +- .../fake/event_server.go | 89 +- .../fake/fabric_server.go | 99 +- .../{dra_server.go => fabricagent_server.go} | 179 +- .../fake/fabricoperationsstatus_server.go | 104 - .../fake/internal.go | 11 +- .../{workflow_server.go => job_server.go} | 153 +- .../fake/operationresults_server.go | 121 + .../fake/operations_server.go | 55 +- .../fake/policy_server.go | 75 +- .../fake/policyoperationstatus_server.go | 108 - ...privateendpointconnectionproxies_server.go | 327 + .../fake/privateendpointconnections_server.go | 280 + .../fake/privatelinkresources_server.go | 177 + .../fake/protecteditem_server.go | 193 +- .../protecteditemoperationstatus_server.go | 108 - ...ints_server.go => recoverypoint_server.go} | 101 +- .../fake/replicationextension_server.go | 75 +- ...licationextensionoperationstatus_server.go | 108 - .../fake/server_factory.go | 197 +- .../fake/time_rfc3339.go | 51 +- .../fake/vault_server.go | 99 +- .../fake/vaultoperationstatus_server.go | 104 - .../fake/workflowoperationstatus_server.go | 108 - .../interfaces.go | 56 +- .../{workflow_client.go => job_client.go} | 84 +- ...ple_test.go => job_client_example_test.go} | 190 +- .../models.go | 1651 ++- .../models_serde.go | 2883 ++-- ...s_client.go => operationresults_client.go} | 56 +- ...> operationresults_client_example_test.go} | 32 +- .../operations_client.go | 14 +- .../operations_client_example_test.go | 44 +- .../options.go | 253 +- .../policy_client.go | 55 +- .../policy_client_example_test.go | 163 +- .../policyoperationstatus_client.go | 119 - ...licyoperationstatus_client_example_test.go | 45 - .../polymorphic_helpers.go | 109 +- ...privateendpointconnectionproxies_client.go | 407 + ...ntconnectionproxies_client_example_test.go | 501 + .../privateendpointconnections_client.go | 331 + ...endpointconnections_client_example_test.go | 168 + .../privatelinkresources_client.go | 175 + ...rivatelinkresources_client_example_test.go | 93 + .../protecteditem_client.go | 170 +- .../protecteditem_client_example_test.go | 838 +- .../protecteditemoperationstatus_client.go | 119 - ...itemoperationstatus_client_example_test.go | 45 - ...ints_client.go => recoverypoint_client.go} | 70 +- .../recoverypoint_client_example_test.go | 95 + .../recoverypoints_client_example_test.go | 106 - .../replicationextension_client.go | 55 +- ...eplicationextension_client_example_test.go | 163 +- ...licationextensionoperationstatus_client.go | 119 - ...sionoperationstatus_client_example_test.go | 45 - .../{response_types.go => responses.go} | 234 +- .../time_rfc3339.go | 51 +- .../tsp-location.yaml | 4 + .../vault_client.go | 88 +- .../vault_client_example_test.go | 339 +- .../workflowoperationstatus_client.go | 119 - ...flowoperationstatus_client_example_test.go | 45 - .../armservicenetworking/CHANGELOG.md | 4 + .../armservicenetworking/constants.go | 2 +- .../armservicenetworking/tsp-location.yaml | 2 +- .../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/models.go | 19 +- ...ndbyvirtualmachines_client_example_test.go | 4 +- .../armstandbypool/tsp-location.yaml | 4 +- .../terraform/armterraform/CHANGELOG.md | 8 + .../terraform/armterraform/constants.go | 28 +- .../terraform/armterraform/models.go | 17 +- .../terraform/armterraform/models_serde.go | 12 + .../terraform_client_example_test.go | 12 +- .../terraform/armterraform/tsp-location.yaml | 4 +- .../armtrustedsigning/CHANGELOG.md | 12 + .../certificateprofiles_client.go | 24 +- ...certificateprofiles_client_example_test.go | 37 +- .../codesigningaccounts_client.go | 34 +- ...codesigningaccounts_client_example_test.go | 14 +- .../armtrustedsigning/constants.go | 2 +- .../fake/certificateprofiles_server.go | 65 +- .../fake/codesigningaccounts_server.go | 77 +- .../armtrustedsigning/fake/internal.go | 5 + .../fake/operations_server.go | 43 +- .../armtrustedsigning/models.go | 52 +- .../armtrustedsigning/models_serde.go | 67 +- .../armtrustedsigning/operations_client.go | 4 +- .../operations_client_example_test.go | 2 +- .../armtrustedsigning/tsp-location.yaml | 4 +- .../CHANGELOG.md | 76 + .../autorest.md | 13 - .../armworkloadssapvirtualinstance/build.go | 7 - .../client_factory.go | 22 +- .../constants.go | 276 +- .../fake/internal.go | 11 +- .../fake/operations_server.go | 55 +- .../sapapplicationserverinstances_server.go | 179 +- ...go => sapcentralserverinstances_server.go} | 229 +- .../fake/sapdatabaseinstances_server.go | 179 +- .../fake/sapvirtualinstances_server.go | 251 +- .../fake/server_factory.go | 38 +- .../fake/time_rfc3339.go | 9 +- .../fake/workloads_server.go | 242 - .../interfaces.go | 6 +- .../armworkloadssapvirtualinstance/models.go | 351 +- .../models_serde.go | 192 +- .../operations_client.go | 14 +- .../operations_client_example_test.go | 1379 +- .../armworkloadssapvirtualinstance/options.go | 162 +- .../polymorphic_helpers.go | 30 +- .../responses.go | 128 +- .../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 -- 300 files changed, 41001 insertions(+), 17675 deletions(-) create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/CHANGELOG.md create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/LICENSE.txt create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/README.md create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/ci.yml create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/client_factory.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/constants.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/firewallrules_server.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleetdatabases_server.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleets_server.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleetspaces_server.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleettiers_server.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/internal.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/operations_server.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/server_factory.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/firewallrules_client.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/firewallrules_client_example_test.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetdatabases_client.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetdatabases_client_example_test.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleets_client.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleets_client_example_test.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetspaces_client.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetspaces_client_example_test.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleettiers_client.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleettiers_client_example_test.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.mod create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.sum create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models_serde.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/operations_client.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/operations_client_example_test.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/options.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/responses.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/time_rfc3339.go create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/tsp-location.yaml create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/CHANGELOG.md create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/LICENSE.txt create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/README.md create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/alertruleresources_client.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/alertruleresources_client_example_test.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/ci.yml create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/client_factory.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/constants.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/alertruleresources_server.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/healthvalidations_server.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/internal.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/operations_server.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/server_factory.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/sharedprivatelinkresources_server.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/targets_server.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/watchers_server.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/go.mod create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/go.sum create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/healthvalidations_client.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/healthvalidations_client_example_test.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/interfaces.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/models.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/models_serde.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/operations_client.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/operations_client_example_test.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/options.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/polymorphic_helpers.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/responses.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/sharedprivatelinkresources_client.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/sharedprivatelinkresources_client_example_test.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/targets_client.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/targets_client_example_test.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/time_rfc3339.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/tsp-location.yaml create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/watchers_client.go create mode 100644 sdk/resourcemanager/databasewatcher/armdatabasewatcher/watchers_client_example_test.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/autorest.md delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client_example_test.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/build.go create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client.go rename sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/{vaultoperationstatus_client_example_test.go => checknameavailability_client_example_test.go} (52%) create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client.go create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client_example_test.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client.go rename sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/{dra_client.go => fabricagent_client.go} (66%) rename sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/{dra_client_example_test.go => fabricagent_client_example_test.go} (61%) delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client_example_test.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/azuresiterecoverymanagementserviceapi_server.go create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/checknameavailability_server.go create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/deploymentpreflight_server.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/draoperationstatus_server.go rename sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/{dra_server.go => fabricagent_server.go} (59%) delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricoperationsstatus_server.go rename sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/{workflow_server.go => job_server.go} (53%) create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operationresults_server.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policyoperationstatus_server.go create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnectionproxies_server.go create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnections_server.go create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privatelinkresources_server.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditemoperationstatus_server.go rename sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/{recoverypoints_server.go => recoverypoint_server.go} (62%) delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextensionoperationstatus_server.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vaultoperationstatus_server.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflowoperationstatus_server.go rename sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/{workflow_client.go => job_client.go} (62%) rename sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/{workflow_client_example_test.go => job_client_example_test.go} (64%) rename sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/{vaultoperationstatus_client.go => operationresults_client.go} (54%) rename sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/{draoperationstatus_client_example_test.go => operationresults_client_example_test.go} (52%) delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client_example_test.go create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client.go create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client_example_test.go create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client.go create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client_example_test.go create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client.go create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client_example_test.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client_example_test.go rename sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/{recoverypoints_client.go => recoverypoint_client.go} (66%) create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_client_example_test.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client_example_test.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client_example_test.go rename sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/{response_types.go => responses.go} (51%) create mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/tsp-location.yaml delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client.go delete mode 100644 sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client_example_test.go 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 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/computefleet/armcomputefleet/CHANGELOG.md b/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md index d91bbac6cf58..01c9f0df0f4d 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md +++ b/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md @@ -1,5 +1,15 @@ # Release History +## 2.0.0 (2025-02-27) +### 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..15db93573c51 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. @@ -188,9 +188,9 @@ func PossibleDiffDiskOptionsValues() []DiffDiskOptions { // resource disk space for Ephemeral OS disk provisioning. For more information on // Ephemeral OS disk size requirements, please refer Ephemeral OS disk size // requirements for Windows VM at -// https://docs.microsoft.com/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements +// https://learn.microsoft.com/azure/virtual-machines/windows/ephemeral-os-disks#size-requirements // and Linux VM at -// https://docs.microsoft.com/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements +// https://learn.microsoft.com/azure/virtual-machines/linux/ephemeral-os-disks#size-requirements // Minimum api-version for NvmeDisk: 2024-03-01. type DiffDiskPlacement string @@ -215,10 +215,10 @@ func PossibleDiffDiskPlacementValues() []DiffDiskPlacement { // DiskControllerTypes - Specifies the disk controller type configured for the VM and // VirtualMachineScaleSet. This property is only supported for virtual machines // whose operating system disk and VM sku supports Generation 2 -// (https://docs.microsoft.com/en-us/azure/virtual-machines/generation-2), please +// (https://learn.microsoft.com/en-us/azure/virtual-machines/generation-2), please // check the HyperVGenerations capability returned as part of VM sku capabilities // in the response of Microsoft.Compute SKUs api for the region contains V2 -// (https://docs.microsoft.com/rest/api/compute/resourceskus/list). For more +// (https://learn.microsoft.com/rest/api/compute/resourceskus/list). For more // information about Disk Controller Types supported please refer to // https://aka.ms/azure-diskcontrollertypes. type DiskControllerTypes string @@ -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, } } @@ -799,9 +799,9 @@ func PossibleSpotAllocationStrategyValues() []SpotAllocationStrategy { // zone redundant storage. StandardSSD_ZRS uses Standard SSD zone redundant // storage. For more information regarding disks supported for Windows Virtual // Machines, refer to -// https://docs.microsoft.com/azure/virtual-machines/windows/disks-types and, for +// https://learn.microsoft.com/azure/virtual-machines/windows/disks-types and, for // Linux Virtual Machines, refer to -// https://docs.microsoft.com/azure/virtual-machines/linux/disks-types +// https://learn.microsoft.com/azure/virtual-machines/linux/disks-types type StorageAccountTypes string const ( 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..ed0a132c4065 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" ) @@ -2313,7 +2313,6 @@ func ExampleFleetsClient_NewListVirtualMachineScaleSetsPager() { // VirtualMachineScaleSetListResult: armcomputefleet.VirtualMachineScaleSetListResult{ // Value: []*armcomputefleet.VirtualMachineScaleSet{ // { - // Name: to.Ptr("myVmss"), // ID: to.Ptr("/subscriptions/7B0CD4DB-3381-4013-9B31-FB6E6FD0FF1C/resourceGroups/rgazurefleet/providers/Microsoft.AzureFleet/fleets/myFleet/virtualMachineScaleSets/myVmss"), // Type: to.Ptr("Microsoft.AzureFleet/fleets/virtualMachineScaleSets"), // OperationStatus: to.Ptr(armcomputefleet.ProvisioningStateCreating), diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/go.mod b/sdk/resourcemanager/computefleet/armcomputefleet/go.mod index d9e01a0863d1..02d187579f37 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/go.mod +++ b/sdk/resourcemanager/computefleet/armcomputefleet/go.mod @@ -1,4 +1,4 @@ -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 diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/models.go b/sdk/resourcemanager/computefleet/armcomputefleet/models.go index caf2d6bf4392..4b7af780c514 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/models.go +++ b/sdk/resourcemanager/computefleet/armcomputefleet/models.go @@ -117,9 +117,9 @@ type BaseVirtualMachineProfile struct { // Server operating system are:

RHEL_BYOS (for RHEL)

SLES_BYOS // (for SUSE)

For more information, see [Azure Hybrid Use Benefit for // Windows - // Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) + // Server](https://learn.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) //

[Azure Hybrid Use Benefit for Linux - // Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) + // Server](https://learn.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) //

Minimum api-version: 2015-06-15 LicenseType *string @@ -229,8 +229,8 @@ type DiffDiskSettings struct { // values are: **CacheDisk,** **ResourceDisk.** The defaulting behavior is: // **CacheDisk** if one is configured for the VM size otherwise **ResourceDisk** // is used. Refer to the VM size documentation for Windows VM at - // https://docs.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at - // https://docs.microsoft.com/azure/virtual-machines/linux/sizes to check which VM + // https://learn.microsoft.com/azure/virtual-machines/windows/sizes and Linux VM at + // https://learn.microsoft.com/azure/virtual-machines/linux/sizes to check which VM // sizes exposes a cache disk. Placement *DiffDiskPlacement } @@ -403,7 +403,7 @@ type KeyVaultSecretReference struct { // 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). +// Distributions](https://learn.microsoft.com/azure/virtual-machines/linux/endorsed-distros). type LinuxConfiguration struct { // Specifies whether password authentication should be disabled. DisablePasswordAuthentication *bool @@ -509,12 +509,12 @@ type OSImageNotificationProfile struct { // 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. + // Localized display information for this particular operation. Display *OperationDisplay + // READ-ONLY; Extensible 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 Azure // Resource Manager/control-plane operations. IsDataAction *bool @@ -679,7 +679,7 @@ 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). + // Azure]https://learn.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). KeyData *string // Specifies the full path on the created VM where ssh public key is stored. If @@ -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. @@ -991,14 +992,14 @@ type VMSizeProperties struct { // specified in the request body the default behavior is to set it to the value of // vCPUs available for that VM size exposed in api response of [List all available // virtual machine sizes in a - // region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list). + // region](https://learn.microsoft.com/en-us/rest/api/compute/resource-skus/list). VCPUsAvailable *int32 // Specifies the vCPU to physical core ratio. When this property is not specified // in the request body the default behavior is set to the value of vCPUsPerCore // for the VM Size exposed in api response of [List all available virtual machine // sizes in a - // region](https://docs.microsoft.com/en-us/rest/api/compute/resource-skus/list). + // region](https://learn.microsoft.com/en-us/rest/api/compute/resource-skus/list). // **Setting this property to 1 also means that hyper-threading is disabled.** VCPUsPerCore *int32 } @@ -1018,16 +1019,16 @@ type VaultCertificate struct { // This is the URL of a certificate that has been uploaded to Key Vault as a // secret. For adding a secret to the Key Vault, see [Add a key or secret to the // key - // vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + // vault](https://learn.microsoft.com/azure/key-vault/key-vault-get-started/#add). // In this case, your certificate needs to be It is the Base64 encoding of the // following JSON Object which is encoded in UTF-8:

{
// "data":"",
"dataType":"pfx",
// "password":""
}
To install certificates on a virtual // machine it is recommended to use the [Azure Key Vault virtual machine extension // for - // Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + // Linux](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) // or the [Azure Key Vault virtual machine extension for - // Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + // Windows](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). CertificateURL *string } @@ -1419,10 +1420,10 @@ type VirtualMachineScaleSetOSProfile struct { // "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) + // VM](https://learn.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) + // Extension](https://learn.microsoft.com/troubleshoot/azure/virtual-machines/troubleshoot-ssh-connection) AdminPassword *string // Specifies the name of the administrator account.

**Windows-only @@ -1448,12 +1449,12 @@ type VirtualMachineScaleSetOSProfile struct { // is decoded to a binary array that is saved as a file on the Virtual Machine. // The maximum length of the binary array is 65535 bytes. For using cloud-init for // your VM, see [Using cloud-init to customize a Linux VM during - // creation](https://docs.microsoft.com/azure/virtual-machines/linux/using-cloud-init) + // creation](https://learn.microsoft.com/azure/virtual-machines/linux/using-cloud-init) CustomData *string // 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). + // Distributions](https://learn.microsoft.com/azure/virtual-machines/linux/endorsed-distros). LinuxConfiguration *LinuxConfiguration // Optional property which must either be set to True or omitted. @@ -1462,9 +1463,9 @@ type VirtualMachineScaleSetOSProfile struct { // Specifies set of certificates that should be installed onto the virtual // machines in the scale set. To install certificates on a virtual machine it is // recommended to use the [Azure Key Vault virtual machine extension for - // Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + // Linux](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) // or the [Azure Key Vault virtual machine extension for - // Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + // Windows](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). Secrets []*VaultSecretGroup // Specifies Windows operating system settings on the virtual machine. @@ -1531,7 +1532,7 @@ type VirtualMachineScaleSetStorageProfile struct { // Specifies the parameters that are used to add data disks to the virtual // machines in the scale set. For more information about disks, see [About disks // and VHDs for Azure virtual - // machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + // machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview). DataDisks []*VirtualMachineScaleSetDataDisk // Specifies the disk controller type configured for the virtual machines in the scale set. Minimum api-version: 2022-08-01 @@ -1546,7 +1547,7 @@ type VirtualMachineScaleSetStorageProfile struct { // Specifies information about the operating system disk used by the virtual // machines in the scale set. For more information about disks, see [About disks // and VHDs for Azure virtual - // machines](https://docs.microsoft.com/azure/virtual-machines/managed-disks-overview). + // machines](https://learn.microsoft.com/azure/virtual-machines/managed-disks-overview). OSDisk *VirtualMachineScaleSetOSDisk } @@ -1561,16 +1562,16 @@ type WinRMListener struct { // This is the URL of a certificate that has been uploaded to Key Vault as a // secret. For adding a secret to the Key Vault, see [Add a key or secret to the // key - // vault](https://docs.microsoft.com/azure/key-vault/key-vault-get-started/#add). + // vault](https://learn.microsoft.com/azure/key-vault/key-vault-get-started/#add). // In this case, your certificate needs to be the Base64 encoding of the following // JSON Object which is encoded in UTF-8:

{
// "data":"",
"dataType":"pfx",
// "password":""
}
To install certificates on a virtual // machine it is recommended to use the [Azure Key Vault virtual machine extension // for - // Linux](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) + // Linux](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-linux) // or the [Azure Key Vault virtual machine extension for - // Windows](https://docs.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). + // Windows](https://learn.microsoft.com/azure/virtual-machines/extensions/key-vault-windows). CertificateURL *string // Specifies the protocol of WinRM listener. Possible values are: **http,** @@ -1604,9 +1605,9 @@ type WindowsConfiguration struct { // Specifies the time zone of the virtual machine. e.g. "Pacific Standard Time". // Possible values can be - // [TimeZoneInfo.Id](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) + // [TimeZoneInfo.Id](https://learn.microsoft.com/dotnet/api/system.timezoneinfo.id?#System_TimeZoneInfo_Id) // value from time zones returned by - // [TimeZoneInfo.GetSystemTimeZones](https://docs.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones). + // [TimeZoneInfo.GetSystemTimeZones](https://learn.microsoft.com/dotnet/api/system.timezoneinfo.getsystemtimezones). TimeZone *string // Specifies the Windows Remote Management listeners. This enables remote Windows 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..f2943d446861 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: 676334a284e5136f0a0721d6ae844bb04332f579 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/CHANGELOG.md b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/CHANGELOG.md new file mode 100644 index 000000000000..7f4919082336 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2025-02-27) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager` 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/databasefleetmanager/armdatabasefleetmanager/LICENSE.txt b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/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/databasefleetmanager/armdatabasefleetmanager/README.md b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/README.md new file mode 100644 index 000000000000..5284a75848db --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/README.md @@ -0,0 +1,90 @@ +# Azure Databasefleetmanager Module for Go + +The `armdatabasefleetmanager` module provides operations for working with Azure Databasefleetmanager. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager) + +# 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 Databasefleetmanager module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Databasefleetmanager. 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 Databasefleetmanager 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 := armdatabasefleetmanager.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 := armdatabasefleetmanager.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.NewFirewallRulesClient() +``` + +## 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 `Databasefleetmanager` 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/databasefleetmanager/armdatabasefleetmanager/ci.yml b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/ci.yml new file mode 100644 index 000000000000..956c4cf594c7 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/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/databasefleetmanager/armdatabasefleetmanager/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/databasefleetmanager/armdatabasefleetmanager' diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/client_factory.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/client_factory.go new file mode 100644 index 000000000000..2afecb91e05c --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/client_factory.go @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager + +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 +} + +// NewFirewallRulesClient creates a new instance of FirewallRulesClient. +func (c *ClientFactory) NewFirewallRulesClient() *FirewallRulesClient { + return &FirewallRulesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewFleetDatabasesClient creates a new instance of FleetDatabasesClient. +func (c *ClientFactory) NewFleetDatabasesClient() *FleetDatabasesClient { + return &FleetDatabasesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewFleetTiersClient creates a new instance of FleetTiersClient. +func (c *ClientFactory) NewFleetTiersClient() *FleetTiersClient { + return &FleetTiersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewFleetsClient creates a new instance of FleetsClient. +func (c *ClientFactory) NewFleetsClient() *FleetsClient { + return &FleetsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewFleetspacesClient creates a new instance of FleetspacesClient. +func (c *ClientFactory) NewFleetspacesClient() *FleetspacesClient { + return &FleetspacesClient{ + 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/databasefleetmanager/armdatabasefleetmanager/constants.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/constants.go new file mode 100644 index 000000000000..6447efae7876 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/constants.go @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armdatabasefleetmanager + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager" + 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, + } +} + +// AzureProvisioningState - The provisioning state of the resource. +type AzureProvisioningState string + +const ( + // AzureProvisioningStateAccepted - Request on the resource has been accepted. + AzureProvisioningStateAccepted AzureProvisioningState = "Accepted" + // AzureProvisioningStateCanceled - Resource creation was canceled. + AzureProvisioningStateCanceled AzureProvisioningState = "Canceled" + // AzureProvisioningStateFailed - Resource creation failed. + AzureProvisioningStateFailed AzureProvisioningState = "Failed" + // AzureProvisioningStateProvisioning - Resource is provisioning. + AzureProvisioningStateProvisioning AzureProvisioningState = "Provisioning" + // AzureProvisioningStateSucceeded - Resource has been created. + AzureProvisioningStateSucceeded AzureProvisioningState = "Succeeded" +) + +// PossibleAzureProvisioningStateValues returns the possible values for the AzureProvisioningState const type. +func PossibleAzureProvisioningStateValues() []AzureProvisioningState { + return []AzureProvisioningState{ + AzureProvisioningStateAccepted, + AzureProvisioningStateCanceled, + AzureProvisioningStateFailed, + AzureProvisioningStateProvisioning, + AzureProvisioningStateSucceeded, + } +} + +// 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, + } +} + +// DatabaseCreateMode - Create mode. Available options: Default - Create a database. Copy - Copy the source database (source +// database name must be specified) PointInTimeRestore - Create a database by restoring source database from a point in time +// (source database name and restore from time must be specified) +type DatabaseCreateMode string + +const ( + // DatabaseCreateModeCopy - Copy the source database (source database name must be specified). + DatabaseCreateModeCopy DatabaseCreateMode = "Copy" + // DatabaseCreateModeDefault - Create a database. + DatabaseCreateModeDefault DatabaseCreateMode = "Default" + // DatabaseCreateModePointInTimeRestore - Create a database by restoring source database from a point in time (source database + // name and restore from time must be specified). + DatabaseCreateModePointInTimeRestore DatabaseCreateMode = "PointInTimeRestore" +) + +// PossibleDatabaseCreateModeValues returns the possible values for the DatabaseCreateMode const type. +func PossibleDatabaseCreateModeValues() []DatabaseCreateMode { + return []DatabaseCreateMode{ + DatabaseCreateModeCopy, + DatabaseCreateModeDefault, + DatabaseCreateModePointInTimeRestore, + } +} + +// IdentityType - Identity type of the main principal. +type IdentityType string + +const ( + // IdentityTypeNone - No identity. + IdentityTypeNone IdentityType = "None" + // IdentityTypeUserAssigned - User assigned identity. + IdentityTypeUserAssigned IdentityType = "UserAssigned" +) + +// PossibleIdentityTypeValues returns the possible values for the IdentityType const type. +func PossibleIdentityTypeValues() []IdentityType { + return []IdentityType{ + IdentityTypeNone, + IdentityTypeUserAssigned, + } +} + +// 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, + } +} + +// PrincipalType - Principal type of the authorized principal. +type PrincipalType string + +const ( + // PrincipalTypeApplication - Application principal type. + PrincipalTypeApplication PrincipalType = "Application" + // PrincipalTypeUser - User principal type. + PrincipalTypeUser PrincipalType = "User" +) + +// PossiblePrincipalTypeValues returns the possible values for the PrincipalType const type. +func PossiblePrincipalTypeValues() []PrincipalType { + return []PrincipalType{ + PrincipalTypeApplication, + PrincipalTypeUser, + } +} + +// ResourceType - Resource type of the destination tier override. +type ResourceType string + +const ( + // ResourceTypeDatabase - Database resource type. + ResourceTypeDatabase ResourceType = "Database" + // ResourceTypePool - Elastic pool resource type. + ResourceTypePool ResourceType = "Pool" +) + +// PossibleResourceTypeValues returns the possible values for the ResourceType const type. +func PossibleResourceTypeValues() []ResourceType { + return []ResourceType{ + ResourceTypeDatabase, + ResourceTypePool, + } +} + +// ZoneRedundancy - Status of zone redundancy in a tier. +type ZoneRedundancy string + +const ( + // ZoneRedundancyDisabled - Zone redundancy disabled. + ZoneRedundancyDisabled ZoneRedundancy = "Disabled" + // ZoneRedundancyEnabled - Zone redundancy enabled. + ZoneRedundancyEnabled ZoneRedundancy = "Enabled" +) + +// PossibleZoneRedundancyValues returns the possible values for the ZoneRedundancy const type. +func PossibleZoneRedundancyValues() []ZoneRedundancy { + return []ZoneRedundancy{ + ZoneRedundancyDisabled, + ZoneRedundancyEnabled, + } +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/firewallrules_server.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/firewallrules_server.go new file mode 100644 index 000000000000..8647c11c820a --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/firewallrules_server.go @@ -0,0 +1,352 @@ +// Copyright (c) Microsoft 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/databasefleetmanager/armdatabasefleetmanager" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// FirewallRulesServer is a fake server for instances of the armdatabasefleetmanager.FirewallRulesClient type. +type FirewallRulesServer struct { + // BeginCreateOrUpdate is the fake for method FirewallRulesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, resource armdatabasefleetmanager.FirewallRule, options *armdatabasefleetmanager.FirewallRulesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FirewallRulesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method FirewallRulesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, options *armdatabasefleetmanager.FirewallRulesClientBeginDeleteOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FirewallRulesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FirewallRulesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, options *armdatabasefleetmanager.FirewallRulesClientGetOptions) (resp azfake.Responder[armdatabasefleetmanager.FirewallRulesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByFleetspacePager is the fake for method FirewallRulesClient.NewListByFleetspacePager + // HTTP status codes to indicate success: http.StatusOK + NewListByFleetspacePager func(resourceGroupName string, fleetName string, fleetspaceName string, options *armdatabasefleetmanager.FirewallRulesClientListByFleetspaceOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.FirewallRulesClientListByFleetspaceResponse]) +} + +// NewFirewallRulesServerTransport creates a new instance of FirewallRulesServerTransport with the provided implementation. +// The returned FirewallRulesServerTransport instance is connected to an instance of armdatabasefleetmanager.FirewallRulesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFirewallRulesServerTransport(srv *FirewallRulesServer) *FirewallRulesServerTransport { + return &FirewallRulesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FirewallRulesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FirewallRulesClientDeleteResponse]](), + newListByFleetspacePager: newTracker[azfake.PagerResponder[armdatabasefleetmanager.FirewallRulesClientListByFleetspaceResponse]](), + } +} + +// FirewallRulesServerTransport connects instances of armdatabasefleetmanager.FirewallRulesClient to instances of FirewallRulesServer. +// Don't use this type directly, use NewFirewallRulesServerTransport instead. +type FirewallRulesServerTransport struct { + srv *FirewallRulesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FirewallRulesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdatabasefleetmanager.FirewallRulesClientDeleteResponse]] + newListByFleetspacePager *tracker[azfake.PagerResponder[armdatabasefleetmanager.FirewallRulesClientListByFleetspaceResponse]] +} + +// Do implements the policy.Transporter interface for FirewallRulesServerTransport. +func (f *FirewallRulesServerTransport) 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 f.dispatchToMethodFake(req, method) +} + +func (f *FirewallRulesServerTransport) 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 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.NewListByFleetspacePager": + res.resp, res.err = f.dispatchNewListByFleetspacePager(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 *FirewallRulesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := f.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/firewallRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.FirewallRule](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + firewallRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("firewallRuleName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, firewallRuleNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + f.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) { + f.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) { + f.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (f *FirewallRulesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := f.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/firewallRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + firewallRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("firewallRuleName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, firewallRuleNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + f.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) { + f.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) { + f.beginDelete.remove(req) + } + + return resp, nil +} + +func (f *FirewallRulesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.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\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/firewallRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + firewallRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("firewallRuleName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, firewallRuleNameParam, 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).FirewallRule, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FirewallRulesServerTransport) dispatchNewListByFleetspacePager(req *http.Request) (*http.Response, error) { + if f.srv.NewListByFleetspacePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByFleetspacePager not implemented")} + } + newListByFleetspacePager := f.newListByFleetspacePager.get(req) + if newListByFleetspacePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/firewallRules` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + skiptokenUnescaped, err := url.QueryUnescape(qp.Get("$skiptoken")) + if err != nil { + return nil, err + } + skiptokenParam := getOptional(skiptokenUnescaped) + var options *armdatabasefleetmanager.FirewallRulesClientListByFleetspaceOptions + if skipParam != nil || topParam != nil || skiptokenParam != nil { + options = &armdatabasefleetmanager.FirewallRulesClientListByFleetspaceOptions{ + Skip: skipParam, + Top: topParam, + Skiptoken: skiptokenParam, + } + } + resp := f.srv.NewListByFleetspacePager(resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, options) + newListByFleetspacePager = &resp + f.newListByFleetspacePager.add(req, newListByFleetspacePager) + server.PagerResponderInjectNextLinks(newListByFleetspacePager, req, func(page *armdatabasefleetmanager.FirewallRulesClientListByFleetspaceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByFleetspacePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListByFleetspacePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByFleetspacePager) { + f.newListByFleetspacePager.remove(req) + } + 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/databasefleetmanager/armdatabasefleetmanager/fake/fleetdatabases_server.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleetdatabases_server.go new file mode 100644 index 000000000000..4685274ef9ce --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleetdatabases_server.go @@ -0,0 +1,610 @@ +// Copyright (c) Microsoft 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/databasefleetmanager/armdatabasefleetmanager" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// FleetDatabasesServer is a fake server for instances of the armdatabasefleetmanager.FleetDatabasesClient type. +type FleetDatabasesServer struct { + // BeginChangeTier is the fake for method FleetDatabasesClient.BeginChangeTier + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginChangeTier func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body armdatabasefleetmanager.DatabaseChangeTierProperties, options *armdatabasefleetmanager.FleetDatabasesClientBeginChangeTierOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientChangeTierResponse], errResp azfake.ErrorResponder) + + // BeginCreateOrUpdate is the fake for method FleetDatabasesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, resource armdatabasefleetmanager.FleetDatabase, options *armdatabasefleetmanager.FleetDatabasesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method FleetDatabasesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *armdatabasefleetmanager.FleetDatabasesClientBeginDeleteOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FleetDatabasesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *armdatabasefleetmanager.FleetDatabasesClientGetOptions) (resp azfake.Responder[armdatabasefleetmanager.FleetDatabasesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByFleetspacePager is the fake for method FleetDatabasesClient.NewListByFleetspacePager + // HTTP status codes to indicate success: http.StatusOK + NewListByFleetspacePager func(resourceGroupName string, fleetName string, fleetspaceName string, options *armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceResponse]) + + // BeginRename is the fake for method FleetDatabasesClient.BeginRename + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginRename func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body armdatabasefleetmanager.DatabaseRenameProperties, options *armdatabasefleetmanager.FleetDatabasesClientBeginRenameOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientRenameResponse], errResp azfake.ErrorResponder) + + // BeginRevert is the fake for method FleetDatabasesClient.BeginRevert + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginRevert func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *armdatabasefleetmanager.FleetDatabasesClientBeginRevertOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientRevertResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method FleetDatabasesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, properties armdatabasefleetmanager.FleetDatabase, options *armdatabasefleetmanager.FleetDatabasesClientBeginUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewFleetDatabasesServerTransport creates a new instance of FleetDatabasesServerTransport with the provided implementation. +// The returned FleetDatabasesServerTransport instance is connected to an instance of armdatabasefleetmanager.FleetDatabasesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFleetDatabasesServerTransport(srv *FleetDatabasesServer) *FleetDatabasesServerTransport { + return &FleetDatabasesServerTransport{ + srv: srv, + beginChangeTier: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientChangeTierResponse]](), + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientDeleteResponse]](), + newListByFleetspacePager: newTracker[azfake.PagerResponder[armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceResponse]](), + beginRename: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientRenameResponse]](), + beginRevert: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientRevertResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientUpdateResponse]](), + } +} + +// FleetDatabasesServerTransport connects instances of armdatabasefleetmanager.FleetDatabasesClient to instances of FleetDatabasesServer. +// Don't use this type directly, use NewFleetDatabasesServerTransport instead. +type FleetDatabasesServerTransport struct { + srv *FleetDatabasesServer + beginChangeTier *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientChangeTierResponse]] + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientDeleteResponse]] + newListByFleetspacePager *tracker[azfake.PagerResponder[armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceResponse]] + beginRename *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientRenameResponse]] + beginRevert *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientRevertResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetDatabasesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for FleetDatabasesServerTransport. +func (f *FleetDatabasesServerTransport) 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 f.dispatchToMethodFake(req, method) +} + +func (f *FleetDatabasesServerTransport) 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 fleetDatabasesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fleetDatabasesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FleetDatabasesClient.BeginChangeTier": + res.resp, res.err = f.dispatchBeginChangeTier(req) + case "FleetDatabasesClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FleetDatabasesClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FleetDatabasesClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FleetDatabasesClient.NewListByFleetspacePager": + res.resp, res.err = f.dispatchNewListByFleetspacePager(req) + case "FleetDatabasesClient.BeginRename": + res.resp, res.err = f.dispatchBeginRename(req) + case "FleetDatabasesClient.BeginRevert": + res.resp, res.err = f.dispatchBeginRevert(req) + case "FleetDatabasesClient.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 *FleetDatabasesServerTransport) dispatchBeginChangeTier(req *http.Request) (*http.Response, error) { + if f.srv.BeginChangeTier == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginChangeTier not implemented")} + } + beginChangeTier := f.beginChangeTier.get(req) + if beginChangeTier == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/changeTier` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.DatabaseChangeTierProperties](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginChangeTier(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginChangeTier = &respr + f.beginChangeTier.add(req, beginChangeTier) + } + + resp, err := server.PollerResponderNext(beginChangeTier, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginChangeTier.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(beginChangeTier) { + f.beginChangeTier.remove(req) + } + + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := f.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.FleetDatabase](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + f.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) { + f.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) { + f.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := f.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + f.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) { + f.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) { + f.beginDelete.remove(req) + } + + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.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\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, 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).FleetDatabase, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchNewListByFleetspacePager(req *http.Request) (*http.Response, error) { + if f.srv.NewListByFleetspacePager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByFleetspacePager not implemented")} + } + newListByFleetspacePager := f.newListByFleetspacePager.get(req) + if newListByFleetspacePager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + skiptokenUnescaped, err := url.QueryUnescape(qp.Get("$skiptoken")) + if err != nil { + return nil, err + } + skiptokenParam := getOptional(skiptokenUnescaped) + var options *armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceOptions + if skipParam != nil || topParam != nil || filterParam != nil || skiptokenParam != nil { + options = &armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceOptions{ + Skip: skipParam, + Top: topParam, + Filter: filterParam, + Skiptoken: skiptokenParam, + } + } + resp := f.srv.NewListByFleetspacePager(resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, options) + newListByFleetspacePager = &resp + f.newListByFleetspacePager.add(req, newListByFleetspacePager) + server.PagerResponderInjectNextLinks(newListByFleetspacePager, req, func(page *armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByFleetspacePager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListByFleetspacePager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByFleetspacePager) { + f.newListByFleetspacePager.remove(req) + } + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchBeginRename(req *http.Request) (*http.Response, error) { + if f.srv.BeginRename == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRename not implemented")} + } + beginRename := f.beginRename.get(req) + if beginRename == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/rename` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.DatabaseRenameProperties](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginRename(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRename = &respr + f.beginRename.add(req, beginRename) + } + + resp, err := server.PollerResponderNext(beginRename, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginRename.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(beginRename) { + f.beginRename.remove(req) + } + + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchBeginRevert(req *http.Request) (*http.Response, error) { + if f.srv.BeginRevert == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRevert not implemented")} + } + beginRevert := f.beginRevert.get(req) + if beginRevert == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/revert` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginRevert(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRevert = &respr + f.beginRevert.add(req, beginRevert) + } + + resp, err := server.PollerResponderNext(beginRevert, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginRevert.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(beginRevert) { + f.beginRevert.remove(req) + } + + return resp, nil +} + +func (f *FleetDatabasesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := f.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdatabasefleetmanager.FleetDatabase](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + databaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("databaseName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, databaseNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + f.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) { + f.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) { + f.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to FleetDatabasesServerTransport +var fleetDatabasesServerTransportInterceptor 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/databasefleetmanager/armdatabasefleetmanager/fake/fleets_server.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleets_server.go new file mode 100644 index 000000000000..e5d68393ad38 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleets_server.go @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft 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/databasefleetmanager/armdatabasefleetmanager" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// FleetsServer is a fake server for instances of the armdatabasefleetmanager.FleetsClient type. +type FleetsServer struct { + // BeginCreateOrUpdate is the fake for method FleetsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, resource armdatabasefleetmanager.Fleet, options *armdatabasefleetmanager.FleetsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method FleetsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, options *armdatabasefleetmanager.FleetsClientBeginDeleteOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FleetsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, fleetName string, options *armdatabasefleetmanager.FleetsClientGetOptions) (resp azfake.Responder[armdatabasefleetmanager.FleetsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method FleetsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armdatabasefleetmanager.FleetsClientListOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.FleetsClientListResponse]) + + // NewListByResourceGroupPager is the fake for method FleetsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armdatabasefleetmanager.FleetsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.FleetsClientListByResourceGroupResponse]) + + // BeginUpdate is the fake for method FleetsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, fleetName string, properties armdatabasefleetmanager.FleetUpdate, options *armdatabasefleetmanager.FleetsClientBeginUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewFleetsServerTransport creates a new instance of FleetsServerTransport with the provided implementation. +// The returned FleetsServerTransport instance is connected to an instance of armdatabasefleetmanager.FleetsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFleetsServerTransport(srv *FleetsServer) *FleetsServerTransport { + return &FleetsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armdatabasefleetmanager.FleetsClientListResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armdatabasefleetmanager.FleetsClientListByResourceGroupResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetsClientUpdateResponse]](), + } +} + +// FleetsServerTransport connects instances of armdatabasefleetmanager.FleetsClient to instances of FleetsServer. +// Don't use this type directly, use NewFleetsServerTransport instead. +type FleetsServerTransport struct { + srv *FleetsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armdatabasefleetmanager.FleetsClientListResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armdatabasefleetmanager.FleetsClientListByResourceGroupResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for FleetsServerTransport. +func (f *FleetsServerTransport) 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 f.dispatchToMethodFake(req, method) +} + +func (f *FleetsServerTransport) 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 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.NewListPager": + res.resp, res.err = f.dispatchNewListPager(req) + case "FleetsClient.NewListByResourceGroupPager": + res.resp, res.err = f.dispatchNewListByResourceGroupPager(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) { + if f.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := f.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?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[armdatabasefleetmanager.Fleet](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + f.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) { + f.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) { + f.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (f *FleetsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := f.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?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 + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fleetNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + f.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) { + f.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) { + f.beginDelete.remove(req) + } + + return resp, nil +} + +func (f *FleetsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.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\.DatabaseFleetManager/fleets/(?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 + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fleetNameParam, 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).Fleet, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FleetsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := f.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets` + 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 := f.srv.NewListPager(nil) + newListPager = &resp + f.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armdatabasefleetmanager.FleetsClientListResponse, 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) { + f.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + f.newListPager.remove(req) + } + return resp, nil +} + +func (f *FleetsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := f.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + skiptokenUnescaped, err := url.QueryUnescape(qp.Get("$skiptoken")) + if err != nil { + return nil, err + } + skiptokenParam := getOptional(skiptokenUnescaped) + var options *armdatabasefleetmanager.FleetsClientListByResourceGroupOptions + if skipParam != nil || topParam != nil || skiptokenParam != nil { + options = &armdatabasefleetmanager.FleetsClientListByResourceGroupOptions{ + Skip: skipParam, + Top: topParam, + Skiptoken: skiptokenParam, + } + } + resp := f.srv.NewListByResourceGroupPager(resourceGroupNameParam, options) + newListByResourceGroupPager = &resp + f.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armdatabasefleetmanager.FleetsClientListByResourceGroupResponse, 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) { + f.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + f.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (f *FleetsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := f.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?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[armdatabasefleetmanager.FleetUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + f.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) { + f.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) { + f.beginUpdate.remove(req) + } + + 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/databasefleetmanager/armdatabasefleetmanager/fake/fleetspaces_server.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleetspaces_server.go new file mode 100644 index 000000000000..b1de42345aa8 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleetspaces_server.go @@ -0,0 +1,512 @@ +// Copyright (c) Microsoft 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/databasefleetmanager/armdatabasefleetmanager" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// FleetspacesServer is a fake server for instances of the armdatabasefleetmanager.FleetspacesClient type. +type FleetspacesServer struct { + // BeginCreateOrUpdate is the fake for method FleetspacesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, resource armdatabasefleetmanager.Fleetspace, options *armdatabasefleetmanager.FleetspacesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method FleetspacesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *armdatabasefleetmanager.FleetspacesClientBeginDeleteOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FleetspacesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *armdatabasefleetmanager.FleetspacesClientGetOptions) (resp azfake.Responder[armdatabasefleetmanager.FleetspacesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByFleetPager is the fake for method FleetspacesClient.NewListByFleetPager + // HTTP status codes to indicate success: http.StatusOK + NewListByFleetPager func(resourceGroupName string, fleetName string, options *armdatabasefleetmanager.FleetspacesClientListByFleetOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.FleetspacesClientListByFleetResponse]) + + // BeginRegisterServer is the fake for method FleetspacesClient.BeginRegisterServer + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginRegisterServer func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, body armdatabasefleetmanager.RegisterServerProperties, options *armdatabasefleetmanager.FleetspacesClientBeginRegisterServerOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientRegisterServerResponse], errResp azfake.ErrorResponder) + + // BeginUnregister is the fake for method FleetspacesClient.BeginUnregister + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginUnregister func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *armdatabasefleetmanager.FleetspacesClientBeginUnregisterOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientUnregisterResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method FleetspacesClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, properties armdatabasefleetmanager.Fleetspace, options *armdatabasefleetmanager.FleetspacesClientBeginUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewFleetspacesServerTransport creates a new instance of FleetspacesServerTransport with the provided implementation. +// The returned FleetspacesServerTransport instance is connected to an instance of armdatabasefleetmanager.FleetspacesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFleetspacesServerTransport(srv *FleetspacesServer) *FleetspacesServerTransport { + return &FleetspacesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientDeleteResponse]](), + newListByFleetPager: newTracker[azfake.PagerResponder[armdatabasefleetmanager.FleetspacesClientListByFleetResponse]](), + beginRegisterServer: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientRegisterServerResponse]](), + beginUnregister: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientUnregisterResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientUpdateResponse]](), + } +} + +// FleetspacesServerTransport connects instances of armdatabasefleetmanager.FleetspacesClient to instances of FleetspacesServer. +// Don't use this type directly, use NewFleetspacesServerTransport instead. +type FleetspacesServerTransport struct { + srv *FleetspacesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientDeleteResponse]] + newListByFleetPager *tracker[azfake.PagerResponder[armdatabasefleetmanager.FleetspacesClientListByFleetResponse]] + beginRegisterServer *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientRegisterServerResponse]] + beginUnregister *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientUnregisterResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetspacesClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for FleetspacesServerTransport. +func (f *FleetspacesServerTransport) 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 f.dispatchToMethodFake(req, method) +} + +func (f *FleetspacesServerTransport) 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 fleetspacesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fleetspacesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FleetspacesClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FleetspacesClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FleetspacesClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FleetspacesClient.NewListByFleetPager": + res.resp, res.err = f.dispatchNewListByFleetPager(req) + case "FleetspacesClient.BeginRegisterServer": + res.resp, res.err = f.dispatchBeginRegisterServer(req) + case "FleetspacesClient.BeginUnregister": + res.resp, res.err = f.dispatchBeginUnregister(req) + case "FleetspacesClient.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 *FleetspacesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := f.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?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[armdatabasefleetmanager.Fleetspace](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + f.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) { + f.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) { + f.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (f *FleetspacesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := f.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?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 + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + f.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) { + f.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) { + f.beginDelete.remove(req) + } + + return resp, nil +} + +func (f *FleetspacesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.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\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?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 + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, 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).Fleetspace, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FleetspacesServerTransport) dispatchNewListByFleetPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListByFleetPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByFleetPager not implemented")} + } + newListByFleetPager := f.newListByFleetPager.get(req) + if newListByFleetPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + skiptokenUnescaped, err := url.QueryUnescape(qp.Get("$skiptoken")) + if err != nil { + return nil, err + } + skiptokenParam := getOptional(skiptokenUnescaped) + var options *armdatabasefleetmanager.FleetspacesClientListByFleetOptions + if skipParam != nil || topParam != nil || skiptokenParam != nil { + options = &armdatabasefleetmanager.FleetspacesClientListByFleetOptions{ + Skip: skipParam, + Top: topParam, + Skiptoken: skiptokenParam, + } + } + resp := f.srv.NewListByFleetPager(resourceGroupNameParam, fleetNameParam, options) + newListByFleetPager = &resp + f.newListByFleetPager.add(req, newListByFleetPager) + server.PagerResponderInjectNextLinks(newListByFleetPager, req, func(page *armdatabasefleetmanager.FleetspacesClientListByFleetResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByFleetPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListByFleetPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByFleetPager) { + f.newListByFleetPager.remove(req) + } + return resp, nil +} + +func (f *FleetspacesServerTransport) dispatchBeginRegisterServer(req *http.Request) (*http.Response, error) { + if f.srv.BeginRegisterServer == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRegisterServer not implemented")} + } + beginRegisterServer := f.beginRegisterServer.get(req) + if beginRegisterServer == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/registerServer` + 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[armdatabasefleetmanager.RegisterServerProperties](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginRegisterServer(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRegisterServer = &respr + f.beginRegisterServer.add(req, beginRegisterServer) + } + + resp, err := server.PollerResponderNext(beginRegisterServer, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginRegisterServer.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(beginRegisterServer) { + f.beginRegisterServer.remove(req) + } + + return resp, nil +} + +func (f *FleetspacesServerTransport) dispatchBeginUnregister(req *http.Request) (*http.Response, error) { + if f.srv.BeginUnregister == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUnregister not implemented")} + } + beginUnregister := f.beginUnregister.get(req) + if beginUnregister == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/unregister` + 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 + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginUnregister(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUnregister = &respr + f.beginUnregister.add(req, beginUnregister) + } + + resp, err := server.PollerResponderNext(beginUnregister, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + f.beginUnregister.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(beginUnregister) { + f.beginUnregister.remove(req) + } + + return resp, nil +} + +func (f *FleetspacesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := f.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fleetspaces/(?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[armdatabasefleetmanager.Fleetspace](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + fleetspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetspaceName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, fleetspaceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + f.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) { + f.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) { + f.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to FleetspacesServerTransport +var fleetspacesServerTransportInterceptor 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/databasefleetmanager/armdatabasefleetmanager/fake/fleettiers_server.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleettiers_server.go new file mode 100644 index 000000000000..10f00ff891dd --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/fleettiers_server.go @@ -0,0 +1,439 @@ +// Copyright (c) Microsoft 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/databasefleetmanager/armdatabasefleetmanager" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// FleetTiersServer is a fake server for instances of the armdatabasefleetmanager.FleetTiersClient type. +type FleetTiersServer struct { + // BeginCreateOrUpdate is the fake for method FleetTiersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, fleetName string, tierName string, resource armdatabasefleetmanager.FleetTier, options *armdatabasefleetmanager.FleetTiersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method FleetTiersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *armdatabasefleetmanager.FleetTiersClientBeginDeleteOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Disable is the fake for method FleetTiersClient.Disable + // HTTP status codes to indicate success: http.StatusOK + Disable func(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *armdatabasefleetmanager.FleetTiersClientDisableOptions) (resp azfake.Responder[armdatabasefleetmanager.FleetTiersClientDisableResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method FleetTiersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *armdatabasefleetmanager.FleetTiersClientGetOptions) (resp azfake.Responder[armdatabasefleetmanager.FleetTiersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByFleetPager is the fake for method FleetTiersClient.NewListByFleetPager + // HTTP status codes to indicate success: http.StatusOK + NewListByFleetPager func(resourceGroupName string, fleetName string, options *armdatabasefleetmanager.FleetTiersClientListByFleetOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.FleetTiersClientListByFleetResponse]) + + // BeginUpdate is the fake for method FleetTiersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, fleetName string, tierName string, properties armdatabasefleetmanager.FleetTier, options *armdatabasefleetmanager.FleetTiersClientBeginUpdateOptions) (resp azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewFleetTiersServerTransport creates a new instance of FleetTiersServerTransport with the provided implementation. +// The returned FleetTiersServerTransport instance is connected to an instance of armdatabasefleetmanager.FleetTiersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFleetTiersServerTransport(srv *FleetTiersServer) *FleetTiersServerTransport { + return &FleetTiersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientDeleteResponse]](), + newListByFleetPager: newTracker[azfake.PagerResponder[armdatabasefleetmanager.FleetTiersClientListByFleetResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientUpdateResponse]](), + } +} + +// FleetTiersServerTransport connects instances of armdatabasefleetmanager.FleetTiersClient to instances of FleetTiersServer. +// Don't use this type directly, use NewFleetTiersServerTransport instead. +type FleetTiersServerTransport struct { + srv *FleetTiersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientDeleteResponse]] + newListByFleetPager *tracker[azfake.PagerResponder[armdatabasefleetmanager.FleetTiersClientListByFleetResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdatabasefleetmanager.FleetTiersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for FleetTiersServerTransport. +func (f *FleetTiersServerTransport) 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 f.dispatchToMethodFake(req, method) +} + +func (f *FleetTiersServerTransport) 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 fleetTiersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fleetTiersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FleetTiersClient.BeginCreateOrUpdate": + res.resp, res.err = f.dispatchBeginCreateOrUpdate(req) + case "FleetTiersClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FleetTiersClient.Disable": + res.resp, res.err = f.dispatchDisable(req) + case "FleetTiersClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FleetTiersClient.NewListByFleetPager": + res.resp, res.err = f.dispatchNewListByFleetPager(req) + case "FleetTiersClient.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 *FleetTiersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := f.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tiers/(?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[armdatabasefleetmanager.FleetTier](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + tierNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tierName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, tierNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + f.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) { + f.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) { + f.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (f *FleetTiersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := f.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tiers/(?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 + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + tierNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tierName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fleetNameParam, tierNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + f.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) { + f.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) { + f.beginDelete.remove(req) + } + + return resp, nil +} + +func (f *FleetTiersServerTransport) dispatchDisable(req *http.Request) (*http.Response, error) { + if f.srv.Disable == nil { + return nil, &nonRetriableError{errors.New("fake for method Disable not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tiers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/disable` + 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 + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + tierNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tierName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Disable(req.Context(), resourceGroupNameParam, fleetNameParam, tierNameParam, 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).FleetTier, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FleetTiersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.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\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tiers/(?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 + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + tierNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tierName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fleetNameParam, tierNameParam, 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).FleetTier, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FleetTiersServerTransport) dispatchNewListByFleetPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListByFleetPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByFleetPager not implemented")} + } + newListByFleetPager := f.newListByFleetPager.get(req) + if newListByFleetPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tiers` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int64, error) { + p, parseErr := strconv.ParseInt(v, 10, 64) + if parseErr != nil { + return 0, parseErr + } + return p, nil + }) + if err != nil { + return nil, err + } + skiptokenUnescaped, err := url.QueryUnescape(qp.Get("$skiptoken")) + if err != nil { + return nil, err + } + skiptokenParam := getOptional(skiptokenUnescaped) + var options *armdatabasefleetmanager.FleetTiersClientListByFleetOptions + if skipParam != nil || topParam != nil || skiptokenParam != nil { + options = &armdatabasefleetmanager.FleetTiersClientListByFleetOptions{ + Skip: skipParam, + Top: topParam, + Skiptoken: skiptokenParam, + } + } + resp := f.srv.NewListByFleetPager(resourceGroupNameParam, fleetNameParam, options) + newListByFleetPager = &resp + f.newListByFleetPager.add(req, newListByFleetPager) + server.PagerResponderInjectNextLinks(newListByFleetPager, req, func(page *armdatabasefleetmanager.FleetTiersClientListByFleetResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByFleetPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + f.newListByFleetPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByFleetPager) { + f.newListByFleetPager.remove(req) + } + return resp, nil +} + +func (f *FleetTiersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if f.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := f.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseFleetManager/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tiers/(?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[armdatabasefleetmanager.FleetTier](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + fleetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fleetName")]) + if err != nil { + return nil, err + } + tierNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("tierName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.BeginUpdate(req.Context(), resourceGroupNameParam, fleetNameParam, tierNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + f.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) { + f.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) { + f.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to FleetTiersServerTransport +var fleetTiersServerTransportInterceptor 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/databasefleetmanager/armdatabasefleetmanager/fake/internal.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/internal.go new file mode 100644 index 000000000000..41e62ec29233 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/internal.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 fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "reflect" + "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 getOptional[T any](v T) *T { + if reflect.ValueOf(v).IsZero() { + return nil + } + return &v +} + +func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { + if v == "" { + return nil, nil + } + t, err := parse(v) + if err != nil { + return nil, err + } + return &t, err +} + +func 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/databasefleetmanager/armdatabasefleetmanager/fake/operations_server.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/operations_server.go new file mode 100644 index 000000000000..d65ceda6770b --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/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/databasefleetmanager/armdatabasefleetmanager" + "net/http" +) + +// OperationsServer is a fake server for instances of the armdatabasefleetmanager.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armdatabasefleetmanager.OperationsClientListOptions) (resp azfake.PagerResponder[armdatabasefleetmanager.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armdatabasefleetmanager.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[armdatabasefleetmanager.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armdatabasefleetmanager.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armdatabasefleetmanager.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 *armdatabasefleetmanager.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/databasefleetmanager/armdatabasefleetmanager/fake/server_factory.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/server_factory.go new file mode 100644 index 000000000000..ba9a95b5f73f --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/server_factory.go @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager.ClientFactory type. +type ServerFactory struct { + // FirewallRulesServer contains the fakes for client FirewallRulesClient + FirewallRulesServer FirewallRulesServer + + // FleetDatabasesServer contains the fakes for client FleetDatabasesClient + FleetDatabasesServer FleetDatabasesServer + + // FleetTiersServer contains the fakes for client FleetTiersClient + FleetTiersServer FleetTiersServer + + // FleetsServer contains the fakes for client FleetsClient + FleetsServer FleetsServer + + // FleetspacesServer contains the fakes for client FleetspacesClient + FleetspacesServer FleetspacesServer + + // 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 armdatabasefleetmanager.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 armdatabasefleetmanager.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trFirewallRulesServer *FirewallRulesServerTransport + trFleetDatabasesServer *FleetDatabasesServerTransport + trFleetTiersServer *FleetTiersServerTransport + trFleetsServer *FleetsServerTransport + trFleetspacesServer *FleetspacesServerTransport + 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 "FirewallRulesClient": + initServer(s, &s.trFirewallRulesServer, func() *FirewallRulesServerTransport { + return NewFirewallRulesServerTransport(&s.srv.FirewallRulesServer) + }) + resp, err = s.trFirewallRulesServer.Do(req) + case "FleetDatabasesClient": + initServer(s, &s.trFleetDatabasesServer, func() *FleetDatabasesServerTransport { + return NewFleetDatabasesServerTransport(&s.srv.FleetDatabasesServer) + }) + resp, err = s.trFleetDatabasesServer.Do(req) + case "FleetTiersClient": + initServer(s, &s.trFleetTiersServer, func() *FleetTiersServerTransport { return NewFleetTiersServerTransport(&s.srv.FleetTiersServer) }) + resp, err = s.trFleetTiersServer.Do(req) + case "FleetsClient": + initServer(s, &s.trFleetsServer, func() *FleetsServerTransport { return NewFleetsServerTransport(&s.srv.FleetsServer) }) + resp, err = s.trFleetsServer.Do(req) + case "FleetspacesClient": + initServer(s, &s.trFleetspacesServer, func() *FleetspacesServerTransport { return NewFleetspacesServerTransport(&s.srv.FleetspacesServer) }) + resp, err = s.trFleetspacesServer.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/databasefleetmanager/armdatabasefleetmanager/fake/time_rfc3339.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fake/time_rfc3339.go new file mode 100644 index 000000000000..87ee11e83b32 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/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/databasefleetmanager/armdatabasefleetmanager/firewallrules_client.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/firewallrules_client.go new file mode 100644 index 000000000000..503cc3a93ac9 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/firewallrules_client.go @@ -0,0 +1,371 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// FirewallRulesClient contains the methods for the FirewallRules group. +// Don't use this type directly, use NewFirewallRulesClient() instead. +type FirewallRulesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFirewallRulesClient creates a new instance of FirewallRulesClient 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 NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FirewallRulesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FirewallRulesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a firewall rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - firewallRuleName - Name of the firewall rule. +// - resource - The firewall rule object to create or update. +// - options - FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate +// method. +func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, resource FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FirewallRulesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, fleetspaceName, firewallRuleName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FirewallRulesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FirewallRulesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a firewall rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FirewallRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, resource FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FirewallRulesClient.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, fleetName, fleetspaceName, firewallRuleName, 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 *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, resource FirewallRule, _ *FirewallRulesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/firewallRules/{firewallRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if firewallRuleName == "" { + return nil, errors.New("parameter firewallRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallRuleName}", url.PathEscape(firewallRuleName)) + 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", "2025-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 +} + +// BeginDelete - Deletes a firewall rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - firewallRuleName - Name of the firewall rule. +// - options - FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete +// method. +func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*runtime.Poller[FirewallRulesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, fleetName, fleetspaceName, firewallRuleName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FirewallRulesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FirewallRulesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a firewall rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FirewallRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "FirewallRulesClient.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, fleetName, fleetspaceName, firewallRuleName, 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 *FirewallRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, _ *FirewallRulesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/firewallRules/{firewallRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if firewallRuleName == "" { + return nil, errors.New("parameter firewallRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallRuleName}", url.PathEscape(firewallRuleName)) + 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", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a firewall rule. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - firewallRuleName - Name of the firewall rule. +// - options - FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. +func (client *FirewallRulesClient) Get(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, options *FirewallRulesClientGetOptions) (FirewallRulesClientGetResponse, error) { + var err error + const operationName = "FirewallRulesClient.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, fleetName, fleetspaceName, firewallRuleName, options) + if err != nil { + return FirewallRulesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FirewallRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FirewallRulesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, firewallRuleName string, _ *FirewallRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/firewallRules/{firewallRuleName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if firewallRuleName == "" { + return nil, errors.New("parameter firewallRuleName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallRuleName}", url.PathEscape(firewallRuleName)) + 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", "2025-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 *FirewallRulesClient) getHandleResponse(resp *http.Response) (FirewallRulesClientGetResponse, error) { + result := FirewallRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { + return FirewallRulesClientGetResponse{}, err + } + return result, nil +} + +// NewListByFleetspacePager - Gets all firewall rules in a fleetspace. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - options - FirewallRulesClientListByFleetspaceOptions contains the optional parameters for the FirewallRulesClient.NewListByFleetspacePager +// method. +func (client *FirewallRulesClient) NewListByFleetspacePager(resourceGroupName string, fleetName string, fleetspaceName string, options *FirewallRulesClientListByFleetspaceOptions) *runtime.Pager[FirewallRulesClientListByFleetspaceResponse] { + return runtime.NewPager(runtime.PagingHandler[FirewallRulesClientListByFleetspaceResponse]{ + More: func(page FirewallRulesClientListByFleetspaceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FirewallRulesClientListByFleetspaceResponse) (FirewallRulesClientListByFleetspaceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FirewallRulesClient.NewListByFleetspacePager") + 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.listByFleetspaceCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, options) + }, nil) + if err != nil { + return FirewallRulesClientListByFleetspaceResponse{}, err + } + return client.listByFleetspaceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByFleetspaceCreateRequest creates the ListByFleetspace request. +func (client *FirewallRulesClient) listByFleetspaceCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FirewallRulesClientListByFleetspaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/firewallRules" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) + } + if options != nil && options.Skiptoken != nil { + reqQP.Set("$skiptoken", *options.Skiptoken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) + } + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByFleetspaceHandleResponse handles the ListByFleetspace response. +func (client *FirewallRulesClient) listByFleetspaceHandleResponse(resp *http.Response) (FirewallRulesClientListByFleetspaceResponse, error) { + result := FirewallRulesClientListByFleetspaceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRuleListResult); err != nil { + return FirewallRulesClientListByFleetspaceResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/firewallrules_client_example_test.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/firewallrules_client_example_test.go new file mode 100644 index 000000000000..9389a0452127 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/firewallrules_client_example_test.go @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager_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/databasefleetmanager/armdatabasefleetmanager" + "log" +) + +// Generated from example definition: 2025-02-01-preview/FirewallRules_CreateOrUpdate_MaximumSet_Gen.json +func ExampleFirewallRulesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("a2b3c4d5-6789-0123-4567-89abcdef1234", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFirewallRulesClient().BeginCreateOrUpdate(ctx, "rg-networking-operations", "data-fleet-01", "prod-environment", "allow-10-0-0-0-24-to-10-1-0-0-24", armdatabasefleetmanager.FirewallRule{ + Properties: &armdatabasefleetmanager.FirewallRuleProperties{ + StartIPAddress: to.Ptr("10.0.0.0"), + EndIPAddress: to.Ptr("10.0.0.255"), + }, + }, 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 = armdatabasefleetmanager.FirewallRulesClientCreateOrUpdateResponse{ + // FirewallRule: &armdatabasefleetmanager.FirewallRule{ + // Properties: &armdatabasefleetmanager.FirewallRuleProperties{ + // StartIPAddress: to.Ptr("10.0.0.0"), + // EndIPAddress: to.Ptr("10.0.0.255"), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/a2b3c4d5-6789-0123-4567-89abcdef1234/resourceGroups/rg-networking-operations/providers/Microsoft.DatabaseFleetManager/fleets/data-fleet-01/fleetspaces/prod-environment/firewallRules/allow-10-0-0-0-24-to-10-1-0-0-24"), + // Name: to.Ptr("allow-10-0-0-0-24-to-10-1-0-0-24"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/firewallRules"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("admin.jdoe"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-01T14:30:45.123Z"); return t}()), + // LastModifiedBy: to.Ptr("admin.jdoe"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-01T14:30:45.124Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-01-preview/FirewallRules_Delete_MaximumSet_Gen.json +func ExampleFirewallRulesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("a2b3c4d5-6789-0123-4567-89abcdef1234", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFirewallRulesClient().BeginDelete(ctx, "rg-networking-operations", "data-fleet-01", "prod-environment", "allow-10-0-0-0-24-to-10-1-0-0-24", 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: 2025-02-01-preview/FirewallRules_Get_MaximumSet_Gen.json +func ExampleFirewallRulesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("a2b3c4d5-6789-0123-4567-89abcdef1234", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFirewallRulesClient().Get(ctx, "rg-networking-operations", "data-fleet-01", "prod-environment", "allow-10-0-0-0-24-to-10-1-0-0-24", 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 = armdatabasefleetmanager.FirewallRulesClientGetResponse{ + // FirewallRule: &armdatabasefleetmanager.FirewallRule{ + // Properties: &armdatabasefleetmanager.FirewallRuleProperties{ + // StartIPAddress: to.Ptr("10.0.0.0"), + // EndIPAddress: to.Ptr("10.0.0.255"), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/a2b3c4d5-6789-0123-4567-89abcdef1234/resourceGroups/rg-networking-operations/providers/Microsoft.DatabaseFleetManager/fleets/data-fleet-01/fleetspaces/prod-environment/firewallRules/allow-10-0-0-0-24-to-10-1-0-0-24"), + // Name: to.Ptr("allow-10-0-0-0-24-to-10-1-0-0-24"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/fleetspaces/firewallRules"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("admin.jdoe"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-01T14:30:45.123Z"); return t}()), + // LastModifiedBy: to.Ptr("admin.jdoe"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-01T14:30:45.124Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-01-preview/FirewallRules_ListByFleetspace_MaximumSet_Gen.json +func ExampleFirewallRulesClient_NewListByFleetspacePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("a2b3c4d5-6789-0123-4567-89abcdef1234", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFirewallRulesClient().NewListByFleetspacePager("rg-networking-operations", "data-fleet-01", "prod-environment", &FirewallRulesClientListByFleetspaceOptions{ + Skip: to.Ptr[int64](8), + Top: to.Ptr[int64](18), + Skiptoken: to.Ptr("thjchalxuwykrawwdgaie")}) + 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 = armdatabasefleetmanager.FirewallRulesClientListByFleetspaceResponse{ + // FirewallRuleListResult: armdatabasefleetmanager.FirewallRuleListResult{ + // Value: []*armdatabasefleetmanager.FirewallRule{ + // { + // Properties: &armdatabasefleetmanager.FirewallRuleProperties{ + // StartIPAddress: to.Ptr("10.0.0.0"), + // EndIPAddress: to.Ptr("10.0.0.255"), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/a2b3c4d5-6789-0123-4567-89abcdef1234/resourceGroups/rg-networking-operations/providers/Microsoft.DatabaseFleetManager/fleets/data-fleet-01/fleetspaces/prod-environment/firewallRules/allow-10-0-0-0-24-to-10-1-0-0-24"), + // Name: to.Ptr("allow-10-0-0-0-24-to-10-1-0-0-24"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/fleetspaces/firewallRules"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("admin.jdoe"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-01T14:30:45.123Z"); return t}()), + // LastModifiedBy: to.Ptr("admin.jdoe"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-01T14:30:45.124Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetdatabases_client.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetdatabases_client.go new file mode 100644 index 000000000000..d62796a17149 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetdatabases_client.go @@ -0,0 +1,733 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// FleetDatabasesClient contains the methods for the FleetDatabases group. +// Don't use this type directly, use NewFleetDatabasesClient() instead. +type FleetDatabasesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFleetDatabasesClient creates a new instance of FleetDatabasesClient 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 NewFleetDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FleetDatabasesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FleetDatabasesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginChangeTier - Moves database to a different tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - body - The details of the change tier operation. +// - options - FleetDatabasesClientBeginChangeTierOptions contains the optional parameters for the FleetDatabasesClient.BeginChangeTier +// method. +func (client *FleetDatabasesClient) BeginChangeTier(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body DatabaseChangeTierProperties, options *FleetDatabasesClientBeginChangeTierOptions) (*runtime.Poller[FleetDatabasesClientChangeTierResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.changeTier(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetDatabasesClientChangeTierResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetDatabasesClientChangeTierResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ChangeTier - Moves database to a different tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetDatabasesClient) changeTier(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body DatabaseChangeTierProperties, options *FleetDatabasesClientBeginChangeTierOptions) (*http.Response, error) { + var err error + const operationName = "FleetDatabasesClient.BeginChangeTier" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.changeTierCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// changeTierCreateRequest creates the ChangeTier request. +func (client *FleetDatabasesClient) changeTierCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body DatabaseChangeTierProperties, _ *FleetDatabasesClientBeginChangeTierOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}/changeTier" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + 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", "2025-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, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginCreateOrUpdate - Creates or updates a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - resource - The database object to create or update. +// - options - FleetDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetDatabasesClient.BeginCreateOrUpdate +// method. +func (client *FleetDatabasesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, resource FleetDatabase, options *FleetDatabasesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetDatabasesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetDatabasesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetDatabasesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetDatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, resource FleetDatabase, options *FleetDatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetDatabasesClient.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, fleetName, fleetspaceName, databaseName, 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 *FleetDatabasesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, resource FleetDatabase, _ *FleetDatabasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + 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", "2025-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 +} + +// BeginDelete - Deletes a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - options - FleetDatabasesClientBeginDeleteOptions contains the optional parameters for the FleetDatabasesClient.BeginDelete +// method. +func (client *FleetDatabasesClient) BeginDelete(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *FleetDatabasesClientBeginDeleteOptions) (*runtime.Poller[FleetDatabasesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetDatabasesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetDatabasesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetDatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *FleetDatabasesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "FleetDatabasesClient.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, fleetName, fleetspaceName, databaseName, 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 *FleetDatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, _ *FleetDatabasesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + 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", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - options - FleetDatabasesClientGetOptions contains the optional parameters for the FleetDatabasesClient.Get method. +func (client *FleetDatabasesClient) Get(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *FleetDatabasesClientGetOptions) (FleetDatabasesClientGetResponse, error) { + var err error + const operationName = "FleetDatabasesClient.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, fleetName, fleetspaceName, databaseName, options) + if err != nil { + return FleetDatabasesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FleetDatabasesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetDatabasesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FleetDatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, _ *FleetDatabasesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + 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", "2025-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 *FleetDatabasesClient) getHandleResponse(resp *http.Response) (FleetDatabasesClientGetResponse, error) { + result := FleetDatabasesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetDatabase); err != nil { + return FleetDatabasesClientGetResponse{}, err + } + return result, nil +} + +// NewListByFleetspacePager - Gets all fleet databases in a fleetspace. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - options - FleetDatabasesClientListByFleetspaceOptions contains the optional parameters for the FleetDatabasesClient.NewListByFleetspacePager +// method. +func (client *FleetDatabasesClient) NewListByFleetspacePager(resourceGroupName string, fleetName string, fleetspaceName string, options *FleetDatabasesClientListByFleetspaceOptions) *runtime.Pager[FleetDatabasesClientListByFleetspaceResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetDatabasesClientListByFleetspaceResponse]{ + More: func(page FleetDatabasesClientListByFleetspaceResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetDatabasesClientListByFleetspaceResponse) (FleetDatabasesClientListByFleetspaceResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FleetDatabasesClient.NewListByFleetspacePager") + 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.listByFleetspaceCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, options) + }, nil) + if err != nil { + return FleetDatabasesClientListByFleetspaceResponse{}, err + } + return client.listByFleetspaceHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByFleetspaceCreateRequest creates the ListByFleetspace request. +func (client *FleetDatabasesClient) listByFleetspaceCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FleetDatabasesClientListByFleetspaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) + } + if options != nil && options.Skiptoken != nil { + reqQP.Set("$skiptoken", *options.Skiptoken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) + } + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByFleetspaceHandleResponse handles the ListByFleetspace response. +func (client *FleetDatabasesClient) listByFleetspaceHandleResponse(resp *http.Response) (FleetDatabasesClientListByFleetspaceResponse, error) { + result := FleetDatabasesClientListByFleetspaceResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetDatabaseListResult); err != nil { + return FleetDatabasesClientListByFleetspaceResponse{}, err + } + return result, nil +} + +// BeginRename - Renames a database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - body - The details of the rename operation. +// - options - FleetDatabasesClientBeginRenameOptions contains the optional parameters for the FleetDatabasesClient.BeginRename +// method. +func (client *FleetDatabasesClient) BeginRename(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body DatabaseRenameProperties, options *FleetDatabasesClientBeginRenameOptions) (*runtime.Poller[FleetDatabasesClientRenameResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.rename(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetDatabasesClientRenameResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetDatabasesClientRenameResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Rename - Renames a database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetDatabasesClient) rename(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body DatabaseRenameProperties, options *FleetDatabasesClientBeginRenameOptions) (*http.Response, error) { + var err error + const operationName = "FleetDatabasesClient.BeginRename" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.renameCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// renameCreateRequest creates the Rename request. +func (client *FleetDatabasesClient) renameCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, body DatabaseRenameProperties, _ *FleetDatabasesClientBeginRenameOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}/rename" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + 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", "2025-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, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginRevert - Revert a database transparent data encryption (TDE). +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - options - FleetDatabasesClientBeginRevertOptions contains the optional parameters for the FleetDatabasesClient.BeginRevert +// method. +func (client *FleetDatabasesClient) BeginRevert(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *FleetDatabasesClientBeginRevertOptions) (*runtime.Poller[FleetDatabasesClientRevertResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.revert(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetDatabasesClientRevertResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetDatabasesClientRevertResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Revert - Revert a database transparent data encryption (TDE). +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetDatabasesClient) revert(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, options *FleetDatabasesClientBeginRevertOptions) (*http.Response, error) { + var err error + const operationName = "FleetDatabasesClient.BeginRevert" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.revertCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// revertCreateRequest creates the Revert request. +func (client *FleetDatabasesClient) revertCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, _ *FleetDatabasesClientBeginRevertOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}/revert" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + 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", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Updates a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - databaseName - Name of the database. +// - properties - The database object to patch. +// - options - FleetDatabasesClientBeginUpdateOptions contains the optional parameters for the FleetDatabasesClient.BeginUpdate +// method. +func (client *FleetDatabasesClient) BeginUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, properties FleetDatabase, options *FleetDatabasesClientBeginUpdateOptions) (*runtime.Poller[FleetDatabasesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, fleetName, fleetspaceName, databaseName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetDatabasesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetDatabasesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a fleet database. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetDatabasesClient) update(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, properties FleetDatabase, options *FleetDatabasesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetDatabasesClient.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, fleetName, fleetspaceName, databaseName, 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 *FleetDatabasesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, databaseName string, properties FleetDatabase, _ *FleetDatabasesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/databases/{databaseName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + 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", "2025-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 +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetdatabases_client_example_test.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetdatabases_client_example_test.go new file mode 100644 index 000000000000..0c4bee52a57f --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetdatabases_client_example_test.go @@ -0,0 +1,464 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager_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/databasefleetmanager/armdatabasefleetmanager" + "log" + "time" +) + +// Generated from example definition: 2025-02-01-preview/FleetDatabases_ChangeTier_MaximumSet_Gen.json +func ExampleFleetDatabasesClient_BeginChangeTier() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetDatabasesClient().BeginChangeTier(ctx, "rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", armdatabasefleetmanager.DatabaseChangeTierProperties{ + TargetTierName: to.Ptr("Standard"), + }, 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: 2025-02-01-preview/FleetDatabases_CreateOrUpdate_MaximumSet_Gen.json +func ExampleFleetDatabasesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetDatabasesClient().BeginCreateOrUpdate(ctx, "rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", armdatabasefleetmanager.FleetDatabase{ + Properties: &armdatabasefleetmanager.FleetDatabaseProperties{ + CreateMode: to.Ptr(armdatabasefleetmanager.DatabaseCreateModeDefault), + TierName: to.Ptr("Premium"), + RestoreFromTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t }()), + SourceDatabaseName: to.Ptr("existing-db-prod"), + ResourceTags: map[string]*string{ + "project": to.Ptr("Customer Data"), + }, + Identity: &armdatabasefleetmanager.Identity{ + IdentityType: to.Ptr(armdatabasefleetmanager.IdentityTypeNone), + UserAssignedIdentities: []*armdatabasefleetmanager.DatabaseIdentity{ + { + ResourceID: to.Ptr("/subscriptions/12345678-90ab-cdef-1234-567890abcdef/resourceGroups/rg-database-operations/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-01"), + PrincipalID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + ClientID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + }, + }, + FederatedClientID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + }, + TransparentDataEncryption: &armdatabasefleetmanager.TransparentDataEncryption{ + KeyURI: to.Ptr("https://keyvaultname.vault.azure.net/keys/myKey/12345"), + Keys: []*string{ + to.Ptr("key1"), + }, + EnableAutoRotation: to.Ptr(true), + }, + }, + }, 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 = armdatabasefleetmanager.FleetDatabasesClientCreateOrUpdateResponse{ + // FleetDatabase: &armdatabasefleetmanager.FleetDatabase{ + // Properties: &armdatabasefleetmanager.FleetDatabaseProperties{ + // OriginalDatabaseID: to.Ptr("uwzvasvknrwbnqgu"), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // CreateMode: to.Ptr(armdatabasefleetmanager.DatabaseCreateModeDefault), + // TierName: to.Ptr("Premium"), + // ConnectionString: to.Ptr("Server=myserver.database.windows.net;Database=customer-db-prod;User Id=user;"), + // Recoverable: to.Ptr(true), + // RestoreFromTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t}()), + // EarliestRestoreTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t}()), + // LatestRestoreTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t}()), + // BackupRetentionDays: to.Ptr[int32](22), + // DatabaseSizeGbMax: to.Ptr[int32](100), + // SourceDatabaseName: to.Ptr("existing-db-prod"), + // ResourceTags: map[string]*string{ + // "project": to.Ptr("Customer Data"), + // }, + // Identity: &armdatabasefleetmanager.Identity{ + // IdentityType: to.Ptr(armdatabasefleetmanager.IdentityTypeNone), + // UserAssignedIdentities: []*armdatabasefleetmanager.DatabaseIdentity{ + // { + // ResourceID: to.Ptr("/subscriptions/12345678-90ab-cdef-1234-567890abcdef/resourceGroups/rg-database-operations/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-01"), + // PrincipalID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + // ClientID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + // }, + // }, + // FederatedClientID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + // }, + // TransparentDataEncryption: &armdatabasefleetmanager.TransparentDataEncryption{ + // KeyURI: to.Ptr("https://keyvaultname.vault.azure.net/keys/myKey/12345"), + // Keys: []*string{ + // to.Ptr("key1"), + // }, + // EnableAutoRotation: to.Ptr(true), + // }, + // }, + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-operations/providers/Microsoft.DatabaseFleetManager/fleet/fleetspace/database/customer-db-prod"), + // Name: to.Ptr("customer-db-prod"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleet/fleetspace/database"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("admin-user"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("admin-user"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-01-preview/FleetDatabases_Delete_MaximumSet_Gen.json +func ExampleFleetDatabasesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetDatabasesClient().BeginDelete(ctx, "rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", 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: 2025-02-01-preview/FleetDatabases_Get_MaximumSet_Gen.json +func ExampleFleetDatabasesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFleetDatabasesClient().Get(ctx, "rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", 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 = armdatabasefleetmanager.FleetDatabasesClientGetResponse{ + // FleetDatabase: &armdatabasefleetmanager.FleetDatabase{ + // Properties: &armdatabasefleetmanager.FleetDatabaseProperties{ + // OriginalDatabaseID: to.Ptr("uwzvasvknrwbnqgu"), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // CreateMode: to.Ptr(armdatabasefleetmanager.DatabaseCreateModeDefault), + // TierName: to.Ptr("Premium"), + // ConnectionString: to.Ptr("Server=myserver.database.windows.net;Database=customer-db-prod;User Id=user;"), + // Recoverable: to.Ptr(true), + // RestoreFromTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t}()), + // EarliestRestoreTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t}()), + // LatestRestoreTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t}()), + // BackupRetentionDays: to.Ptr[int32](22), + // DatabaseSizeGbMax: to.Ptr[int32](100), + // SourceDatabaseName: to.Ptr("existing-db-prod"), + // ResourceTags: map[string]*string{ + // "project": to.Ptr("Customer Data"), + // }, + // Identity: &armdatabasefleetmanager.Identity{ + // IdentityType: to.Ptr(armdatabasefleetmanager.IdentityTypeNone), + // UserAssignedIdentities: []*armdatabasefleetmanager.DatabaseIdentity{ + // { + // ResourceID: to.Ptr("/subscriptions/12345678-90ab-cdef-1234-567890abcdef/resourceGroups/rg-database-operations/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-01"), + // PrincipalID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + // ClientID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + // }, + // }, + // FederatedClientID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + // }, + // TransparentDataEncryption: &armdatabasefleetmanager.TransparentDataEncryption{ + // KeyURI: to.Ptr("https://keyvaultname.vault.azure.net/keys/myKey/12345"), + // Keys: []*string{ + // to.Ptr("key1"), + // }, + // EnableAutoRotation: to.Ptr(true), + // }, + // }, + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-operations/providers/Microsoft.DatabaseFleetManager/fleets/fleet-01/fleetspaces/prod-environment/databases/customer-db-prod"), + // Name: to.Ptr("customer-db-prod"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/fleetspaces/databases"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("admin-user"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("admin-user"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-01-preview/FleetDatabases_ListByFleetspace_MaximumSet_Gen.json +func ExampleFleetDatabasesClient_NewListByFleetspacePager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetDatabasesClient().NewListByFleetspacePager("rg-database-operations", "data-fleet-01", "prod-environment", &FleetDatabasesClientListByFleetspaceOptions{ + Skip: to.Ptr[int64](24), + Top: to.Ptr[int64](2), + Filter: to.Ptr("tier eq 'Premium'"), + Skiptoken: to.Ptr("sbrskcoueja")}) + 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 = armdatabasefleetmanager.FleetDatabasesClientListByFleetspaceResponse{ + // FleetDatabaseListResult: armdatabasefleetmanager.FleetDatabaseListResult{ + // Value: []*armdatabasefleetmanager.FleetDatabase{ + // { + // Properties: &armdatabasefleetmanager.FleetDatabaseProperties{ + // OriginalDatabaseID: to.Ptr("uwzvasvknrwbnqgu"), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // CreateMode: to.Ptr(armdatabasefleetmanager.DatabaseCreateModeDefault), + // TierName: to.Ptr("Premium"), + // ConnectionString: to.Ptr("Server=myserver.database.windows.net;Database=customer-db-prod;User Id=user;"), + // Recoverable: to.Ptr(true), + // RestoreFromTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t}()), + // EarliestRestoreTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t}()), + // LatestRestoreTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t}()), + // BackupRetentionDays: to.Ptr[int32](22), + // DatabaseSizeGbMax: to.Ptr[int32](100), + // SourceDatabaseName: to.Ptr("existing-db-prod"), + // ResourceTags: map[string]*string{ + // "project": to.Ptr("Customer Data"), + // }, + // Identity: &armdatabasefleetmanager.Identity{ + // IdentityType: to.Ptr(armdatabasefleetmanager.IdentityTypeNone), + // UserAssignedIdentities: []*armdatabasefleetmanager.DatabaseIdentity{ + // { + // ResourceID: to.Ptr("/subscriptions/12345678-90ab-cdef-1234-567890abcdef/resourceGroups/rg-database-operations/providers/Microsoft.ManagedIdentity/userAssignedIdentities/identity-01"), + // PrincipalID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + // ClientID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + // }, + // }, + // FederatedClientID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + // }, + // TransparentDataEncryption: &armdatabasefleetmanager.TransparentDataEncryption{ + // KeyURI: to.Ptr("https://keyvaultname.vault.azure.net/keys/myKey/12345"), + // Keys: []*string{ + // to.Ptr("key1"), + // }, + // EnableAutoRotation: to.Ptr(true), + // }, + // }, + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-operations/providers/Microsoft.DatabaseFleetManager/fleets/fleet-01/fleetspaces/prod-environment/databases/customer-db-prod"), + // Name: to.Ptr("customer-db-prod"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/fleetspaces/databases"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("admin-user"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("admin-user"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/ajgwcc"), + // }, + // } + } +} + +// Generated from example definition: 2025-02-01-preview/FleetDatabases_Rename_MaximumSet_Gen.json +func ExampleFleetDatabasesClient_BeginRename() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetDatabasesClient().BeginRename(ctx, "rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", armdatabasefleetmanager.DatabaseRenameProperties{ + NewName: to.Ptr("new-customer-db-prod"), + }, 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: 2025-02-01-preview/FleetDatabases_Revert_MaximumSet_Gen.json +func ExampleFleetDatabasesClient_BeginRevert() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetDatabasesClient().BeginRevert(ctx, "rg-database-operations", "data-fleet-01", "prod-environment", "customer-db-prod", 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: 2025-02-01-preview/FleetDatabases_Update_MaximumSet_Gen.json +func ExampleFleetDatabasesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetDatabasesClient().BeginUpdate(ctx, "rgdatabasefleetmanager", "production-fleet", "primary-space", "customer-database-prod", armdatabasefleetmanager.FleetDatabase{ + Properties: &armdatabasefleetmanager.FleetDatabaseProperties{ + CreateMode: to.Ptr(armdatabasefleetmanager.DatabaseCreateModeDefault), + TierName: to.Ptr("Standard"), + RestoreFromTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t }()), + SourceDatabaseName: to.Ptr("customer-database-staging"), + ResourceTags: map[string]*string{ + "environment": to.Ptr("production"), + "owner": to.Ptr("database-team"), + }, + Identity: &armdatabasefleetmanager.Identity{ + IdentityType: to.Ptr(armdatabasefleetmanager.IdentityTypeUserAssigned), + UserAssignedIdentities: []*armdatabasefleetmanager.DatabaseIdentity{ + { + ResourceID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourcegroups/rgdatabasefleetmanager/providers/Microsoft.ManagedIdentity/userAssignedIdentities/db-identity"), + PrincipalID: to.Ptr("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92"), + ClientID: to.Ptr("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39"), + }, + }, + FederatedClientID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + }, + TransparentDataEncryption: &armdatabasefleetmanager.TransparentDataEncryption{ + KeyURI: to.Ptr("https://keyvault-contoso.vault.azure.net/keys/db-encryption-key/abc123"), + Keys: []*string{ + to.Ptr("abc123"), + to.Ptr("xyz789"), + }, + EnableAutoRotation: to.Ptr(true), + }, + }, + }, 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 = armdatabasefleetmanager.FleetDatabasesClientUpdateResponse{ + // FleetDatabase: &armdatabasefleetmanager.FleetDatabase{ + // Properties: &armdatabasefleetmanager.FleetDatabaseProperties{ + // OriginalDatabaseID: to.Ptr("uwzvasvknrwbnqgu"), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // CreateMode: to.Ptr(armdatabasefleetmanager.DatabaseCreateModeDefault), + // TierName: to.Ptr("Standard"), + // ConnectionString: to.Ptr("Server=tcp:dbserver.contoso.com;Database=customer-database-prod;User ID=dbadmin;"), + // Recoverable: to.Ptr(true), + // RestoreFromTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t}()), + // EarliestRestoreTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t}()), + // LatestRestoreTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:05.048Z"); return t}()), + // BackupRetentionDays: to.Ptr[int32](30), + // DatabaseSizeGbMax: to.Ptr[int32](500), + // SourceDatabaseName: to.Ptr("customer-database-staging"), + // ResourceTags: map[string]*string{ + // "environment": to.Ptr("production"), + // "owner": to.Ptr("database-team"), + // }, + // Identity: &armdatabasefleetmanager.Identity{ + // IdentityType: to.Ptr(armdatabasefleetmanager.IdentityTypeUserAssigned), + // UserAssignedIdentities: []*armdatabasefleetmanager.DatabaseIdentity{ + // { + // ResourceID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourcegroups/rgdatabasefleetmanager/providers/Microsoft.ManagedIdentity/userAssignedIdentities/db-identity"), + // PrincipalID: to.Ptr("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92"), + // ClientID: to.Ptr("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39"), + // }, + // }, + // FederatedClientID: to.Ptr("a2b3c4d5-6789-0123-4567-89abcdef1234"), + // }, + // TransparentDataEncryption: &armdatabasefleetmanager.TransparentDataEncryption{ + // KeyURI: to.Ptr("https://keyvault-contoso.vault.azure.net/keys/db-encryption-key/abc123"), + // Keys: []*string{ + // to.Ptr("abc123"), + // to.Ptr("xyz789"), + // }, + // EnableAutoRotation: to.Ptr(true), + // }, + // }, + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-operations/providers/Microsoft.DatabaseFleetManager/fleets/fleet-01/fleetspaces/prod-environment/databases/customer-db-prod"), + // Name: to.Ptr("customer-db-prod"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/fleetspaces/databases"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("adminUser"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("adminUser"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleets_client.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleets_client.go new file mode 100644 index 000000000000..6804c316ea53 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleets_client.go @@ -0,0 +1,464 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// FleetsClient contains the methods for the Fleets group. +// Don't use this type directly, use NewFleetsClient() instead. +type FleetsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFleetsClient creates a new instance of FleetsClient 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 NewFleetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FleetsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FleetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a fleet resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - resource - The fleet object to create or update. +// - options - FleetsClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetsClient.BeginCreateOrUpdate +// method. +func (client *FleetsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a fleet resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetsClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, options *FleetsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetsClient.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, fleetName, 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 *FleetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, resource Fleet, _ *FleetsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + 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", "2025-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 +} + +// BeginDelete - Deletes a fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - options - FleetsClientBeginDeleteOptions contains the optional parameters for the FleetsClient.BeginDelete method. +func (client *FleetsClient) BeginDelete(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientBeginDeleteOptions) (*runtime.Poller[FleetsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, fleetName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetsClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "FleetsClient.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, fleetName, 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 *FleetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, _ *FleetsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + 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", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a fleet resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - options - FleetsClientGetOptions contains the optional parameters for the FleetsClient.Get method. +func (client *FleetsClient) Get(ctx context.Context, resourceGroupName string, fleetName string, options *FleetsClientGetOptions) (FleetsClientGetResponse, error) { + var err error + const operationName = "FleetsClient.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, fleetName, options) + if err != nil { + return FleetsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FleetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FleetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, _ *FleetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + 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", "2025-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 *FleetsClient) getHandleResponse(resp *http.Response) (FleetsClientGetResponse, error) { + result := FleetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Fleet); err != nil { + return FleetsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all fleets in a subscription. +// +// Generated from API version 2025-02-01-preview +// - options - FleetsClientListOptions contains the optional parameters for the FleetsClient.NewListPager method. +func (client *FleetsClient) NewListPager(options *FleetsClientListOptions) *runtime.Pager[FleetsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetsClientListResponse]{ + More: func(page FleetsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetsClientListResponse) (FleetsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FleetsClient.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 FleetsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *FleetsClient) listCreateRequest(ctx context.Context, _ *FleetsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DatabaseFleetManager/fleets" + 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", "2025-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 *FleetsClient) listHandleResponse(resp *http.Response) (FleetsClientListResponse, error) { + result := FleetsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetListResult); err != nil { + return FleetsClientListResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - Gets all fleets in a resource group. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - FleetsClientListByResourceGroupOptions contains the optional parameters for the FleetsClient.NewListByResourceGroupPager +// method. +func (client *FleetsClient) NewListByResourceGroupPager(resourceGroupName string, options *FleetsClientListByResourceGroupOptions) *runtime.Pager[FleetsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetsClientListByResourceGroupResponse]{ + More: func(page FleetsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetsClientListByResourceGroupResponse) (FleetsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FleetsClient.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 FleetsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *FleetsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *FleetsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{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() + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) + } + if options != nil && options.Skiptoken != nil { + reqQP.Set("$skiptoken", *options.Skiptoken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) + } + reqQP.Set("api-version", "2025-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 *FleetsClient) listByResourceGroupHandleResponse(resp *http.Response) (FleetsClientListByResourceGroupResponse, error) { + result := FleetsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetListResult); err != nil { + return FleetsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// BeginUpdate - Modifies a fleet resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - properties - The fleet object to patch. +// - options - FleetsClientBeginUpdateOptions contains the optional parameters for the FleetsClient.BeginUpdate method. +func (client *FleetsClient) BeginUpdate(ctx context.Context, resourceGroupName string, fleetName string, properties FleetUpdate, options *FleetsClientBeginUpdateOptions) (*runtime.Poller[FleetsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, fleetName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Modifies a fleet resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetsClient) update(ctx context.Context, resourceGroupName string, fleetName string, properties FleetUpdate, options *FleetsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetsClient.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, fleetName, 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 *FleetsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, properties FleetUpdate, _ *FleetsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + 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", "2025-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 +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleets_client_example_test.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleets_client_example_test.go new file mode 100644 index 000000000000..23ed412afd59 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleets_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 armdatabasefleetmanager_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/databasefleetmanager/armdatabasefleetmanager" + "log" +) + +// Generated from example definition: 2025-02-01-preview/Fleets_CreateOrUpdate_MaximumSet_Gen.json +func ExampleFleetsClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetsClient().BeginCreateOrUpdate(ctx, "rg-database-fleet-manager", "production-fleet-01", armdatabasefleetmanager.Fleet{ + Properties: &armdatabasefleetmanager.FleetProperties{ + Description: to.Ptr("Production fleet for high availability and scalability."), + }, + Tags: map[string]*string{ + "environment": to.Ptr("production"), + "owner": to.Ptr("team-database"), + }, + Location: to.Ptr("East US"), + }, 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 = armdatabasefleetmanager.FleetsClientCreateOrUpdateResponse{ + // Fleet: &armdatabasefleetmanager.Fleet{ + // Properties: &armdatabasefleetmanager.FleetProperties{ + // Description: to.Ptr("Production fleet for high availability and scalability."), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "environment": to.Ptr("production"), + // "owner": to.Ptr("team-database"), + // }, + // Location: to.Ptr("East US"), + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-fleet-manager/providers/Microsoft.DatabaseFleetManager/fleet/production-fleet-01"), + // Name: to.Ptr("production-fleet-01"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("adminuser"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("adminuser"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-01-preview/Fleets_Delete_MaximumSet_Gen.json +func ExampleFleetsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetsClient().BeginDelete(ctx, "rg-database-fleet-manager", "production-fleet-01", 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: 2025-02-01-preview/Fleets_Get_MaximumSet_Gen.json +func ExampleFleetsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFleetsClient().Get(ctx, "rg-database-fleet-manager", "production-fleet-01", 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 = armdatabasefleetmanager.FleetsClientGetResponse{ + // Fleet: &armdatabasefleetmanager.Fleet{ + // Properties: &armdatabasefleetmanager.FleetProperties{ + // Description: to.Ptr("Production fleet for high availability and scalability."), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "environment": to.Ptr("production"), + // "owner": to.Ptr("team-database"), + // }, + // Location: to.Ptr("East US"), + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-fleet-manager/providers/Microsoft.DatabaseFleetManager/fleet/production-fleet-01"), + // Name: to.Ptr("production-fleet-01"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("adminuser"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("adminuser"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-01-preview/Fleets_List_MaximumSet_Gen.json +func ExampleFleetsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetsClient().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 = armdatabasefleetmanager.FleetsClientListResponse{ + // FleetListResult: armdatabasefleetmanager.FleetListResult{ + // Value: []*armdatabasefleetmanager.Fleet{ + // { + // Properties: &armdatabasefleetmanager.FleetProperties{ + // Description: to.Ptr("Fleet containing critical production databases."), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "environment": to.Ptr("production"), + // "owner": to.Ptr("team-database"), + // }, + // Location: to.Ptr("East US"), + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-fleet-manager/providers/Microsoft.DatabaseFleetManager/fleet/critical-production-fleet"), + // Name: to.Ptr("critical-production-fleet"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("adminuser"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("adminuser"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2025-02-01-preview/Fleets_ListByResourceGroup_MaximumSet_Gen.json +func ExampleFleetsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetsClient().NewListByResourceGroupPager("rg-database-fleet-manager", &FleetsClientListByResourceGroupOptions{ + Skip: to.Ptr[int64](6), + Top: to.Ptr[int64](30), + Skiptoken: to.Ptr("ovlavzakdncfvvbdhqkal")}) + 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 = armdatabasefleetmanager.FleetsClientListByResourceGroupResponse{ + // FleetListResult: armdatabasefleetmanager.FleetListResult{ + // Value: []*armdatabasefleetmanager.Fleet{ + // { + // Properties: &armdatabasefleetmanager.FleetProperties{ + // Description: to.Ptr("Production fleet for critical workloads."), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "environment": to.Ptr("production"), + // "owner": to.Ptr("team-database"), + // }, + // Location: to.Ptr("East US"), + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-fleet-manager/providers/Microsoft.DatabaseFleetManager/fleet/production-fleet-01"), + // Name: to.Ptr("production-fleet-01"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("adminuser"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("adminuser"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2025-02-01-preview/Fleets_Update_MaximumSet_Gen.json +func ExampleFleetsClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetsClient().BeginUpdate(ctx, "rg-database-fleet-manager", "critical-production-fleet", armdatabasefleetmanager.FleetUpdate{ + Properties: &armdatabasefleetmanager.FleetProperties{ + Description: to.Ptr("Fleet containing critical production databases and high availability configurations."), + }, + Tags: map[string]*string{ + "environment": to.Ptr("production"), + "owner": to.Ptr("team-database"), + }, + }, 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 = armdatabasefleetmanager.FleetsClientUpdateResponse{ + // Fleet: &armdatabasefleetmanager.Fleet{ + // Properties: &armdatabasefleetmanager.FleetProperties{ + // Description: to.Ptr("Fleet containing critical production databases and high availability configurations."), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "environment": to.Ptr("production"), + // "owner": to.Ptr("team-database"), + // }, + // Location: to.Ptr("East US"), + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-fleet-manager/providers/Microsoft.DatabaseFleetManager/fleet/critical-production-fleet"), + // Name: to.Ptr("critical-production-fleet"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("adminuser"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("adminuser"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetspaces_client.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetspaces_client.go new file mode 100644 index 000000000000..deac337442c9 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetspaces_client.go @@ -0,0 +1,602 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// FleetspacesClient contains the methods for the Fleetspaces group. +// Don't use this type directly, use NewFleetspacesClient() instead. +type FleetspacesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFleetspacesClient creates a new instance of FleetspacesClient 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 NewFleetspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FleetspacesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FleetspacesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a fleetspace resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - resource - The fleet object to create or update. +// - options - FleetspacesClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetspacesClient.BeginCreateOrUpdate +// method. +func (client *FleetspacesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, resource Fleetspace, options *FleetspacesClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetspacesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, fleetspaceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetspacesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetspacesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a fleetspace resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetspacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, resource Fleetspace, options *FleetspacesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetspacesClient.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, fleetName, fleetspaceName, 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 *FleetspacesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, resource Fleetspace, _ *FleetspacesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + 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", "2025-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 +} + +// BeginDelete - Deletes a fleetspace. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - options - FleetspacesClientBeginDeleteOptions contains the optional parameters for the FleetspacesClient.BeginDelete method. +func (client *FleetspacesClient) BeginDelete(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FleetspacesClientBeginDeleteOptions) (*runtime.Poller[FleetspacesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, fleetName, fleetspaceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetspacesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetspacesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a fleetspace. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetspacesClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FleetspacesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "FleetspacesClient.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, fleetName, fleetspaceName, 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 *FleetspacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, _ *FleetspacesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + 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", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets fleetspace resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - options - FleetspacesClientGetOptions contains the optional parameters for the FleetspacesClient.Get method. +func (client *FleetspacesClient) Get(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FleetspacesClientGetOptions) (FleetspacesClientGetResponse, error) { + var err error + const operationName = "FleetspacesClient.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, fleetName, fleetspaceName, options) + if err != nil { + return FleetspacesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FleetspacesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetspacesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FleetspacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, _ *FleetspacesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + 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", "2025-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 *FleetspacesClient) getHandleResponse(resp *http.Response) (FleetspacesClientGetResponse, error) { + result := FleetspacesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Fleetspace); err != nil { + return FleetspacesClientGetResponse{}, err + } + return result, nil +} + +// NewListByFleetPager - Lists fleetspaces in a fleet. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - options - FleetspacesClientListByFleetOptions contains the optional parameters for the FleetspacesClient.NewListByFleetPager +// method. +func (client *FleetspacesClient) NewListByFleetPager(resourceGroupName string, fleetName string, options *FleetspacesClientListByFleetOptions) *runtime.Pager[FleetspacesClientListByFleetResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetspacesClientListByFleetResponse]{ + More: func(page FleetspacesClientListByFleetResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetspacesClientListByFleetResponse) (FleetspacesClientListByFleetResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FleetspacesClient.NewListByFleetPager") + 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.listByFleetCreateRequest(ctx, resourceGroupName, fleetName, options) + }, nil) + if err != nil { + return FleetspacesClientListByFleetResponse{}, err + } + return client.listByFleetHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByFleetCreateRequest creates the ListByFleet request. +func (client *FleetspacesClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetspacesClientListByFleetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) + } + if options != nil && options.Skiptoken != nil { + reqQP.Set("$skiptoken", *options.Skiptoken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) + } + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByFleetHandleResponse handles the ListByFleet response. +func (client *FleetspacesClient) listByFleetHandleResponse(resp *http.Response) (FleetspacesClientListByFleetResponse, error) { + result := FleetspacesClientListByFleetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetspaceListResult); err != nil { + return FleetspacesClientListByFleetResponse{}, err + } + return result, nil +} + +// BeginRegisterServer - Migrates an existing logical server into fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - body - The details of the register server operation. +// - options - FleetspacesClientBeginRegisterServerOptions contains the optional parameters for the FleetspacesClient.BeginRegisterServer +// method. +func (client *FleetspacesClient) BeginRegisterServer(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, body RegisterServerProperties, options *FleetspacesClientBeginRegisterServerOptions) (*runtime.Poller[FleetspacesClientRegisterServerResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.registerServer(ctx, resourceGroupName, fleetName, fleetspaceName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetspacesClientRegisterServerResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetspacesClientRegisterServerResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RegisterServer - Migrates an existing logical server into fleet. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetspacesClient) registerServer(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, body RegisterServerProperties, options *FleetspacesClientBeginRegisterServerOptions) (*http.Response, error) { + var err error + const operationName = "FleetspacesClient.BeginRegisterServer" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.registerServerCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// registerServerCreateRequest creates the RegisterServer request. +func (client *FleetspacesClient) registerServerCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, body RegisterServerProperties, _ *FleetspacesClientBeginRegisterServerOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/registerServer" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + 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", "2025-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, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginUnregister - Unregisters all databases from a fleetspace +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - options - FleetspacesClientBeginUnregisterOptions contains the optional parameters for the FleetspacesClient.BeginUnregister +// method. +func (client *FleetspacesClient) BeginUnregister(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FleetspacesClientBeginUnregisterOptions) (*runtime.Poller[FleetspacesClientUnregisterResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.unregister(ctx, resourceGroupName, fleetName, fleetspaceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetspacesClientUnregisterResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetspacesClientUnregisterResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Unregister - Unregisters all databases from a fleetspace +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetspacesClient) unregister(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, options *FleetspacesClientBeginUnregisterOptions) (*http.Response, error) { + var err error + const operationName = "FleetspacesClient.BeginUnregister" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.unregisterCreateRequest(ctx, resourceGroupName, fleetName, fleetspaceName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// unregisterCreateRequest creates the Unregister request. +func (client *FleetspacesClient) unregisterCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, _ *FleetspacesClientBeginUnregisterOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}/unregister" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + 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", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Modifies a fleetspace resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - fleetspaceName - Name of the fleetspace. +// - properties - The resource properties to be updated. +// - options - FleetspacesClientBeginUpdateOptions contains the optional parameters for the FleetspacesClient.BeginUpdate method. +func (client *FleetspacesClient) BeginUpdate(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, properties Fleetspace, options *FleetspacesClientBeginUpdateOptions) (*runtime.Poller[FleetspacesClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, fleetName, fleetspaceName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetspacesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetspacesClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Modifies a fleetspace resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetspacesClient) update(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, properties Fleetspace, options *FleetspacesClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetspacesClient.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, fleetName, fleetspaceName, 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 *FleetspacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, fleetspaceName string, properties Fleetspace, _ *FleetspacesClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/fleetspaces/{fleetspaceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if fleetspaceName == "" { + return nil, errors.New("parameter fleetspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetspaceName}", url.PathEscape(fleetspaceName)) + 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", "2025-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 +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetspaces_client_example_test.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetspaces_client_example_test.go new file mode 100644 index 000000000000..6193cffa4759 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleetspaces_client_example_test.go @@ -0,0 +1,315 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager_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/databasefleetmanager/armdatabasefleetmanager" + "log" +) + +// Generated from example definition: 2025-02-01-preview/Fleetspaces_CreateOrUpdate_MaximumSet_Gen.json +func ExampleFleetspacesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetspacesClient().BeginCreateOrUpdate(ctx, "rgdatabasefleetmanager", "production-fleet", "primary-space", armdatabasefleetmanager.Fleetspace{ + Properties: &armdatabasefleetmanager.FleetspaceProperties{ + CapacityMax: to.Ptr[int32](150000), + MainPrincipal: &armdatabasefleetmanager.MainPrincipal{ + Login: to.Ptr("adminUser"), + ApplicationID: to.Ptr("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39"), + ObjectID: to.Ptr("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92"), + TenantID: to.Ptr("bde45d44-ec42-45b8-a5a2-c5b998c65ef6"), + PrincipalType: to.Ptr(armdatabasefleetmanager.PrincipalTypeApplication), + }, + }, + }, 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 = armdatabasefleetmanager.FleetspacesClientCreateOrUpdateResponse{ + // Fleetspace: &armdatabasefleetmanager.Fleetspace{ + // Properties: &armdatabasefleetmanager.FleetspaceProperties{ + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // CapacityMax: to.Ptr[int32](150000), + // MainPrincipal: &armdatabasefleetmanager.MainPrincipal{ + // Login: to.Ptr("adminUser"), + // ApplicationID: to.Ptr("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39"), + // ObjectID: to.Ptr("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92"), + // TenantID: to.Ptr("bde45d44-ec42-45b8-a5a2-c5b998c65ef6"), + // PrincipalType: to.Ptr(armdatabasefleetmanager.PrincipalTypeApplication), + // }, + // }, + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-operations/providers/Microsoft.DatabaseFleetManager/fleet/fleet-01/fleetspace/primary-space"), + // Name: to.Ptr("customer-db-prod"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/fleetspaces"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("adminUser"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("adminUser"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-01-preview/Fleetspaces_Delete_MaximumSet_Gen.json +func ExampleFleetspacesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetspacesClient().BeginDelete(ctx, "rgdatabasefleetmanager", "production-fleet", "primary-space", 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: 2025-02-01-preview/Fleetspaces_Get_MaximumSet_Gen.json +func ExampleFleetspacesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFleetspacesClient().Get(ctx, "rgdatabasefleetmanager", "production-fleet", "primary-space", 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 = armdatabasefleetmanager.FleetspacesClientGetResponse{ + // Fleetspace: &armdatabasefleetmanager.Fleetspace{ + // Properties: &armdatabasefleetmanager.FleetspaceProperties{ + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // CapacityMax: to.Ptr[int32](13), + // MainPrincipal: &armdatabasefleetmanager.MainPrincipal{ + // Login: to.Ptr("xijrmaod"), + // ApplicationID: to.Ptr("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39"), + // ObjectID: to.Ptr("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92"), + // TenantID: to.Ptr("bde45d44-ec42-45b8-a5a2-c5b998c65ef6"), + // PrincipalType: to.Ptr(armdatabasefleetmanager.PrincipalTypeApplication), + // }, + // }, + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-operations/providers/Microsoft.DatabaseFleetManager/fleet/fleet-01/fleetspace/primary-space"), + // Name: to.Ptr("customer-db-prod"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/fleetspaces"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("ckmcfjpuwvncpuluhk"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("o"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-01-preview/Fleetspaces_ListByFleet_MaximumSet_Gen.json +func ExampleFleetspacesClient_NewListByFleetPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetspacesClient().NewListByFleetPager("rg-database-fleet-manager", "production-fleet", &FleetspacesClientListByFleetOptions{ + Skip: to.Ptr[int64](27), + Top: to.Ptr[int64](7), + Skiptoken: to.Ptr("qaorjlbhvuntmn")}) + 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 = armdatabasefleetmanager.FleetspacesClientListByFleetResponse{ + // FleetspaceListResult: armdatabasefleetmanager.FleetspaceListResult{ + // Value: []*armdatabasefleetmanager.Fleetspace{ + // { + // Properties: &armdatabasefleetmanager.FleetspaceProperties{ + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // CapacityMax: to.Ptr[int32](1000), + // MainPrincipal: &armdatabasefleetmanager.MainPrincipal{ + // Login: to.Ptr("admin-prod"), + // ApplicationID: to.Ptr("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39"), + // ObjectID: to.Ptr("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92"), + // TenantID: to.Ptr("bde45d44-ec42-45b8-a5a2-c5b998c65ef6"), + // PrincipalType: to.Ptr(armdatabasefleetmanager.PrincipalTypeApplication), + // }, + // }, + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-operations/providers/Microsoft.DatabaseFleetManager/fleet/fleet-01/fleetspace/primary-space"), + // Name: to.Ptr("customer-db-prod"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/fleetspaces"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("john.doe@company.com"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("jane.smith@company.com"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2025-02-01-preview/Fleetspaces_RegisterServer_MaximumSet_Gen.json +func ExampleFleetspacesClient_BeginRegisterServer() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetspacesClient().BeginRegisterServer(ctx, "rg-database-fleet-manager", "production-fleet", "primary-space", armdatabasefleetmanager.RegisterServerProperties{ + TierName: to.Ptr("Standard"), + SourceSubscriptionID: to.Ptr("c76e2b32-46c7-4325-8f4f-476828a5b207"), + SourceResourceGroupName: to.Ptr("rg-source-database"), + SourceServerName: to.Ptr("source-db-server-prod"), + DestinationTierOverrides: []*armdatabasefleetmanager.DestinationTierOverride{ + { + ResourceType: to.Ptr(armdatabasefleetmanager.ResourceTypeDatabase), + TierName: to.Ptr("bronze"), + ResourceName: to.Ptr("source-db-prod"), + }, + }, + }, 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: 2025-02-01-preview/Fleetspaces_Unregister_MaximumSet_Gen.json +func ExampleFleetspacesClient_BeginUnregister() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetspacesClient().BeginUnregister(ctx, "rg-database-fleet-manager", "production-fleet", "primary-space", 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: 2025-02-01-preview/Fleetspaces_Update_MaximumSet_Gen.json +func ExampleFleetspacesClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetspacesClient().BeginUpdate(ctx, "rg-database-fleet-manager", "production-fleet", "primary-space", armdatabasefleetmanager.Fleetspace{ + Properties: &armdatabasefleetmanager.FleetspaceProperties{ + CapacityMax: to.Ptr[int32](150000), + MainPrincipal: &armdatabasefleetmanager.MainPrincipal{ + Login: to.Ptr("adminUser"), + ApplicationID: to.Ptr("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39"), + ObjectID: to.Ptr("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92"), + TenantID: to.Ptr("bde45d44-ec42-45b8-a5a2-c5b998c65ef6"), + PrincipalType: to.Ptr(armdatabasefleetmanager.PrincipalTypeApplication), + }, + }, + }, 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 = armdatabasefleetmanager.FleetspacesClientUpdateResponse{ + // Fleetspace: &armdatabasefleetmanager.Fleetspace{ + // Properties: &armdatabasefleetmanager.FleetspaceProperties{ + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // CapacityMax: to.Ptr[int32](150000), + // MainPrincipal: &armdatabasefleetmanager.MainPrincipal{ + // Login: to.Ptr("adminUser"), + // ApplicationID: to.Ptr("d2d8b19e-c4f7-4c62-8e8d-7f0f96d94e39"), + // ObjectID: to.Ptr("f8b7c2d3-b9c4-4f3b-85cd-3d56c6e49f92"), + // TenantID: to.Ptr("bde45d44-ec42-45b8-a5a2-c5b998c65ef6"), + // PrincipalType: to.Ptr(armdatabasefleetmanager.PrincipalTypeApplication), + // }, + // }, + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-operations/providers/Microsoft.DatabaseFleetManager/fleet/fleet-01/fleetspace/primary-space"), + // Name: to.Ptr("customer-db-prod"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/fleetspaces"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("adminUser"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("adminUser"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleettiers_client.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleettiers_client.go new file mode 100644 index 000000000000..14386cb5005a --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleettiers_client.go @@ -0,0 +1,504 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// FleetTiersClient contains the methods for the FleetTiers group. +// Don't use this type directly, use NewFleetTiersClient() instead. +type FleetTiersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFleetTiersClient creates a new instance of FleetTiersClient 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 NewFleetTiersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FleetTiersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FleetTiersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Creates or updates a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - tierName - Name of the tier. +// - resource - The tier object to create or update. +// - options - FleetTiersClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetTiersClient.BeginCreateOrUpdate +// method. +func (client *FleetTiersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, tierName string, resource FleetTier, options *FleetTiersClientBeginCreateOrUpdateOptions) (*runtime.Poller[FleetTiersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, fleetName, tierName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetTiersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetTiersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Creates or updates a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetTiersClient) createOrUpdate(ctx context.Context, resourceGroupName string, fleetName string, tierName string, resource FleetTier, options *FleetTiersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetTiersClient.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, fleetName, tierName, 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 *FleetTiersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, tierName string, resource FleetTier, _ *FleetTiersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if tierName == "" { + return nil, errors.New("parameter tierName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tierName}", url.PathEscape(tierName)) + 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", "2025-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 +} + +// BeginDelete - Deletes a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - tierName - Name of the tier. +// - options - FleetTiersClientBeginDeleteOptions contains the optional parameters for the FleetTiersClient.BeginDelete method. +func (client *FleetTiersClient) BeginDelete(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *FleetTiersClientBeginDeleteOptions) (*runtime.Poller[FleetTiersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, fleetName, tierName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetTiersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetTiersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetTiersClient) deleteOperation(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *FleetTiersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "FleetTiersClient.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, fleetName, tierName, 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 *FleetTiersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, tierName string, _ *FleetTiersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if tierName == "" { + return nil, errors.New("parameter tierName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tierName}", url.PathEscape(tierName)) + 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", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Disable - Disables a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - tierName - Name of the tier. +// - options - FleetTiersClientDisableOptions contains the optional parameters for the FleetTiersClient.Disable method. +func (client *FleetTiersClient) Disable(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *FleetTiersClientDisableOptions) (FleetTiersClientDisableResponse, error) { + var err error + const operationName = "FleetTiersClient.Disable" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.disableCreateRequest(ctx, resourceGroupName, fleetName, tierName, options) + if err != nil { + return FleetTiersClientDisableResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FleetTiersClientDisableResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetTiersClientDisableResponse{}, err + } + resp, err := client.disableHandleResponse(httpResp) + return resp, err +} + +// disableCreateRequest creates the Disable request. +func (client *FleetTiersClient) disableCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, tierName string, _ *FleetTiersClientDisableOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}/disable" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if tierName == "" { + return nil, errors.New("parameter tierName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tierName}", url.PathEscape(tierName)) + 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", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// disableHandleResponse handles the Disable response. +func (client *FleetTiersClient) disableHandleResponse(resp *http.Response) (FleetTiersClientDisableResponse, error) { + result := FleetTiersClientDisableResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetTier); err != nil { + return FleetTiersClientDisableResponse{}, err + } + return result, nil +} + +// Get - Gets a tier resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - tierName - Name of the tier. +// - options - FleetTiersClientGetOptions contains the optional parameters for the FleetTiersClient.Get method. +func (client *FleetTiersClient) Get(ctx context.Context, resourceGroupName string, fleetName string, tierName string, options *FleetTiersClientGetOptions) (FleetTiersClientGetResponse, error) { + var err error + const operationName = "FleetTiersClient.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, fleetName, tierName, options) + if err != nil { + return FleetTiersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FleetTiersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FleetTiersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FleetTiersClient) getCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, tierName string, _ *FleetTiersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if tierName == "" { + return nil, errors.New("parameter tierName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tierName}", url.PathEscape(tierName)) + 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", "2025-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 *FleetTiersClient) getHandleResponse(resp *http.Response) (FleetTiersClientGetResponse, error) { + result := FleetTiersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetTier); err != nil { + return FleetTiersClientGetResponse{}, err + } + return result, nil +} + +// NewListByFleetPager - List tiers in a fleet. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - options - FleetTiersClientListByFleetOptions contains the optional parameters for the FleetTiersClient.NewListByFleetPager +// method. +func (client *FleetTiersClient) NewListByFleetPager(resourceGroupName string, fleetName string, options *FleetTiersClientListByFleetOptions) *runtime.Pager[FleetTiersClientListByFleetResponse] { + return runtime.NewPager(runtime.PagingHandler[FleetTiersClientListByFleetResponse]{ + More: func(page FleetTiersClientListByFleetResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FleetTiersClientListByFleetResponse) (FleetTiersClientListByFleetResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FleetTiersClient.NewListByFleetPager") + 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.listByFleetCreateRequest(ctx, resourceGroupName, fleetName, options) + }, nil) + if err != nil { + return FleetTiersClientListByFleetResponse{}, err + } + return client.listByFleetHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByFleetCreateRequest creates the ListByFleet request. +func (client *FleetTiersClient) listByFleetCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, options *FleetTiersClientListByFleetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(*options.Skip, 10)) + } + if options != nil && options.Skiptoken != nil { + reqQP.Set("$skiptoken", *options.Skiptoken) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(*options.Top, 10)) + } + reqQP.Set("api-version", "2025-02-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByFleetHandleResponse handles the ListByFleet response. +func (client *FleetTiersClient) listByFleetHandleResponse(resp *http.Response) (FleetTiersClientListByFleetResponse, error) { + result := FleetTiersClientListByFleetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FleetTierListResult); err != nil { + return FleetTiersClientListByFleetResponse{}, err + } + return result, nil +} + +// BeginUpdate - Updates a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - fleetName - Name of the database fleet. +// - tierName - Name of the tier. +// - properties - The resource properties to be updated. +// - options - FleetTiersClientBeginUpdateOptions contains the optional parameters for the FleetTiersClient.BeginUpdate method. +func (client *FleetTiersClient) BeginUpdate(ctx context.Context, resourceGroupName string, fleetName string, tierName string, properties FleetTier, options *FleetTiersClientBeginUpdateOptions) (*runtime.Poller[FleetTiersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, fleetName, tierName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FleetTiersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FleetTiersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Updates a tier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-02-01-preview +func (client *FleetTiersClient) update(ctx context.Context, resourceGroupName string, fleetName string, tierName string, properties FleetTier, options *FleetTiersClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "FleetTiersClient.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, fleetName, tierName, 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 *FleetTiersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fleetName string, tierName string, properties FleetTier, _ *FleetTiersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseFleetManager/fleets/{fleetName}/tiers/{tierName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if fleetName == "" { + return nil, errors.New("parameter fleetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{fleetName}", url.PathEscape(fleetName)) + if tierName == "" { + return nil, errors.New("parameter tierName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{tierName}", url.PathEscape(tierName)) + 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", "2025-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 +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleettiers_client_example_test.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleettiers_client_example_test.go new file mode 100644 index 000000000000..ec17931946dc --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/fleettiers_client_example_test.go @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager_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/databasefleetmanager/armdatabasefleetmanager" + "log" +) + +// Generated from example definition: 2025-02-01-preview/FleetTiers_CreateOrUpdate_MaximumSet_Gen.json +func ExampleFleetTiersClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetTiersClient().BeginCreateOrUpdate(ctx, "rg-database-fleet-manager", "critical-production-fleet", "general-purpose-tier", armdatabasefleetmanager.FleetTier{ + Properties: &armdatabasefleetmanager.FleetTierProperties{ + Serverless: to.Ptr(false), + Pooled: to.Ptr(true), + ServiceTier: to.Ptr("GeneralPurpose"), + Family: to.Ptr("Gen5"), + Capacity: to.Ptr[int32](4), + PoolNumOfDatabasesMax: to.Ptr[int32](10), + HighAvailabilityReplicaCount: to.Ptr[int32](5), + ZoneRedundancy: to.Ptr(armdatabasefleetmanager.ZoneRedundancyDisabled), + DatabaseCapacityMin: to.Ptr[float64](0), + DatabaseCapacityMax: to.Ptr[float64](4), + DatabaseSizeGbMax: to.Ptr[int32](50), + }, + }, 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 = armdatabasefleetmanager.FleetTiersClientCreateOrUpdateResponse{ + // FleetTier: &armdatabasefleetmanager.FleetTier{ + // Properties: &armdatabasefleetmanager.FleetTierProperties{ + // Disabled: to.Ptr(false), + // Serverless: to.Ptr(false), + // Pooled: to.Ptr(true), + // ServiceTier: to.Ptr("GeneralPurpose"), + // Family: to.Ptr("Gen5"), + // Capacity: to.Ptr[int32](4), + // PoolNumOfDatabasesMax: to.Ptr[int32](10), + // HighAvailabilityReplicaCount: to.Ptr[int32](5), + // ZoneRedundancy: to.Ptr(armdatabasefleetmanager.ZoneRedundancyDisabled), + // DatabaseCapacityMin: to.Ptr[float64](0), + // DatabaseCapacityMax: to.Ptr[float64](4), + // DatabaseSizeGbMax: to.Ptr[int32](50), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-fleet-manager/providers/Microsoft.DatabaseFleetManager/fleets/critical-production-fleet/tiers/general-purpose-tier"), + // Name: to.Ptr("general-purpose-tier"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/tiers"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("adminuser"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("adminuser"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-01-preview/FleetTiers_Delete_MaximumSet_Gen.json +func ExampleFleetTiersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetTiersClient().BeginDelete(ctx, "rg-database-fleet-manager", "critical-production-fleet", "general-purpose-tier", 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: 2025-02-01-preview/FleetTiers_Disable_MaximumSet_Gen.json +func ExampleFleetTiersClient_Disable() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFleetTiersClient().Disable(ctx, "rg-database-fleet-manager", "critical-production-fleet", "general-purpose-tier", 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 = armdatabasefleetmanager.FleetTiersClientDisableResponse{ + // FleetTier: &armdatabasefleetmanager.FleetTier{ + // Properties: &armdatabasefleetmanager.FleetTierProperties{ + // Disabled: to.Ptr(false), + // Serverless: to.Ptr(false), + // Pooled: to.Ptr(true), + // ServiceTier: to.Ptr("GeneralPurpose"), + // Family: to.Ptr("Gen5"), + // Capacity: to.Ptr[int32](4), + // PoolNumOfDatabasesMax: to.Ptr[int32](10), + // HighAvailabilityReplicaCount: to.Ptr[int32](5), + // ZoneRedundancy: to.Ptr(armdatabasefleetmanager.ZoneRedundancyDisabled), + // DatabaseCapacityMin: to.Ptr[float64](0), + // DatabaseCapacityMax: to.Ptr[float64](4), + // DatabaseSizeGbMax: to.Ptr[int32](50), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-fleet-manager/providers/Microsoft.DatabaseFleetManager/fleets/critical-production-fleet/tiers/general-purpose-tier"), + // Name: to.Ptr("general-purpose-tier"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/tiers"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("adminuser"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("adminuser"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-01-preview/FleetTiers_Get_MaximumSet_Gen.json +func ExampleFleetTiersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFleetTiersClient().Get(ctx, "rg-database-fleet-manager", "critical-production-fleet", "general-purpose-tier", 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 = armdatabasefleetmanager.FleetTiersClientGetResponse{ + // FleetTier: &armdatabasefleetmanager.FleetTier{ + // Properties: &armdatabasefleetmanager.FleetTierProperties{ + // Disabled: to.Ptr(false), + // Serverless: to.Ptr(false), + // Pooled: to.Ptr(true), + // ServiceTier: to.Ptr("GeneralPurpose"), + // Family: to.Ptr("Gen5"), + // Capacity: to.Ptr[int32](4), + // PoolNumOfDatabasesMax: to.Ptr[int32](10), + // HighAvailabilityReplicaCount: to.Ptr[int32](5), + // ZoneRedundancy: to.Ptr(armdatabasefleetmanager.ZoneRedundancyDisabled), + // DatabaseCapacityMin: to.Ptr[float64](0), + // DatabaseCapacityMax: to.Ptr[float64](4), + // DatabaseSizeGbMax: to.Ptr[int32](50), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-fleet-manager/providers/Microsoft.DatabaseFleetManager/fleets/critical-production-fleet/tiers/general-purpose-tier"), + // Name: to.Ptr("general-purpose-tier"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/tiers"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("ckmcfjpuwvncpuluhk"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("o"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-02-01-preview/FleetTiers_ListByFleet_MaximumSet_Gen.json +func ExampleFleetTiersClient_NewListByFleetPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFleetTiersClient().NewListByFleetPager("rg-database-fleet-manager", "critical-production-fleet", &FleetTiersClientListByFleetOptions{ + Skip: to.Ptr[int64](10), + Top: to.Ptr[int64](1), + Skiptoken: to.Ptr("hfrg")}) + 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 = armdatabasefleetmanager.FleetTiersClientListByFleetResponse{ + // FleetTierListResult: armdatabasefleetmanager.FleetTierListResult{ + // Value: []*armdatabasefleetmanager.FleetTier{ + // { + // Properties: &armdatabasefleetmanager.FleetTierProperties{ + // Disabled: to.Ptr(false), + // Serverless: to.Ptr(false), + // Pooled: to.Ptr(true), + // ServiceTier: to.Ptr("GeneralPurpose"), + // Family: to.Ptr("Gen5"), + // Capacity: to.Ptr[int32](4), + // PoolNumOfDatabasesMax: to.Ptr[int32](10), + // HighAvailabilityReplicaCount: to.Ptr[int32](5), + // ZoneRedundancy: to.Ptr(armdatabasefleetmanager.ZoneRedundancyDisabled), + // DatabaseCapacityMin: to.Ptr[float64](0), + // DatabaseCapacityMax: to.Ptr[float64](4), + // DatabaseSizeGbMax: to.Ptr[int32](50), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-fleet-manager/providers/Microsoft.DatabaseFleetManager/fleets/critical-production-fleet/tiers/general-purpose-tier"), + // Name: to.Ptr("general-purpose-tier"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/tiers"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("ckmcfjpuwvncpuluhk"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("o"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/afucor"), + // }, + // } + } +} + +// Generated from example definition: 2025-02-01-preview/FleetTiers_Update_MaximumSet_Gen.json +func ExampleFleetTiersClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.NewClientFactory("C3897315-3847-4D8A-B2FC-7307B066AD63", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFleetTiersClient().BeginUpdate(ctx, "rg-database-fleet-manager", "critical-production-fleet", "general-purpose-tier", armdatabasefleetmanager.FleetTier{ + Properties: &armdatabasefleetmanager.FleetTierProperties{ + Serverless: to.Ptr(false), + Pooled: to.Ptr(true), + ServiceTier: to.Ptr("GeneralPurpose"), + Family: to.Ptr("Gen5"), + Capacity: to.Ptr[int32](4), + PoolNumOfDatabasesMax: to.Ptr[int32](10), + HighAvailabilityReplicaCount: to.Ptr[int32](5), + ZoneRedundancy: to.Ptr(armdatabasefleetmanager.ZoneRedundancyDisabled), + DatabaseCapacityMin: to.Ptr[float64](0), + DatabaseCapacityMax: to.Ptr[float64](4), + DatabaseSizeGbMax: to.Ptr[int32](50), + }, + }, 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 = armdatabasefleetmanager.FleetTiersClientUpdateResponse{ + // FleetTier: &armdatabasefleetmanager.FleetTier{ + // Properties: &armdatabasefleetmanager.FleetTierProperties{ + // Disabled: to.Ptr(false), + // Serverless: to.Ptr(false), + // Pooled: to.Ptr(true), + // ServiceTier: to.Ptr("GeneralPurpose"), + // Family: to.Ptr("Gen5"), + // Capacity: to.Ptr[int32](4), + // PoolNumOfDatabasesMax: to.Ptr[int32](10), + // HighAvailabilityReplicaCount: to.Ptr[int32](5), + // ZoneRedundancy: to.Ptr(armdatabasefleetmanager.ZoneRedundancyDisabled), + // DatabaseCapacityMin: to.Ptr[float64](0), + // DatabaseCapacityMax: to.Ptr[float64](4), + // DatabaseSizeGbMax: to.Ptr[int32](50), + // ProvisioningState: to.Ptr(armdatabasefleetmanager.AzureProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/C3897315-3847-4D8A-B2FC-7307B066AD63/resourceGroups/rg-database-fleet-manager/providers/Microsoft.DatabaseFleetManager/fleets/critical-production-fleet/tiers/general-purpose-tier"), + // Name: to.Ptr("general-purpose-tier"), + // Type: to.Ptr("Microsoft.DatabaseFleetManager/fleets/tiers"), + // SystemData: &armdatabasefleetmanager.SystemData{ + // CreatedBy: to.Ptr("ckmcfjpuwvncpuluhk"), + // CreatedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.802Z"); return t}()), + // LastModifiedBy: to.Ptr("o"), + // LastModifiedByType: to.Ptr(armdatabasefleetmanager.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-06T09:16:01.803Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.mod b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.mod new file mode 100644 index 000000000000..ad3156dc1f20 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.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.32.0 // indirect + golang.org/x/net v0.34.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/text v0.21.0 // indirect +) diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.sum b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.sum new file mode 100644 index 000000000000..065ccc364f39 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0 h1:g0EZJwz7xkXQiZAI5xi9f3WWFYBlX1CPTrR+NDToRkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0/go.mod h1:XCW7KnZet0Opnr7HccfUw1PLc4CjHqpcaxW8DHklNkQ= +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.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models.go new file mode 100644 index 000000000000..acd63345999c --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models.go @@ -0,0 +1,451 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager + +import "time" + +// DatabaseChangeTierProperties - A database change tier definition. +type DatabaseChangeTierProperties struct { + // A target tier name. + TargetTierName *string +} + +// DatabaseIdentity - Database Identity properties. +type DatabaseIdentity struct { + // Client Id of the database identity. + ClientID *string + + // Principal Id of the database identity. + PrincipalID *string + + // Resource Id of the database identity. + ResourceID *string +} + +// DatabaseRenameProperties - A database rename definition. +type DatabaseRenameProperties struct { + // New database name. + NewName *string +} + +// DestinationTierOverride - A destination tier override. +type DestinationTierOverride struct { + // REQUIRED; Resource name. + ResourceName *string + + // REQUIRED; Resource type. + ResourceType *ResourceType + + // REQUIRED; Destination tier name. + TierName *string +} + +// FirewallRule - A firewall rule. +type FirewallRule struct { + // A Firewall rule properties. + Properties *FirewallRuleProperties + + // READ-ONLY; Name of the firewall rule. + 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 +} + +// FirewallRuleListResult - The response of a FirewallRule list operation. +type FirewallRuleListResult struct { + // REQUIRED; The FirewallRule items on this page + Value []*FirewallRule + + // The link to the next page of items + NextLink *string +} + +// FirewallRuleProperties - A Firewall rule properties. +type FirewallRuleProperties struct { + // End IP address. + EndIPAddress *string + + // Start IP address. + StartIPAddress *string + + // READ-ONLY; Provisioning state. + ProvisioningState *AzureProvisioningState +} + +// Fleet - A Database Fleet. +type Fleet struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The fleet properties. + Properties *FleetProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Name of the database fleet. + 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 +} + +// FleetDatabase - A fleet database. +type FleetDatabase struct { + // Fleet database properties. + Properties *FleetDatabaseProperties + + // READ-ONLY; Name of the database. + 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 +} + +// FleetDatabaseListResult - The response of a FleetDatabase list operation. +type FleetDatabaseListResult struct { + // REQUIRED; The FleetDatabase items on this page + Value []*FleetDatabase + + // The link to the next page of items + NextLink *string +} + +// FleetDatabaseProperties - Fleet database properties. +type FleetDatabaseProperties struct { + // Database collation. + Collation *string + + // Create mode. Available options: Default - Create a database. Copy - Copy the source database (source database name must + // be specified) PointInTimeRestore - Create a database by restoring source database from a point in time (source database + // name and restore from time must be specified) + CreateMode *DatabaseCreateMode + + // Identity property. + Identity *Identity + + // Additional database properties to be applied as the underlying database resource tags. + ResourceTags map[string]*string + + // Restore from time when CreateMode is PointInTimeRestore. + RestoreFromTime *time.Time + + // Source database name used when CreateMode is Copy or PointInTimeRestore. + SourceDatabaseName *string + + // Name of the tier this database belongs to. + TierName *string + + // Transparent Data Encryption properties + TransparentDataEncryption *TransparentDataEncryption + + // READ-ONLY; Backup retention in days. + BackupRetentionDays *int32 + + // READ-ONLY; Connection string to connect to the database with. + ConnectionString *string + + // READ-ONLY; Maximum database size in Gb. + DatabaseSizeGbMax *int32 + + // READ-ONLY; Earliest restore time. + EarliestRestoreTime *time.Time + + // READ-ONLY; Latest restore time. + LatestRestoreTime *time.Time + + // READ-ONLY; Resource identifier for the underlying database resource. + OriginalDatabaseID *string + + // READ-ONLY; Database state. + ProvisioningState *AzureProvisioningState + + // READ-ONLY; If true, database is recoverable. + Recoverable *bool +} + +// FleetListResult - The response of a Fleet list operation. +type FleetListResult struct { + // REQUIRED; The Fleet items on this page + Value []*Fleet + + // The link to the next page of items + NextLink *string +} + +// FleetProperties - The Database Fleet properties. +type FleetProperties struct { + // Fleet description. + Description *string + + // READ-ONLY; Provisioning state. + ProvisioningState *AzureProvisioningState +} + +// FleetTier - A SQL Database Fleet tier. +type FleetTier struct { + // A Fleet tier properties. + Properties *FleetTierProperties + + // READ-ONLY; Name of the tier. + 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 +} + +// FleetTierListResult - The response of a FleetTier list operation. +type FleetTierListResult struct { + // REQUIRED; The FleetTier items on this page + Value []*FleetTier + + // The link to the next page of items + NextLink *string +} + +// FleetTierProperties - A Fleet tier properties. +type FleetTierProperties struct { + // Capacity of provisioned resources in the tier, in units matching the specified service tier, for example vCore for GeneralPurpose. + Capacity *int32 + + // Maximum allocated capacity per database, in units matching the specified service tier. + DatabaseCapacityMax *float64 + + // Minimum allocated capacity per database, in units matching the specified service tier. + DatabaseCapacityMin *float64 + + // Maximum database size in Gb. + DatabaseSizeGbMax *int32 + + // Family of provisioned resources, for example Gen5. + Family *string + + // Number of high availability replicas for databases in this tier. + HighAvailabilityReplicaCount *int32 + + // Maximum number of databases per pool. + PoolNumOfDatabasesMax *int32 + + // If true, databases are pooled. + Pooled *bool + + // If true, serverless resources are provisioned in the tier. + Serverless *bool + + // Service tier of provisioned resources. Supported values: GeneralPurpose, Hyperscale. + ServiceTier *string + + // Enable zone redundancy for all databases in this tier. + ZoneRedundancy *ZoneRedundancy + + // READ-ONLY; If true, tier is disabled. + Disabled *bool + + // READ-ONLY; Provisioning state. + ProvisioningState *AzureProvisioningState +} + +// FleetUpdate - An update to a Database Fleet. +type FleetUpdate struct { + // The Database Fleet properties. + Properties *FleetProperties + + // Resource tags. + Tags map[string]*string +} + +// Fleetspace - A fleetspace. +type Fleetspace struct { + // A Fleetspace properties. + Properties *FleetspaceProperties + + // READ-ONLY; Name of the fleetspace. + 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 +} + +// FleetspaceListResult - The response of a Fleetspace list operation. +type FleetspaceListResult struct { + // REQUIRED; The Fleetspace items on this page + Value []*Fleetspace + + // The link to the next page of items + NextLink *string +} + +// FleetspaceProperties - A Fleetspace properties. +type FleetspaceProperties struct { + // Maximum number of vCores database fleet manager is allowed to provision in the fleetspace. + CapacityMax *int32 + + // Main Microsoft Entra ID principal that has admin access to all databases in the fleetspace. + MainPrincipal *MainPrincipal + + // READ-ONLY; Fleetspace state. + ProvisioningState *AzureProvisioningState +} + +// Identity - Database Identity. +type Identity struct { + // The federated client id for the SQL Database. It is used for cross tenant CMK scenario. + FederatedClientID *string + + // Identity type of the main principal. + IdentityType *IdentityType + + // User identity ids + UserAssignedIdentities []*DatabaseIdentity +} + +// MainPrincipal - A main principal. +type MainPrincipal struct { + // Application Id of the main principal. + ApplicationID *string + + // Login name of the main principal. + Login *string + + // Object Id of the main principal. + ObjectID *string + + // Principal type of the main principal. + PrincipalType *PrincipalType + + // Tenant Id of the main principal. + TenantID *string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Extensible 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 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 +} + +// RegisterServerProperties - Server registration definition. +type RegisterServerProperties struct { + // Destination tier overrides. + DestinationTierOverrides []*DestinationTierOverride + + // Source resource group name. + SourceResourceGroupName *string + + // Source SQL Server name. + SourceServerName *string + + // Source subscription id. + SourceSubscriptionID *string + + // Destination tier name. + TierName *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 +} + +// TransparentDataEncryption - Transparent Data Encryption properties. +type TransparentDataEncryption struct { + // Enable key auto rotation + EnableAutoRotation *bool + + // Customer Managed Key (CMK) Uri. + KeyURI *string + + // Additional Keys + Keys []*string +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models_serde.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models_serde.go new file mode 100644 index 000000000000..e2e93feb5a2b --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models_serde.go @@ -0,0 +1,1144 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type DatabaseChangeTierProperties. +func (d DatabaseChangeTierProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "targetTierName", d.TargetTierName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseChangeTierProperties. +func (d *DatabaseChangeTierProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "targetTierName": + err = unpopulate(val, "TargetTierName", &d.TargetTierName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseIdentity. +func (d DatabaseIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", d.ClientID) + populate(objectMap, "principalId", d.PrincipalID) + populate(objectMap, "resourceId", d.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseIdentity. +func (d *DatabaseIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &d.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &d.PrincipalID) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &d.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DatabaseRenameProperties. +func (d DatabaseRenameProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "newName", d.NewName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DatabaseRenameProperties. +func (d *DatabaseRenameProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "newName": + err = unpopulate(val, "NewName", &d.NewName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DestinationTierOverride. +func (d DestinationTierOverride) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceName", d.ResourceName) + populate(objectMap, "resourceType", d.ResourceType) + populate(objectMap, "tierName", d.TierName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DestinationTierOverride. +func (d *DestinationTierOverride) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resourceName": + err = unpopulate(val, "ResourceName", &d.ResourceName) + delete(rawMsg, key) + case "resourceType": + err = unpopulate(val, "ResourceType", &d.ResourceType) + delete(rawMsg, key) + case "tierName": + err = unpopulate(val, "TierName", &d.TierName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallRule. +func (f FirewallRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRule. +func (f *FirewallRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallRuleListResult. +func (f FirewallRuleListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRuleListResult. +func (f *FirewallRuleListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FirewallRuleProperties. +func (f FirewallRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endIpAddress", f.EndIPAddress) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "startIpAddress", f.StartIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FirewallRuleProperties. +func (f *FirewallRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endIpAddress": + err = unpopulate(val, "EndIPAddress", &f.EndIPAddress) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "startIpAddress": + err = unpopulate(val, "StartIPAddress", &f.StartIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Fleet. +func (f Fleet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "location", f.Location) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "tags", f.Tags) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Fleet. +func (f *Fleet) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &f.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetDatabase. +func (f FleetDatabase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetDatabase. +func (f *FleetDatabase) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetDatabaseListResult. +func (f FleetDatabaseListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetDatabaseListResult. +func (f *FleetDatabaseListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetDatabaseProperties. +func (f FleetDatabaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupRetentionDays", f.BackupRetentionDays) + populate(objectMap, "collation", f.Collation) + populate(objectMap, "connectionString", f.ConnectionString) + populate(objectMap, "createMode", f.CreateMode) + populate(objectMap, "databaseSizeGbMax", f.DatabaseSizeGbMax) + populateDateTimeRFC3339(objectMap, "earliestRestoreTime", f.EarliestRestoreTime) + populate(objectMap, "identity", f.Identity) + populateDateTimeRFC3339(objectMap, "latestRestoreTime", f.LatestRestoreTime) + populate(objectMap, "originalDatabaseId", f.OriginalDatabaseID) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "recoverable", f.Recoverable) + populate(objectMap, "resourceTags", f.ResourceTags) + populateDateTimeRFC3339(objectMap, "restoreFromTime", f.RestoreFromTime) + populate(objectMap, "sourceDatabaseName", f.SourceDatabaseName) + populate(objectMap, "tierName", f.TierName) + populate(objectMap, "transparentDataEncryption", f.TransparentDataEncryption) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetDatabaseProperties. +func (f *FleetDatabaseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backupRetentionDays": + err = unpopulate(val, "BackupRetentionDays", &f.BackupRetentionDays) + delete(rawMsg, key) + case "collation": + err = unpopulate(val, "Collation", &f.Collation) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &f.ConnectionString) + delete(rawMsg, key) + case "createMode": + err = unpopulate(val, "CreateMode", &f.CreateMode) + delete(rawMsg, key) + case "databaseSizeGbMax": + err = unpopulate(val, "DatabaseSizeGbMax", &f.DatabaseSizeGbMax) + delete(rawMsg, key) + case "earliestRestoreTime": + err = unpopulateDateTimeRFC3339(val, "EarliestRestoreTime", &f.EarliestRestoreTime) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &f.Identity) + delete(rawMsg, key) + case "latestRestoreTime": + err = unpopulateDateTimeRFC3339(val, "LatestRestoreTime", &f.LatestRestoreTime) + delete(rawMsg, key) + case "originalDatabaseId": + err = unpopulate(val, "OriginalDatabaseID", &f.OriginalDatabaseID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "recoverable": + err = unpopulate(val, "Recoverable", &f.Recoverable) + delete(rawMsg, key) + case "resourceTags": + err = unpopulate(val, "ResourceTags", &f.ResourceTags) + delete(rawMsg, key) + case "restoreFromTime": + err = unpopulateDateTimeRFC3339(val, "RestoreFromTime", &f.RestoreFromTime) + delete(rawMsg, key) + case "sourceDatabaseName": + err = unpopulate(val, "SourceDatabaseName", &f.SourceDatabaseName) + delete(rawMsg, key) + case "tierName": + err = unpopulate(val, "TierName", &f.TierName) + delete(rawMsg, key) + case "transparentDataEncryption": + err = unpopulate(val, "TransparentDataEncryption", &f.TransparentDataEncryption) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetListResult. +func (f FleetListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetListResult. +func (f *FleetListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetProperties. +func (f FleetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", f.Description) + populate(objectMap, "provisioningState", f.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetProperties. +func (f *FleetProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &f.Description) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetTier. +func (f FleetTier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetTier. +func (f *FleetTier) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetTierListResult. +func (f FleetTierListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetTierListResult. +func (f *FleetTierListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetTierProperties. +func (f FleetTierProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", f.Capacity) + populate(objectMap, "databaseCapacityMax", f.DatabaseCapacityMax) + populate(objectMap, "databaseCapacityMin", f.DatabaseCapacityMin) + populate(objectMap, "databaseSizeGbMax", f.DatabaseSizeGbMax) + populate(objectMap, "disabled", f.Disabled) + populate(objectMap, "family", f.Family) + populate(objectMap, "highAvailabilityReplicaCount", f.HighAvailabilityReplicaCount) + populate(objectMap, "poolNumOfDatabasesMax", f.PoolNumOfDatabasesMax) + populate(objectMap, "pooled", f.Pooled) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "serverless", f.Serverless) + populate(objectMap, "serviceTier", f.ServiceTier) + populate(objectMap, "zoneRedundancy", f.ZoneRedundancy) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetTierProperties. +func (f *FleetTierProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &f.Capacity) + delete(rawMsg, key) + case "databaseCapacityMax": + err = unpopulate(val, "DatabaseCapacityMax", &f.DatabaseCapacityMax) + delete(rawMsg, key) + case "databaseCapacityMin": + err = unpopulate(val, "DatabaseCapacityMin", &f.DatabaseCapacityMin) + delete(rawMsg, key) + case "databaseSizeGbMax": + err = unpopulate(val, "DatabaseSizeGbMax", &f.DatabaseSizeGbMax) + delete(rawMsg, key) + case "disabled": + err = unpopulate(val, "Disabled", &f.Disabled) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &f.Family) + delete(rawMsg, key) + case "highAvailabilityReplicaCount": + err = unpopulate(val, "HighAvailabilityReplicaCount", &f.HighAvailabilityReplicaCount) + delete(rawMsg, key) + case "poolNumOfDatabasesMax": + err = unpopulate(val, "PoolNumOfDatabasesMax", &f.PoolNumOfDatabasesMax) + delete(rawMsg, key) + case "pooled": + err = unpopulate(val, "Pooled", &f.Pooled) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "serverless": + err = unpopulate(val, "Serverless", &f.Serverless) + delete(rawMsg, key) + case "serviceTier": + err = unpopulate(val, "ServiceTier", &f.ServiceTier) + delete(rawMsg, key) + case "zoneRedundancy": + err = unpopulate(val, "ZoneRedundancy", &f.ZoneRedundancy) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetUpdate. +func (f FleetUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "tags", f.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetUpdate. +func (f *FleetUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Fleetspace. +func (f Fleetspace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Fleetspace. +func (f *Fleetspace) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetspaceListResult. +func (f FleetspaceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetspaceListResult. +func (f *FleetspaceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FleetspaceProperties. +func (f FleetspaceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacityMax", f.CapacityMax) + populate(objectMap, "mainPrincipal", f.MainPrincipal) + populate(objectMap, "provisioningState", f.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FleetspaceProperties. +func (f *FleetspaceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacityMax": + err = unpopulate(val, "CapacityMax", &f.CapacityMax) + delete(rawMsg, key) + case "mainPrincipal": + err = unpopulate(val, "MainPrincipal", &f.MainPrincipal) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Identity. +func (i Identity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "federatedClientId", i.FederatedClientID) + populate(objectMap, "identityType", i.IdentityType) + populate(objectMap, "userAssignedIdentities", i.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Identity. +func (i *Identity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "federatedClientId": + err = unpopulate(val, "FederatedClientID", &i.FederatedClientID) + delete(rawMsg, key) + case "identityType": + err = unpopulate(val, "IdentityType", &i.IdentityType) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &i.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MainPrincipal. +func (m MainPrincipal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicationId", m.ApplicationID) + populate(objectMap, "login", m.Login) + populate(objectMap, "objectId", m.ObjectID) + populate(objectMap, "principalType", m.PrincipalType) + populate(objectMap, "tenantId", m.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MainPrincipal. +func (m *MainPrincipal) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "applicationId": + err = unpopulate(val, "ApplicationID", &m.ApplicationID) + delete(rawMsg, key) + case "login": + err = unpopulate(val, "Login", &m.Login) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &m.ObjectID) + delete(rawMsg, key) + case "principalType": + err = unpopulate(val, "PrincipalType", &m.PrincipalType) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RegisterServerProperties. +func (r RegisterServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "destinationTierOverrides", r.DestinationTierOverrides) + populate(objectMap, "sourceResourceGroupName", r.SourceResourceGroupName) + populate(objectMap, "sourceServerName", r.SourceServerName) + populate(objectMap, "sourceSubscriptionId", r.SourceSubscriptionID) + populate(objectMap, "tierName", r.TierName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegisterServerProperties. +func (r *RegisterServerProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "destinationTierOverrides": + err = unpopulate(val, "DestinationTierOverrides", &r.DestinationTierOverrides) + delete(rawMsg, key) + case "sourceResourceGroupName": + err = unpopulate(val, "SourceResourceGroupName", &r.SourceResourceGroupName) + delete(rawMsg, key) + case "sourceServerName": + err = unpopulate(val, "SourceServerName", &r.SourceServerName) + delete(rawMsg, key) + case "sourceSubscriptionId": + err = unpopulate(val, "SourceSubscriptionID", &r.SourceSubscriptionID) + delete(rawMsg, key) + case "tierName": + err = unpopulate(val, "TierName", &r.TierName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type 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 TransparentDataEncryption. +func (t TransparentDataEncryption) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "enableAutoRotation", t.EnableAutoRotation) + populate(objectMap, "keyUri", t.KeyURI) + populate(objectMap, "keys", t.Keys) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TransparentDataEncryption. +func (t *TransparentDataEncryption) UnmarshalJSON(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 "enableAutoRotation": + err = unpopulate(val, "EnableAutoRotation", &t.EnableAutoRotation) + delete(rawMsg, key) + case "keyUri": + err = unpopulate(val, "KeyURI", &t.KeyURI) + delete(rawMsg, key) + case "keys": + err = unpopulate(val, "Keys", &t.Keys) + 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/databasefleetmanager/armdatabasefleetmanager/operations_client.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/operations_client.go new file mode 100644 index 000000000000..3b90e40923ab --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/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 armdatabasefleetmanager + +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 2025-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]{ + 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.DatabaseFleetManager/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", "2025-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 *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/databasefleetmanager/armdatabasefleetmanager/operations_client_example_test.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/operations_client_example_test.go new file mode 100644 index 000000000000..7d2991907687 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/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 armdatabasefleetmanager_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager" + "log" +) + +// Generated from example definition: 2025-02-01-preview/Operations_List_MaximumSet_Gen.json +func ExampleOperationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasefleetmanager.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 = armdatabasefleetmanager.OperationsClientListResponse{ + // OperationListResult: armdatabasefleetmanager.OperationListResult{ + // Value: []*armdatabasefleetmanager.Operation{ + // { + // Name: to.Ptr("xalexazqlaltsvcoseubmutjbey"), + // IsDataAction: to.Ptr(true), + // Display: &armdatabasefleetmanager.OperationDisplay{ + // Provider: to.Ptr("bnlenqwsjrsxcflztxtllrep"), + // Resource: to.Ptr("ncu"), + // Operation: to.Ptr("nnbudygrwx"), + // Description: to.Ptr("ulkoxbko"), + // }, + // Origin: to.Ptr(armdatabasefleetmanager.OriginUser), + // ActionType: to.Ptr(armdatabasefleetmanager.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/abgad"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/options.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/options.go new file mode 100644 index 000000000000..d1bf9d740627 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/options.go @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager + +// FirewallRulesClientBeginCreateOrUpdateOptions contains the optional parameters for the FirewallRulesClient.BeginCreateOrUpdate +// method. +type FirewallRulesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FirewallRulesClientBeginDeleteOptions contains the optional parameters for the FirewallRulesClient.BeginDelete method. +type FirewallRulesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FirewallRulesClientGetOptions contains the optional parameters for the FirewallRulesClient.Get method. +type FirewallRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FirewallRulesClientListByFleetspaceOptions contains the optional parameters for the FirewallRulesClient.NewListByFleetspacePager +// method. +type FirewallRulesClientListByFleetspaceOptions struct { + // The number of elements in the collection to skip. + Skip *int64 + + // An opaque token that identifies a starting point in the collection. + Skiptoken *string + + // The number of elements to return from the collection. + Top *int64 +} + +// FleetDatabasesClientBeginChangeTierOptions contains the optional parameters for the FleetDatabasesClient.BeginChangeTier +// method. +type FleetDatabasesClientBeginChangeTierOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetDatabasesClient.BeginCreateOrUpdate +// method. +type FleetDatabasesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetDatabasesClientBeginDeleteOptions contains the optional parameters for the FleetDatabasesClient.BeginDelete method. +type FleetDatabasesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetDatabasesClientBeginRenameOptions contains the optional parameters for the FleetDatabasesClient.BeginRename method. +type FleetDatabasesClientBeginRenameOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetDatabasesClientBeginRevertOptions contains the optional parameters for the FleetDatabasesClient.BeginRevert method. +type FleetDatabasesClientBeginRevertOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetDatabasesClientBeginUpdateOptions contains the optional parameters for the FleetDatabasesClient.BeginUpdate method. +type FleetDatabasesClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetDatabasesClientGetOptions contains the optional parameters for the FleetDatabasesClient.Get method. +type FleetDatabasesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetDatabasesClientListByFleetspaceOptions contains the optional parameters for the FleetDatabasesClient.NewListByFleetspacePager +// method. +type FleetDatabasesClientListByFleetspaceOptions struct { + // An OData filter expression that filters elements in the collection. + Filter *string + + // The number of elements in the collection to skip. + Skip *int64 + + // An opaque token that identifies a starting point in the collection. + Skiptoken *string + + // The number of elements to return from the collection. + Top *int64 +} + +// FleetTiersClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetTiersClient.BeginCreateOrUpdate +// method. +type FleetTiersClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetTiersClientBeginDeleteOptions contains the optional parameters for the FleetTiersClient.BeginDelete method. +type FleetTiersClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetTiersClientBeginUpdateOptions contains the optional parameters for the FleetTiersClient.BeginUpdate method. +type FleetTiersClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetTiersClientDisableOptions contains the optional parameters for the FleetTiersClient.Disable method. +type FleetTiersClientDisableOptions struct { + // placeholder for future optional parameters +} + +// FleetTiersClientGetOptions contains the optional parameters for the FleetTiersClient.Get method. +type FleetTiersClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetTiersClientListByFleetOptions contains the optional parameters for the FleetTiersClient.NewListByFleetPager method. +type FleetTiersClientListByFleetOptions struct { + // The number of elements in the collection to skip. + Skip *int64 + + // An opaque token that identifies a starting point in the collection. + Skiptoken *string + + // The number of elements to return from the collection. + Top *int64 +} + +// FleetsClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetsClient.BeginCreateOrUpdate method. +type FleetsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetsClientBeginDeleteOptions contains the optional parameters for the FleetsClient.BeginDelete method. +type FleetsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetsClientBeginUpdateOptions contains the optional parameters for the FleetsClient.BeginUpdate method. +type FleetsClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetsClientGetOptions contains the optional parameters for the FleetsClient.Get method. +type FleetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetsClientListByResourceGroupOptions contains the optional parameters for the FleetsClient.NewListByResourceGroupPager +// method. +type FleetsClientListByResourceGroupOptions struct { + // The number of elements in the collection to skip. + Skip *int64 + + // An opaque token that identifies a starting point in the collection. + Skiptoken *string + + // The number of elements to return from the collection. + Top *int64 +} + +// FleetsClientListOptions contains the optional parameters for the FleetsClient.NewListPager method. +type FleetsClientListOptions struct { + // placeholder for future optional parameters +} + +// FleetspacesClientBeginCreateOrUpdateOptions contains the optional parameters for the FleetspacesClient.BeginCreateOrUpdate +// method. +type FleetspacesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetspacesClientBeginDeleteOptions contains the optional parameters for the FleetspacesClient.BeginDelete method. +type FleetspacesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetspacesClientBeginRegisterServerOptions contains the optional parameters for the FleetspacesClient.BeginRegisterServer +// method. +type FleetspacesClientBeginRegisterServerOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetspacesClientBeginUnregisterOptions contains the optional parameters for the FleetspacesClient.BeginUnregister method. +type FleetspacesClientBeginUnregisterOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetspacesClientBeginUpdateOptions contains the optional parameters for the FleetspacesClient.BeginUpdate method. +type FleetspacesClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FleetspacesClientGetOptions contains the optional parameters for the FleetspacesClient.Get method. +type FleetspacesClientGetOptions struct { + // placeholder for future optional parameters +} + +// FleetspacesClientListByFleetOptions contains the optional parameters for the FleetspacesClient.NewListByFleetPager method. +type FleetspacesClientListByFleetOptions struct { + // The number of elements in the collection to skip. + Skip *int64 + + // An opaque token that identifies a starting point in the collection. + Skiptoken *string + + // The number of elements to return from the collection. + Top *int64 +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/responses.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/responses.go new file mode 100644 index 000000000000..84fabeb067ae --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/responses.go @@ -0,0 +1,187 @@ +// Copyright (c) Microsoft 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 armdatabasefleetmanager + +// FirewallRulesClientCreateOrUpdateResponse contains the response from method FirewallRulesClient.BeginCreateOrUpdate. +type FirewallRulesClientCreateOrUpdateResponse struct { + // A firewall rule. + FirewallRule +} + +// FirewallRulesClientDeleteResponse contains the response from method FirewallRulesClient.BeginDelete. +type FirewallRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// FirewallRulesClientGetResponse contains the response from method FirewallRulesClient.Get. +type FirewallRulesClientGetResponse struct { + // A firewall rule. + FirewallRule +} + +// FirewallRulesClientListByFleetspaceResponse contains the response from method FirewallRulesClient.NewListByFleetspacePager. +type FirewallRulesClientListByFleetspaceResponse struct { + // The response of a FirewallRule list operation. + FirewallRuleListResult +} + +// FleetDatabasesClientChangeTierResponse contains the response from method FleetDatabasesClient.BeginChangeTier. +type FleetDatabasesClientChangeTierResponse struct { + // placeholder for future response values +} + +// FleetDatabasesClientCreateOrUpdateResponse contains the response from method FleetDatabasesClient.BeginCreateOrUpdate. +type FleetDatabasesClientCreateOrUpdateResponse struct { + // A fleet database. + FleetDatabase +} + +// FleetDatabasesClientDeleteResponse contains the response from method FleetDatabasesClient.BeginDelete. +type FleetDatabasesClientDeleteResponse struct { + // placeholder for future response values +} + +// FleetDatabasesClientGetResponse contains the response from method FleetDatabasesClient.Get. +type FleetDatabasesClientGetResponse struct { + // A fleet database. + FleetDatabase +} + +// FleetDatabasesClientListByFleetspaceResponse contains the response from method FleetDatabasesClient.NewListByFleetspacePager. +type FleetDatabasesClientListByFleetspaceResponse struct { + // The response of a FleetDatabase list operation. + FleetDatabaseListResult +} + +// FleetDatabasesClientRenameResponse contains the response from method FleetDatabasesClient.BeginRename. +type FleetDatabasesClientRenameResponse struct { + // placeholder for future response values +} + +// FleetDatabasesClientRevertResponse contains the response from method FleetDatabasesClient.BeginRevert. +type FleetDatabasesClientRevertResponse struct { + // placeholder for future response values +} + +// FleetDatabasesClientUpdateResponse contains the response from method FleetDatabasesClient.BeginUpdate. +type FleetDatabasesClientUpdateResponse struct { + // A fleet database. + FleetDatabase +} + +// FleetTiersClientCreateOrUpdateResponse contains the response from method FleetTiersClient.BeginCreateOrUpdate. +type FleetTiersClientCreateOrUpdateResponse struct { + // A SQL Database Fleet tier. + FleetTier +} + +// FleetTiersClientDeleteResponse contains the response from method FleetTiersClient.BeginDelete. +type FleetTiersClientDeleteResponse struct { + // placeholder for future response values +} + +// FleetTiersClientDisableResponse contains the response from method FleetTiersClient.Disable. +type FleetTiersClientDisableResponse struct { + // A SQL Database Fleet tier. + FleetTier +} + +// FleetTiersClientGetResponse contains the response from method FleetTiersClient.Get. +type FleetTiersClientGetResponse struct { + // A SQL Database Fleet tier. + FleetTier +} + +// FleetTiersClientListByFleetResponse contains the response from method FleetTiersClient.NewListByFleetPager. +type FleetTiersClientListByFleetResponse struct { + // The response of a FleetTier list operation. + FleetTierListResult +} + +// FleetTiersClientUpdateResponse contains the response from method FleetTiersClient.BeginUpdate. +type FleetTiersClientUpdateResponse struct { + // A SQL Database Fleet tier. + FleetTier +} + +// FleetsClientCreateOrUpdateResponse contains the response from method FleetsClient.BeginCreateOrUpdate. +type FleetsClientCreateOrUpdateResponse struct { + // A Database Fleet. + Fleet +} + +// FleetsClientDeleteResponse contains the response from method FleetsClient.BeginDelete. +type FleetsClientDeleteResponse struct { + // placeholder for future response values +} + +// FleetsClientGetResponse contains the response from method FleetsClient.Get. +type FleetsClientGetResponse struct { + // A Database Fleet. + Fleet +} + +// FleetsClientListByResourceGroupResponse contains the response from method FleetsClient.NewListByResourceGroupPager. +type FleetsClientListByResourceGroupResponse struct { + // The response of a Fleet list operation. + FleetListResult +} + +// FleetsClientListResponse contains the response from method FleetsClient.NewListPager. +type FleetsClientListResponse struct { + // The response of a Fleet list operation. + FleetListResult +} + +// FleetsClientUpdateResponse contains the response from method FleetsClient.BeginUpdate. +type FleetsClientUpdateResponse struct { + // A Database Fleet. + Fleet +} + +// FleetspacesClientCreateOrUpdateResponse contains the response from method FleetspacesClient.BeginCreateOrUpdate. +type FleetspacesClientCreateOrUpdateResponse struct { + // A fleetspace. + Fleetspace +} + +// FleetspacesClientDeleteResponse contains the response from method FleetspacesClient.BeginDelete. +type FleetspacesClientDeleteResponse struct { + // placeholder for future response values +} + +// FleetspacesClientGetResponse contains the response from method FleetspacesClient.Get. +type FleetspacesClientGetResponse struct { + // A fleetspace. + Fleetspace +} + +// FleetspacesClientListByFleetResponse contains the response from method FleetspacesClient.NewListByFleetPager. +type FleetspacesClientListByFleetResponse struct { + // The response of a Fleetspace list operation. + FleetspaceListResult +} + +// FleetspacesClientRegisterServerResponse contains the response from method FleetspacesClient.BeginRegisterServer. +type FleetspacesClientRegisterServerResponse struct { + // placeholder for future response values +} + +// FleetspacesClientUnregisterResponse contains the response from method FleetspacesClient.BeginUnregister. +type FleetspacesClientUnregisterResponse struct { + // placeholder for future response values +} + +// FleetspacesClientUpdateResponse contains the response from method FleetspacesClient.BeginUpdate. +type FleetspacesClientUpdateResponse struct { + // A fleetspace. + Fleetspace +} + +// 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/databasefleetmanager/armdatabasefleetmanager/time_rfc3339.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/time_rfc3339.go new file mode 100644 index 000000000000..6a6d0db9efb0 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/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 armdatabasefleetmanager + +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/databasefleetmanager/armdatabasefleetmanager/tsp-location.yaml b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/tsp-location.yaml new file mode 100644 index 000000000000..4ddfdb458c44 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/databasefleetmanager/DatabaseFleetManager.Management +commit: 676334a284e5136f0a0721d6ae844bb04332f579 +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/CHANGELOG.md b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/CHANGELOG.md new file mode 100644 index 000000000000..01f10e170866 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2025-02-27) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasewatcher/armdatabasewatcher` 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/databasewatcher/armdatabasewatcher/LICENSE.txt b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/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/databasewatcher/armdatabasewatcher/README.md b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/README.md new file mode 100644 index 000000000000..eb65fb5abd50 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/README.md @@ -0,0 +1,90 @@ +# Azure Databasewatcher Module for Go + +The `armdatabasewatcher` module provides operations for working with Azure Databasewatcher. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/databasewatcher/armdatabasewatcher) + +# 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 Databasewatcher module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasewatcher/armdatabasewatcher +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Databasewatcher. 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 Databasewatcher 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 := armdatabasewatcher.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 := armdatabasewatcher.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.NewAlertRuleResourcesClient() +``` + +## 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 `Databasewatcher` 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/databasewatcher/armdatabasewatcher/alertruleresources_client.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/alertruleresources_client.go new file mode 100644 index 000000000000..295553c4e513 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/alertruleresources_client.go @@ -0,0 +1,309 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher + +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" +) + +// AlertRuleResourcesClient contains the methods for the AlertRuleResources group. +// Don't use this type directly, use NewAlertRuleResourcesClient() instead. +type AlertRuleResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAlertRuleResourcesClient creates a new instance of AlertRuleResourcesClient 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 NewAlertRuleResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertRuleResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AlertRuleResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a AlertRuleResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - alertRuleResourceName - The alert rule proxy resource name. +// - resource - Resource create parameters. +// - options - AlertRuleResourcesClientCreateOrUpdateOptions contains the optional parameters for the AlertRuleResourcesClient.CreateOrUpdate +// method. +func (client *AlertRuleResourcesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, watcherName string, alertRuleResourceName string, resource AlertRuleResource, options *AlertRuleResourcesClientCreateOrUpdateOptions) (AlertRuleResourcesClientCreateOrUpdateResponse, error) { + var err error + const operationName = "AlertRuleResourcesClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, watcherName, alertRuleResourceName, resource, options) + if err != nil { + return AlertRuleResourcesClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertRuleResourcesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return AlertRuleResourcesClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AlertRuleResourcesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, alertRuleResourceName string, resource AlertRuleResource, _ *AlertRuleResourcesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + if alertRuleResourceName == "" { + return nil, errors.New("parameter alertRuleResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{alertRuleResourceName}", url.PathEscape(alertRuleResourceName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *AlertRuleResourcesClient) createOrUpdateHandleResponse(resp *http.Response) (AlertRuleResourcesClientCreateOrUpdateResponse, error) { + result := AlertRuleResourcesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResource); err != nil { + return AlertRuleResourcesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a AlertRuleResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - alertRuleResourceName - The alert rule proxy resource name. +// - options - AlertRuleResourcesClientDeleteOptions contains the optional parameters for the AlertRuleResourcesClient.Delete +// method. +func (client *AlertRuleResourcesClient) Delete(ctx context.Context, resourceGroupName string, watcherName string, alertRuleResourceName string, options *AlertRuleResourcesClientDeleteOptions) (AlertRuleResourcesClientDeleteResponse, error) { + var err error + const operationName = "AlertRuleResourcesClient.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, watcherName, alertRuleResourceName, options) + if err != nil { + return AlertRuleResourcesClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertRuleResourcesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return AlertRuleResourcesClientDeleteResponse{}, err + } + return AlertRuleResourcesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AlertRuleResourcesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, alertRuleResourceName string, _ *AlertRuleResourcesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + if alertRuleResourceName == "" { + return nil, errors.New("parameter alertRuleResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{alertRuleResourceName}", url.PathEscape(alertRuleResourceName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a AlertRuleResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - alertRuleResourceName - The alert rule proxy resource name. +// - options - AlertRuleResourcesClientGetOptions contains the optional parameters for the AlertRuleResourcesClient.Get method. +func (client *AlertRuleResourcesClient) Get(ctx context.Context, resourceGroupName string, watcherName string, alertRuleResourceName string, options *AlertRuleResourcesClientGetOptions) (AlertRuleResourcesClientGetResponse, error) { + var err error + const operationName = "AlertRuleResourcesClient.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, watcherName, alertRuleResourceName, options) + if err != nil { + return AlertRuleResourcesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AlertRuleResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AlertRuleResourcesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AlertRuleResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, alertRuleResourceName string, _ *AlertRuleResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + if alertRuleResourceName == "" { + return nil, errors.New("parameter alertRuleResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{alertRuleResourceName}", url.PathEscape(alertRuleResourceName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *AlertRuleResourcesClient) getHandleResponse(resp *http.Response) (AlertRuleResourcesClientGetResponse, error) { + result := AlertRuleResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResource); err != nil { + return AlertRuleResourcesClientGetResponse{}, err + } + return result, nil +} + +// NewListByParentPager - List AlertRuleResource resources by Watcher +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - options - AlertRuleResourcesClientListByParentOptions contains the optional parameters for the AlertRuleResourcesClient.NewListByParentPager +// method. +func (client *AlertRuleResourcesClient) NewListByParentPager(resourceGroupName string, watcherName string, options *AlertRuleResourcesClientListByParentOptions) *runtime.Pager[AlertRuleResourcesClientListByParentResponse] { + return runtime.NewPager(runtime.PagingHandler[AlertRuleResourcesClientListByParentResponse]{ + More: func(page AlertRuleResourcesClientListByParentResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AlertRuleResourcesClientListByParentResponse) (AlertRuleResourcesClientListByParentResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AlertRuleResourcesClient.NewListByParentPager") + 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.listByParentCreateRequest(ctx, resourceGroupName, watcherName, options) + }, nil) + if err != nil { + return AlertRuleResourcesClientListByParentResponse{}, err + } + return client.listByParentHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByParentCreateRequest creates the ListByParent request. +func (client *AlertRuleResourcesClient) listByParentCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, _ *AlertRuleResourcesClientListByParentOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByParentHandleResponse handles the ListByParent response. +func (client *AlertRuleResourcesClient) listByParentHandleResponse(resp *http.Response) (AlertRuleResourcesClientListByParentResponse, error) { + result := AlertRuleResourcesClientListByParentResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResourceListResult); err != nil { + return AlertRuleResourcesClientListByParentResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/alertruleresources_client_example_test.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/alertruleresources_client_example_test.go new file mode 100644 index 000000000000..61c9f599aab7 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/alertruleresources_client_example_test.go @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher_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/databasewatcher/armdatabasewatcher" + "log" + "time" +) + +// Generated from example definition: 2025-01-02/AlertRuleResources_CreateOrUpdate_MaximumSet_Gen.json +func ExampleAlertRuleResourcesClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAlertRuleResourcesClient().CreateOrUpdate(ctx, "rgWatcher", "testWatcher", "testAlert", armdatabasewatcher.AlertRuleResource{ + Properties: &armdatabasewatcher.AlertRuleResourceProperties{ + AlertRuleResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/rgWatcher/providers/microsoft.insights/scheduledqueryrules/alerts-demo"), + CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.798Z"); return t }()), + AlertRuleTemplateVersion: to.Ptr("1.0"), + AlertRuleTemplateID: to.Ptr("someTemplateId"), + CreatedWithProperties: to.Ptr(armdatabasewatcher.AlertRuleCreationPropertiesCreatedWithActionGroup), + }, + }, 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 = armdatabasewatcher.AlertRuleResourcesClientCreateOrUpdateResponse{ + // AlertRuleResource: &armdatabasewatcher.AlertRuleResource{ + // Properties: &armdatabasewatcher.AlertRuleResourceProperties{ + // AlertRuleResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/rgWatcher/providers/microsoft.insights/scheduledqueryrules/alerts-demo"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.798Z"); return t}()), + // AlertRuleTemplateVersion: to.Ptr("1.0"), + // AlertRuleTemplateID: to.Ptr("someTemplateId"), + // CreatedWithProperties: to.Ptr(armdatabasewatcher.AlertRuleCreationPropertiesCreatedWithActionGroup), + // ProvisioningState: to.Ptr(armdatabasewatcher.ResourceProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/rgWatcher/providers/microsoft.databasewatcher/watchers/testWatcher/alertRuleResources/testAlert"), + // Name: to.Ptr("testAlert"), + // Type: to.Ptr("microsoft.databasewatcher/watchers/alertRuleResources"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-02/AlertRuleResources_Delete_MaximumSet_Gen.json +func ExampleAlertRuleResourcesClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAlertRuleResourcesClient().Delete(ctx, "rgWatcher", "testWatcher", "testAlert", 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 = armdatabasewatcher.AlertRuleResourcesClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-01-02/AlertRuleResources_Get_MaximumSet_Gen.json +func ExampleAlertRuleResourcesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAlertRuleResourcesClient().Get(ctx, "rgWatcher", "testWatcher", "testAlert", 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 = armdatabasewatcher.AlertRuleResourcesClientGetResponse{ + // AlertRuleResource: &armdatabasewatcher.AlertRuleResource{ + // Properties: &armdatabasewatcher.AlertRuleResourceProperties{ + // AlertRuleResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/rgWatcher/providers/microsoft.insights/scheduledqueryrules/alerts-demo"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.798Z"); return t}()), + // AlertRuleTemplateVersion: to.Ptr("1.0"), + // AlertRuleTemplateID: to.Ptr("someTemplateId"), + // CreatedWithProperties: to.Ptr(armdatabasewatcher.AlertRuleCreationPropertiesCreatedWithActionGroup), + // ProvisioningState: to.Ptr(armdatabasewatcher.ResourceProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/rgWatcher/providers/microsoft.databasewatcher/watchers/testWatcher/alertRuleResources/testAlert"), + // Name: to.Ptr("testAlert"), + // Type: to.Ptr("microsoft.databasewatcher/watchers/alertRuleResources"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-02/AlertRuleResources_ListByParent_MaximumSet_Gen.json +func ExampleAlertRuleResourcesClient_NewListByParentPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAlertRuleResourcesClient().NewListByParentPager("rgWatcher", "testWatcher", 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 = armdatabasewatcher.AlertRuleResourcesClientListByParentResponse{ + // AlertRuleResourceListResult: armdatabasewatcher.AlertRuleResourceListResult{ + // Value: []*armdatabasewatcher.AlertRuleResource{ + // { + // Properties: &armdatabasewatcher.AlertRuleResourceProperties{ + // AlertRuleResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/rgWatcher/providers/microsoft.insights/scheduledqueryrules/alerts-demo"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.798Z"); return t}()), + // AlertRuleTemplateVersion: to.Ptr("1.0"), + // ProvisioningState: to.Ptr(armdatabasewatcher.ResourceProvisioningStateSucceeded), + // AlertRuleTemplateID: to.Ptr("someTemplateId"), + // CreatedWithProperties: to.Ptr(armdatabasewatcher.AlertRuleCreationPropertiesCreatedWithActionGroup), + // }, + // ID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/rgWatcher/providers/microsoft.databasewatcher/watchers/testWatcher/alertRuleResources/testAlert"), + // Name: to.Ptr("testAlert"), + // Type: to.Ptr("microsoft.databasewatcher/watchers/alertRuleResources"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/ci.yml b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/ci.yml new file mode 100644 index 000000000000..3a06f60c597b --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/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/databasewatcher/armdatabasewatcher/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/databasewatcher/armdatabasewatcher/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + IncludeRelease: true + ServiceDirectory: 'resourcemanager/databasewatcher/armdatabasewatcher' diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/client_factory.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/client_factory.go new file mode 100644 index 000000000000..db28bbe342ae --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/client_factory.go @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher + +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 +} + +// NewAlertRuleResourcesClient creates a new instance of AlertRuleResourcesClient. +func (c *ClientFactory) NewAlertRuleResourcesClient() *AlertRuleResourcesClient { + return &AlertRuleResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewHealthValidationsClient creates a new instance of HealthValidationsClient. +func (c *ClientFactory) NewHealthValidationsClient() *HealthValidationsClient { + return &HealthValidationsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} + +// NewSharedPrivateLinkResourcesClient creates a new instance of SharedPrivateLinkResourcesClient. +func (c *ClientFactory) NewSharedPrivateLinkResourcesClient() *SharedPrivateLinkResourcesClient { + return &SharedPrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewTargetsClient creates a new instance of TargetsClient. +func (c *ClientFactory) NewTargetsClient() *TargetsClient { + return &TargetsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewWatchersClient creates a new instance of WatchersClient. +func (c *ClientFactory) NewWatchersClient() *WatchersClient { + return &WatchersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/constants.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/constants.go new file mode 100644 index 000000000000..fb14d4b4600b --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/constants.go @@ -0,0 +1,277 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasewatcher/armdatabasewatcher" + 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, + } +} + +// AlertRuleCreationProperties - The properties with which the alert rule resource was created. +type AlertRuleCreationProperties string + +const ( + // AlertRuleCreationPropertiesCreatedWithActionGroup - The alert rule was created with an action group. + AlertRuleCreationPropertiesCreatedWithActionGroup AlertRuleCreationProperties = "CreatedWithActionGroup" + // AlertRuleCreationPropertiesNone - The alert rule was created with no properties. + AlertRuleCreationPropertiesNone AlertRuleCreationProperties = "None" +) + +// PossibleAlertRuleCreationPropertiesValues returns the possible values for the AlertRuleCreationProperties const type. +func PossibleAlertRuleCreationPropertiesValues() []AlertRuleCreationProperties { + return []AlertRuleCreationProperties{ + AlertRuleCreationPropertiesCreatedWithActionGroup, + AlertRuleCreationPropertiesNone, + } +} + +// 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, + } +} + +// KustoOfferingType - The type of Kusto offering. +type KustoOfferingType string + +const ( + // KustoOfferingTypeAdx - The Azure Data Explorer cluster Kusto offering. + KustoOfferingTypeAdx KustoOfferingType = "adx" + // KustoOfferingTypeFabric - The Fabric Real-Time Analytics Kusto offering. + KustoOfferingTypeFabric KustoOfferingType = "fabric" + // KustoOfferingTypeFree - The free Azure Data Explorer cluster Kusto offering. + KustoOfferingTypeFree KustoOfferingType = "free" +) + +// PossibleKustoOfferingTypeValues returns the possible values for the KustoOfferingType const type. +func PossibleKustoOfferingTypeValues() []KustoOfferingType { + return []KustoOfferingType{ + KustoOfferingTypeAdx, + KustoOfferingTypeFabric, + KustoOfferingTypeFree, + } +} + +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +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" + // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAndUserAssigned, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + +// 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 last provisioning operation performed on the resource. +type ProvisioningState string + +const ( + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateCanceled, + ProvisioningStateFailed, + ProvisioningStateSucceeded, + } +} + +// 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, + } +} + +// SharedPrivateLinkResourceStatus - Status of the shared private link resource. Can be Pending, Approved, Rejected or Disconnected. +type SharedPrivateLinkResourceStatus string + +const ( + // SharedPrivateLinkResourceStatusApproved - The shared private link connection request was approved by the resource owner. + SharedPrivateLinkResourceStatusApproved SharedPrivateLinkResourceStatus = "Approved" + // SharedPrivateLinkResourceStatusDisconnected - The shared private link connection request was disconnected by the resource + // owner. + SharedPrivateLinkResourceStatusDisconnected SharedPrivateLinkResourceStatus = "Disconnected" + // SharedPrivateLinkResourceStatusPending - The shared private link connection request was not yet authorized by the resource + // owner. + SharedPrivateLinkResourceStatusPending SharedPrivateLinkResourceStatus = "Pending" + // SharedPrivateLinkResourceStatusRejected - The shared private link connection request was rejected by the resource owner. + SharedPrivateLinkResourceStatusRejected SharedPrivateLinkResourceStatus = "Rejected" +) + +// PossibleSharedPrivateLinkResourceStatusValues returns the possible values for the SharedPrivateLinkResourceStatus const type. +func PossibleSharedPrivateLinkResourceStatusValues() []SharedPrivateLinkResourceStatus { + return []SharedPrivateLinkResourceStatus{ + SharedPrivateLinkResourceStatusApproved, + SharedPrivateLinkResourceStatusDisconnected, + SharedPrivateLinkResourceStatusPending, + SharedPrivateLinkResourceStatusRejected, + } +} + +// TargetAuthenticationType - The type of authentication to use when connecting to a target. +type TargetAuthenticationType string + +const ( + // TargetAuthenticationTypeAAD - The Azure Active Directory authentication. + TargetAuthenticationTypeAAD TargetAuthenticationType = "Aad" + // TargetAuthenticationTypeSQL - The SQL password authentication. + TargetAuthenticationTypeSQL TargetAuthenticationType = "Sql" +) + +// PossibleTargetAuthenticationTypeValues returns the possible values for the TargetAuthenticationType const type. +func PossibleTargetAuthenticationTypeValues() []TargetAuthenticationType { + return []TargetAuthenticationType{ + TargetAuthenticationTypeAAD, + TargetAuthenticationTypeSQL, + } +} + +// ValidationStatus - Health validation status. +type ValidationStatus string + +const ( + // ValidationStatusCanceled - Health validation was canceled. + ValidationStatusCanceled ValidationStatus = "Canceled" + // ValidationStatusFailed - Health validation failed. + ValidationStatusFailed ValidationStatus = "Failed" + // ValidationStatusNotStarted - Health validation has not started. + ValidationStatusNotStarted ValidationStatus = "NotStarted" + // ValidationStatusRunning - Health validation is running. + ValidationStatusRunning ValidationStatus = "Running" + // ValidationStatusSucceeded - Health validation completed successfully. + ValidationStatusSucceeded ValidationStatus = "Succeeded" + // ValidationStatusTimedOut - Health validation timed out. + ValidationStatusTimedOut ValidationStatus = "TimedOut" +) + +// PossibleValidationStatusValues returns the possible values for the ValidationStatus const type. +func PossibleValidationStatusValues() []ValidationStatus { + return []ValidationStatus{ + ValidationStatusCanceled, + ValidationStatusFailed, + ValidationStatusNotStarted, + ValidationStatusRunning, + ValidationStatusSucceeded, + ValidationStatusTimedOut, + } +} + +// WatcherStatus - The monitoring collection status of a watcher. +type WatcherStatus string + +const ( + // WatcherStatusDeleting - Denotes the watcher is in a deleting state. + WatcherStatusDeleting WatcherStatus = "Deleting" + // WatcherStatusRunning - Denotes the watcher is in a running state. + WatcherStatusRunning WatcherStatus = "Running" + // WatcherStatusStarting - Denotes the watcher is in a starting state. + WatcherStatusStarting WatcherStatus = "Starting" + // WatcherStatusStopped - Denotes the watcher is in a stopped state. + WatcherStatusStopped WatcherStatus = "Stopped" + // WatcherStatusStopping - Denotes the watcher is in a stopping state. + WatcherStatusStopping WatcherStatus = "Stopping" +) + +// PossibleWatcherStatusValues returns the possible values for the WatcherStatus const type. +func PossibleWatcherStatusValues() []WatcherStatus { + return []WatcherStatus{ + WatcherStatusDeleting, + WatcherStatusRunning, + WatcherStatusStarting, + WatcherStatusStopped, + WatcherStatusStopping, + } +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/alertruleresources_server.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/alertruleresources_server.go new file mode 100644 index 000000000000..c95341c938b2 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/alertruleresources_server.go @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft 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/databasewatcher/armdatabasewatcher" + "net/http" + "net/url" + "regexp" +) + +// AlertRuleResourcesServer is a fake server for instances of the armdatabasewatcher.AlertRuleResourcesClient type. +type AlertRuleResourcesServer struct { + // CreateOrUpdate is the fake for method AlertRuleResourcesClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, watcherName string, alertRuleResourceName string, resource armdatabasewatcher.AlertRuleResource, options *armdatabasewatcher.AlertRuleResourcesClientCreateOrUpdateOptions) (resp azfake.Responder[armdatabasewatcher.AlertRuleResourcesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method AlertRuleResourcesClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, watcherName string, alertRuleResourceName string, options *armdatabasewatcher.AlertRuleResourcesClientDeleteOptions) (resp azfake.Responder[armdatabasewatcher.AlertRuleResourcesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AlertRuleResourcesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, watcherName string, alertRuleResourceName string, options *armdatabasewatcher.AlertRuleResourcesClientGetOptions) (resp azfake.Responder[armdatabasewatcher.AlertRuleResourcesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByParentPager is the fake for method AlertRuleResourcesClient.NewListByParentPager + // HTTP status codes to indicate success: http.StatusOK + NewListByParentPager func(resourceGroupName string, watcherName string, options *armdatabasewatcher.AlertRuleResourcesClientListByParentOptions) (resp azfake.PagerResponder[armdatabasewatcher.AlertRuleResourcesClientListByParentResponse]) +} + +// NewAlertRuleResourcesServerTransport creates a new instance of AlertRuleResourcesServerTransport with the provided implementation. +// The returned AlertRuleResourcesServerTransport instance is connected to an instance of armdatabasewatcher.AlertRuleResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAlertRuleResourcesServerTransport(srv *AlertRuleResourcesServer) *AlertRuleResourcesServerTransport { + return &AlertRuleResourcesServerTransport{ + srv: srv, + newListByParentPager: newTracker[azfake.PagerResponder[armdatabasewatcher.AlertRuleResourcesClientListByParentResponse]](), + } +} + +// AlertRuleResourcesServerTransport connects instances of armdatabasewatcher.AlertRuleResourcesClient to instances of AlertRuleResourcesServer. +// Don't use this type directly, use NewAlertRuleResourcesServerTransport instead. +type AlertRuleResourcesServerTransport struct { + srv *AlertRuleResourcesServer + newListByParentPager *tracker[azfake.PagerResponder[armdatabasewatcher.AlertRuleResourcesClientListByParentResponse]] +} + +// Do implements the policy.Transporter interface for AlertRuleResourcesServerTransport. +func (a *AlertRuleResourcesServerTransport) 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 a.dispatchToMethodFake(req, method) +} + +func (a *AlertRuleResourcesServerTransport) 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 alertRuleResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = alertRuleResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AlertRuleResourcesClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "AlertRuleResourcesClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "AlertRuleResourcesClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AlertRuleResourcesClient.NewListByParentPager": + res.resp, res.err = a.dispatchNewListByParentPager(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 (a *AlertRuleResourcesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alertRuleResources/(?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[armdatabasewatcher.AlertRuleResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + alertRuleResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertRuleResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, watcherNameParam, alertRuleResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AlertRuleResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AlertRuleResourcesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if a.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alertRuleResources/(?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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + alertRuleResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertRuleResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, watcherNameParam, alertRuleResourceNameParam, 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 (a *AlertRuleResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alertRuleResources/(?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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + alertRuleResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertRuleResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, watcherNameParam, alertRuleResourceNameParam, 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).AlertRuleResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AlertRuleResourcesServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByParentPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByParentPager not implemented")} + } + newListByParentPager := a.newListByParentPager.get(req) + if newListByParentPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alertRuleResources` + 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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListByParentPager(resourceGroupNameParam, watcherNameParam, nil) + newListByParentPager = &resp + a.newListByParentPager.add(req, newListByParentPager) + server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *armdatabasewatcher.AlertRuleResourcesClientListByParentResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByParentPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListByParentPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByParentPager) { + a.newListByParentPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to AlertRuleResourcesServerTransport +var alertRuleResourcesServerTransportInterceptor 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/databasewatcher/armdatabasewatcher/fake/healthvalidations_server.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/healthvalidations_server.go new file mode 100644 index 000000000000..95b7ca6aa035 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/healthvalidations_server.go @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft 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/databasewatcher/armdatabasewatcher" + "net/http" + "net/url" + "regexp" +) + +// HealthValidationsServer is a fake server for instances of the armdatabasewatcher.HealthValidationsClient type. +type HealthValidationsServer struct { + // Get is the fake for method HealthValidationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, watcherName string, healthValidationName string, options *armdatabasewatcher.HealthValidationsClientGetOptions) (resp azfake.Responder[armdatabasewatcher.HealthValidationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByParentPager is the fake for method HealthValidationsClient.NewListByParentPager + // HTTP status codes to indicate success: http.StatusOK + NewListByParentPager func(resourceGroupName string, watcherName string, options *armdatabasewatcher.HealthValidationsClientListByParentOptions) (resp azfake.PagerResponder[armdatabasewatcher.HealthValidationsClientListByParentResponse]) + + // BeginStartValidation is the fake for method HealthValidationsClient.BeginStartValidation + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginStartValidation func(ctx context.Context, resourceGroupName string, watcherName string, healthValidationName string, options *armdatabasewatcher.HealthValidationsClientBeginStartValidationOptions) (resp azfake.PollerResponder[armdatabasewatcher.HealthValidationsClientStartValidationResponse], errResp azfake.ErrorResponder) +} + +// NewHealthValidationsServerTransport creates a new instance of HealthValidationsServerTransport with the provided implementation. +// The returned HealthValidationsServerTransport instance is connected to an instance of armdatabasewatcher.HealthValidationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewHealthValidationsServerTransport(srv *HealthValidationsServer) *HealthValidationsServerTransport { + return &HealthValidationsServerTransport{ + srv: srv, + newListByParentPager: newTracker[azfake.PagerResponder[armdatabasewatcher.HealthValidationsClientListByParentResponse]](), + beginStartValidation: newTracker[azfake.PollerResponder[armdatabasewatcher.HealthValidationsClientStartValidationResponse]](), + } +} + +// HealthValidationsServerTransport connects instances of armdatabasewatcher.HealthValidationsClient to instances of HealthValidationsServer. +// Don't use this type directly, use NewHealthValidationsServerTransport instead. +type HealthValidationsServerTransport struct { + srv *HealthValidationsServer + newListByParentPager *tracker[azfake.PagerResponder[armdatabasewatcher.HealthValidationsClientListByParentResponse]] + beginStartValidation *tracker[azfake.PollerResponder[armdatabasewatcher.HealthValidationsClientStartValidationResponse]] +} + +// Do implements the policy.Transporter interface for HealthValidationsServerTransport. +func (h *HealthValidationsServerTransport) 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 h.dispatchToMethodFake(req, method) +} + +func (h *HealthValidationsServerTransport) 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 healthValidationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = healthValidationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "HealthValidationsClient.Get": + res.resp, res.err = h.dispatchGet(req) + case "HealthValidationsClient.NewListByParentPager": + res.resp, res.err = h.dispatchNewListByParentPager(req) + case "HealthValidationsClient.BeginStartValidation": + res.resp, res.err = h.dispatchBeginStartValidation(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 (h *HealthValidationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if h.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/healthValidations/(?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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + healthValidationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("healthValidationName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.Get(req.Context(), resourceGroupNameParam, watcherNameParam, healthValidationNameParam, 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).HealthValidation, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (h *HealthValidationsServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { + if h.srv.NewListByParentPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByParentPager not implemented")} + } + newListByParentPager := h.newListByParentPager.get(req) + if newListByParentPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/healthValidations` + 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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + resp := h.srv.NewListByParentPager(resourceGroupNameParam, watcherNameParam, nil) + newListByParentPager = &resp + h.newListByParentPager.add(req, newListByParentPager) + server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *armdatabasewatcher.HealthValidationsClientListByParentResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByParentPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + h.newListByParentPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByParentPager) { + h.newListByParentPager.remove(req) + } + return resp, nil +} + +func (h *HealthValidationsServerTransport) dispatchBeginStartValidation(req *http.Request) (*http.Response, error) { + if h.srv.BeginStartValidation == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStartValidation not implemented")} + } + beginStartValidation := h.beginStartValidation.get(req) + if beginStartValidation == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/healthValidations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/startValidation` + 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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + healthValidationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("healthValidationName")]) + if err != nil { + return nil, err + } + respr, errRespr := h.srv.BeginStartValidation(req.Context(), resourceGroupNameParam, watcherNameParam, healthValidationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginStartValidation = &respr + h.beginStartValidation.add(req, beginStartValidation) + } + + resp, err := server.PollerResponderNext(beginStartValidation, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + h.beginStartValidation.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginStartValidation) { + h.beginStartValidation.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to HealthValidationsServerTransport +var healthValidationsServerTransportInterceptor 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/databasewatcher/armdatabasewatcher/fake/internal.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/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/databasewatcher/armdatabasewatcher/fake/operations_server.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/operations_server.go new file mode 100644 index 000000000000..a0cc87fd81d7 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/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/databasewatcher/armdatabasewatcher" + "net/http" +) + +// OperationsServer is a fake server for instances of the armdatabasewatcher.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armdatabasewatcher.OperationsClientListOptions) (resp azfake.PagerResponder[armdatabasewatcher.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armdatabasewatcher.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[armdatabasewatcher.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armdatabasewatcher.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armdatabasewatcher.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 *armdatabasewatcher.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/databasewatcher/armdatabasewatcher/fake/server_factory.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/server_factory.go new file mode 100644 index 000000000000..1e703d61daa4 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/server_factory.go @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher.ClientFactory type. +type ServerFactory struct { + // AlertRuleResourcesServer contains the fakes for client AlertRuleResourcesClient + AlertRuleResourcesServer AlertRuleResourcesServer + + // HealthValidationsServer contains the fakes for client HealthValidationsClient + HealthValidationsServer HealthValidationsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // SharedPrivateLinkResourcesServer contains the fakes for client SharedPrivateLinkResourcesClient + SharedPrivateLinkResourcesServer SharedPrivateLinkResourcesServer + + // TargetsServer contains the fakes for client TargetsClient + TargetsServer TargetsServer + + // WatchersServer contains the fakes for client WatchersClient + WatchersServer WatchersServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armdatabasewatcher.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 armdatabasewatcher.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trAlertRuleResourcesServer *AlertRuleResourcesServerTransport + trHealthValidationsServer *HealthValidationsServerTransport + trOperationsServer *OperationsServerTransport + trSharedPrivateLinkResourcesServer *SharedPrivateLinkResourcesServerTransport + trTargetsServer *TargetsServerTransport + trWatchersServer *WatchersServerTransport +} + +// 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 "AlertRuleResourcesClient": + initServer(s, &s.trAlertRuleResourcesServer, func() *AlertRuleResourcesServerTransport { + return NewAlertRuleResourcesServerTransport(&s.srv.AlertRuleResourcesServer) + }) + resp, err = s.trAlertRuleResourcesServer.Do(req) + case "HealthValidationsClient": + initServer(s, &s.trHealthValidationsServer, func() *HealthValidationsServerTransport { + return NewHealthValidationsServerTransport(&s.srv.HealthValidationsServer) + }) + resp, err = s.trHealthValidationsServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + case "SharedPrivateLinkResourcesClient": + initServer(s, &s.trSharedPrivateLinkResourcesServer, func() *SharedPrivateLinkResourcesServerTransport { + return NewSharedPrivateLinkResourcesServerTransport(&s.srv.SharedPrivateLinkResourcesServer) + }) + resp, err = s.trSharedPrivateLinkResourcesServer.Do(req) + case "TargetsClient": + initServer(s, &s.trTargetsServer, func() *TargetsServerTransport { return NewTargetsServerTransport(&s.srv.TargetsServer) }) + resp, err = s.trTargetsServer.Do(req) + case "WatchersClient": + initServer(s, &s.trWatchersServer, func() *WatchersServerTransport { return NewWatchersServerTransport(&s.srv.WatchersServer) }) + resp, err = s.trWatchersServer.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/databasewatcher/armdatabasewatcher/fake/sharedprivatelinkresources_server.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/sharedprivatelinkresources_server.go new file mode 100644 index 000000000000..0efdaae954e7 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/sharedprivatelinkresources_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/databasewatcher/armdatabasewatcher" + "net/http" + "net/url" + "regexp" +) + +// SharedPrivateLinkResourcesServer is a fake server for instances of the armdatabasewatcher.SharedPrivateLinkResourcesClient type. +type SharedPrivateLinkResourcesServer struct { + // BeginCreate is the fake for method SharedPrivateLinkResourcesClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, watcherName string, sharedPrivateLinkResourceName string, resource armdatabasewatcher.SharedPrivateLinkResource, options *armdatabasewatcher.SharedPrivateLinkResourcesClientBeginCreateOptions) (resp azfake.PollerResponder[armdatabasewatcher.SharedPrivateLinkResourcesClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method SharedPrivateLinkResourcesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, watcherName string, sharedPrivateLinkResourceName string, options *armdatabasewatcher.SharedPrivateLinkResourcesClientBeginDeleteOptions) (resp azfake.PollerResponder[armdatabasewatcher.SharedPrivateLinkResourcesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SharedPrivateLinkResourcesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, watcherName string, sharedPrivateLinkResourceName string, options *armdatabasewatcher.SharedPrivateLinkResourcesClientGetOptions) (resp azfake.Responder[armdatabasewatcher.SharedPrivateLinkResourcesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByWatcherPager is the fake for method SharedPrivateLinkResourcesClient.NewListByWatcherPager + // HTTP status codes to indicate success: http.StatusOK + NewListByWatcherPager func(resourceGroupName string, watcherName string, options *armdatabasewatcher.SharedPrivateLinkResourcesClientListByWatcherOptions) (resp azfake.PagerResponder[armdatabasewatcher.SharedPrivateLinkResourcesClientListByWatcherResponse]) +} + +// NewSharedPrivateLinkResourcesServerTransport creates a new instance of SharedPrivateLinkResourcesServerTransport with the provided implementation. +// The returned SharedPrivateLinkResourcesServerTransport instance is connected to an instance of armdatabasewatcher.SharedPrivateLinkResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSharedPrivateLinkResourcesServerTransport(srv *SharedPrivateLinkResourcesServer) *SharedPrivateLinkResourcesServerTransport { + return &SharedPrivateLinkResourcesServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armdatabasewatcher.SharedPrivateLinkResourcesClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdatabasewatcher.SharedPrivateLinkResourcesClientDeleteResponse]](), + newListByWatcherPager: newTracker[azfake.PagerResponder[armdatabasewatcher.SharedPrivateLinkResourcesClientListByWatcherResponse]](), + } +} + +// SharedPrivateLinkResourcesServerTransport connects instances of armdatabasewatcher.SharedPrivateLinkResourcesClient to instances of SharedPrivateLinkResourcesServer. +// Don't use this type directly, use NewSharedPrivateLinkResourcesServerTransport instead. +type SharedPrivateLinkResourcesServerTransport struct { + srv *SharedPrivateLinkResourcesServer + beginCreate *tracker[azfake.PollerResponder[armdatabasewatcher.SharedPrivateLinkResourcesClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdatabasewatcher.SharedPrivateLinkResourcesClientDeleteResponse]] + newListByWatcherPager *tracker[azfake.PagerResponder[armdatabasewatcher.SharedPrivateLinkResourcesClientListByWatcherResponse]] +} + +// Do implements the policy.Transporter interface for SharedPrivateLinkResourcesServerTransport. +func (s *SharedPrivateLinkResourcesServerTransport) 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 *SharedPrivateLinkResourcesServerTransport) 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 sharedPrivateLinkResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sharedPrivateLinkResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SharedPrivateLinkResourcesClient.BeginCreate": + res.resp, res.err = s.dispatchBeginCreate(req) + case "SharedPrivateLinkResourcesClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "SharedPrivateLinkResourcesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SharedPrivateLinkResourcesClient.NewListByWatcherPager": + res.resp, res.err = s.dispatchNewListByWatcherPager(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 *SharedPrivateLinkResourcesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if s.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := s.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources/(?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[armdatabasewatcher.SharedPrivateLinkResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + sharedPrivateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sharedPrivateLinkResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginCreate(req.Context(), resourceGroupNameParam, watcherNameParam, sharedPrivateLinkResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + s.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + s.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + s.beginCreate.remove(req) + } + + return resp, nil +} + +func (s *SharedPrivateLinkResourcesServerTransport) 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\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources/(?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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + sharedPrivateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sharedPrivateLinkResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.BeginDelete(req.Context(), resourceGroupNameParam, watcherNameParam, sharedPrivateLinkResourceNameParam, 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 *SharedPrivateLinkResourcesServerTransport) 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\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources/(?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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + sharedPrivateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("sharedPrivateLinkResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, watcherNameParam, sharedPrivateLinkResourceNameParam, 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).SharedPrivateLinkResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SharedPrivateLinkResourcesServerTransport) dispatchNewListByWatcherPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListByWatcherPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByWatcherPager not implemented")} + } + newListByWatcherPager := s.newListByWatcherPager.get(req) + if newListByWatcherPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/sharedPrivateLinkResources` + 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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListByWatcherPager(resourceGroupNameParam, watcherNameParam, nil) + newListByWatcherPager = &resp + s.newListByWatcherPager.add(req, newListByWatcherPager) + server.PagerResponderInjectNextLinks(newListByWatcherPager, req, func(page *armdatabasewatcher.SharedPrivateLinkResourcesClientListByWatcherResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByWatcherPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListByWatcherPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByWatcherPager) { + s.newListByWatcherPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to SharedPrivateLinkResourcesServerTransport +var sharedPrivateLinkResourcesServerTransportInterceptor 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/databasewatcher/armdatabasewatcher/fake/targets_server.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/targets_server.go new file mode 100644 index 000000000000..cacee3f65b09 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/targets_server.go @@ -0,0 +1,267 @@ +// Copyright (c) Microsoft 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/databasewatcher/armdatabasewatcher" + "net/http" + "net/url" + "regexp" +) + +// TargetsServer is a fake server for instances of the armdatabasewatcher.TargetsClient type. +type TargetsServer struct { + // CreateOrUpdate is the fake for method TargetsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, watcherName string, targetName string, resource armdatabasewatcher.Target, options *armdatabasewatcher.TargetsClientCreateOrUpdateOptions) (resp azfake.Responder[armdatabasewatcher.TargetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method TargetsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, watcherName string, targetName string, options *armdatabasewatcher.TargetsClientDeleteOptions) (resp azfake.Responder[armdatabasewatcher.TargetsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method TargetsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, watcherName string, targetName string, options *armdatabasewatcher.TargetsClientGetOptions) (resp azfake.Responder[armdatabasewatcher.TargetsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByWatcherPager is the fake for method TargetsClient.NewListByWatcherPager + // HTTP status codes to indicate success: http.StatusOK + NewListByWatcherPager func(resourceGroupName string, watcherName string, options *armdatabasewatcher.TargetsClientListByWatcherOptions) (resp azfake.PagerResponder[armdatabasewatcher.TargetsClientListByWatcherResponse]) +} + +// NewTargetsServerTransport creates a new instance of TargetsServerTransport with the provided implementation. +// The returned TargetsServerTransport instance is connected to an instance of armdatabasewatcher.TargetsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewTargetsServerTransport(srv *TargetsServer) *TargetsServerTransport { + return &TargetsServerTransport{ + srv: srv, + newListByWatcherPager: newTracker[azfake.PagerResponder[armdatabasewatcher.TargetsClientListByWatcherResponse]](), + } +} + +// TargetsServerTransport connects instances of armdatabasewatcher.TargetsClient to instances of TargetsServer. +// Don't use this type directly, use NewTargetsServerTransport instead. +type TargetsServerTransport struct { + srv *TargetsServer + newListByWatcherPager *tracker[azfake.PagerResponder[armdatabasewatcher.TargetsClientListByWatcherResponse]] +} + +// Do implements the policy.Transporter interface for TargetsServerTransport. +func (t *TargetsServerTransport) 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 *TargetsServerTransport) 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 targetsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = targetsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "TargetsClient.CreateOrUpdate": + res.resp, res.err = t.dispatchCreateOrUpdate(req) + case "TargetsClient.Delete": + res.resp, res.err = t.dispatchDelete(req) + case "TargetsClient.Get": + res.resp, res.err = t.dispatchGet(req) + case "TargetsClient.NewListByWatcherPager": + res.resp, res.err = t.dispatchNewListByWatcherPager(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 *TargetsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if t.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targets/(?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[armdatabasewatcher.Target](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + targetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("targetName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, watcherNameParam, targetNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Target, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TargetsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if t.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\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targets/(?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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + targetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("targetName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Delete(req.Context(), resourceGroupNameParam, watcherNameParam, targetNameParam, 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 (t *TargetsServerTransport) 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\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targets/(?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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + targetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("targetName")]) + if err != nil { + return nil, err + } + respr, errRespr := t.srv.Get(req.Context(), resourceGroupNameParam, watcherNameParam, targetNameParam, 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).Target, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (t *TargetsServerTransport) dispatchNewListByWatcherPager(req *http.Request) (*http.Response, error) { + if t.srv.NewListByWatcherPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByWatcherPager not implemented")} + } + newListByWatcherPager := t.newListByWatcherPager.get(req) + if newListByWatcherPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targets` + 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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + resp := t.srv.NewListByWatcherPager(resourceGroupNameParam, watcherNameParam, nil) + newListByWatcherPager = &resp + t.newListByWatcherPager.add(req, newListByWatcherPager) + server.PagerResponderInjectNextLinks(newListByWatcherPager, req, func(page *armdatabasewatcher.TargetsClientListByWatcherResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByWatcherPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + t.newListByWatcherPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByWatcherPager) { + t.newListByWatcherPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to TargetsServerTransport +var targetsServerTransportInterceptor 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/databasewatcher/armdatabasewatcher/fake/time_rfc3339.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/time_rfc3339.go new file mode 100644 index 000000000000..87ee11e83b32 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/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/databasewatcher/armdatabasewatcher/fake/watchers_server.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/watchers_server.go new file mode 100644 index 000000000000..62d4c81a7133 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/watchers_server.go @@ -0,0 +1,478 @@ +// Copyright (c) Microsoft 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/databasewatcher/armdatabasewatcher" + "net/http" + "net/url" + "regexp" +) + +// WatchersServer is a fake server for instances of the armdatabasewatcher.WatchersClient type. +type WatchersServer struct { + // BeginCreateOrUpdate is the fake for method WatchersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, watcherName string, resource armdatabasewatcher.Watcher, options *armdatabasewatcher.WatchersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdatabasewatcher.WatchersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method WatchersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, watcherName string, options *armdatabasewatcher.WatchersClientBeginDeleteOptions) (resp azfake.PollerResponder[armdatabasewatcher.WatchersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method WatchersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, watcherName string, options *armdatabasewatcher.WatchersClientGetOptions) (resp azfake.Responder[armdatabasewatcher.WatchersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method WatchersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armdatabasewatcher.WatchersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armdatabasewatcher.WatchersClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method WatchersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armdatabasewatcher.WatchersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armdatabasewatcher.WatchersClientListBySubscriptionResponse]) + + // BeginStart is the fake for method WatchersClient.BeginStart + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginStart func(ctx context.Context, resourceGroupName string, watcherName string, options *armdatabasewatcher.WatchersClientBeginStartOptions) (resp azfake.PollerResponder[armdatabasewatcher.WatchersClientStartResponse], errResp azfake.ErrorResponder) + + // BeginStop is the fake for method WatchersClient.BeginStop + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginStop func(ctx context.Context, resourceGroupName string, watcherName string, options *armdatabasewatcher.WatchersClientBeginStopOptions) (resp azfake.PollerResponder[armdatabasewatcher.WatchersClientStopResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method WatchersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, watcherName string, properties armdatabasewatcher.WatcherUpdate, options *armdatabasewatcher.WatchersClientBeginUpdateOptions) (resp azfake.PollerResponder[armdatabasewatcher.WatchersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewWatchersServerTransport creates a new instance of WatchersServerTransport with the provided implementation. +// The returned WatchersServerTransport instance is connected to an instance of armdatabasewatcher.WatchersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewWatchersServerTransport(srv *WatchersServer) *WatchersServerTransport { + return &WatchersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armdatabasewatcher.WatchersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armdatabasewatcher.WatchersClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armdatabasewatcher.WatchersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armdatabasewatcher.WatchersClientListBySubscriptionResponse]](), + beginStart: newTracker[azfake.PollerResponder[armdatabasewatcher.WatchersClientStartResponse]](), + beginStop: newTracker[azfake.PollerResponder[armdatabasewatcher.WatchersClientStopResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armdatabasewatcher.WatchersClientUpdateResponse]](), + } +} + +// WatchersServerTransport connects instances of armdatabasewatcher.WatchersClient to instances of WatchersServer. +// Don't use this type directly, use NewWatchersServerTransport instead. +type WatchersServerTransport struct { + srv *WatchersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armdatabasewatcher.WatchersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armdatabasewatcher.WatchersClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armdatabasewatcher.WatchersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armdatabasewatcher.WatchersClientListBySubscriptionResponse]] + beginStart *tracker[azfake.PollerResponder[armdatabasewatcher.WatchersClientStartResponse]] + beginStop *tracker[azfake.PollerResponder[armdatabasewatcher.WatchersClientStopResponse]] + beginUpdate *tracker[azfake.PollerResponder[armdatabasewatcher.WatchersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for WatchersServerTransport. +func (w *WatchersServerTransport) 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 w.dispatchToMethodFake(req, method) +} + +func (w *WatchersServerTransport) 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 watchersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = watchersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "WatchersClient.BeginCreateOrUpdate": + res.resp, res.err = w.dispatchBeginCreateOrUpdate(req) + case "WatchersClient.BeginDelete": + res.resp, res.err = w.dispatchBeginDelete(req) + case "WatchersClient.Get": + res.resp, res.err = w.dispatchGet(req) + case "WatchersClient.NewListByResourceGroupPager": + res.resp, res.err = w.dispatchNewListByResourceGroupPager(req) + case "WatchersClient.NewListBySubscriptionPager": + res.resp, res.err = w.dispatchNewListBySubscriptionPager(req) + case "WatchersClient.BeginStart": + res.resp, res.err = w.dispatchBeginStart(req) + case "WatchersClient.BeginStop": + res.resp, res.err = w.dispatchBeginStop(req) + case "WatchersClient.BeginUpdate": + res.resp, res.err = w.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 (w *WatchersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if w.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := w.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?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[armdatabasewatcher.Watcher](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, watcherNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + w.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) { + w.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) { + w.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (w *WatchersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if w.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := w.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginDelete(req.Context(), resourceGroupNameParam, watcherNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + w.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + w.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + w.beginDelete.remove(req) + } + + return resp, nil +} + +func (w *WatchersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if w.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, watcherNameParam, 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).Watcher, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (w *WatchersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if w.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := w.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers` + 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 := w.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + w.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armdatabasewatcher.WatchersClientListByResourceGroupResponse, 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) { + w.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + w.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (w *WatchersServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if w.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := w.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers` + 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 := w.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + w.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armdatabasewatcher.WatchersClientListBySubscriptionResponse, 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) { + w.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + w.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (w *WatchersServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { + if w.srv.BeginStart == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} + } + beginStart := w.beginStart.get(req) + if beginStart == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` + 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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginStart(req.Context(), resourceGroupNameParam, watcherNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginStart = &respr + w.beginStart.add(req, beginStart) + } + + resp, err := server.PollerResponderNext(beginStart, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + w.beginStart.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(beginStart) { + w.beginStart.remove(req) + } + + return resp, nil +} + +func (w *WatchersServerTransport) dispatchBeginStop(req *http.Request) (*http.Response, error) { + if w.srv.BeginStop == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginStop not implemented")} + } + beginStop := w.beginStop.get(req) + if beginStop == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` + 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 + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginStop(req.Context(), resourceGroupNameParam, watcherNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginStop = &respr + w.beginStop.add(req, beginStop) + } + + resp, err := server.PollerResponderNext(beginStop, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + w.beginStop.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(beginStop) { + w.beginStop.remove(req) + } + + return resp, nil +} + +func (w *WatchersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if w.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := w.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DatabaseWatcher/watchers/(?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[armdatabasewatcher.WatcherUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + watcherNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("watcherName")]) + if err != nil { + return nil, err + } + respr, errRespr := w.srv.BeginUpdate(req.Context(), resourceGroupNameParam, watcherNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + w.beginUpdate.add(req, beginUpdate) + } + + resp, err := server.PollerResponderNext(beginUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + w.beginUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginUpdate) { + w.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to WatchersServerTransport +var watchersServerTransportInterceptor 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/databasewatcher/armdatabasewatcher/go.mod b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/go.mod new file mode 100644 index 000000000000..c76fad75df0e --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/go.mod @@ -0,0 +1,21 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasewatcher/armdatabasewatcher + +go 1.18 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.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.32.0 // indirect + golang.org/x/net v0.34.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/text v0.21.0 // indirect +) diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/go.sum b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/go.sum new file mode 100644 index 000000000000..065ccc364f39 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/go.sum @@ -0,0 +1,29 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0 h1:g0EZJwz7xkXQiZAI5xi9f3WWFYBlX1CPTrR+NDToRkQ= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.0/go.mod h1:XCW7KnZet0Opnr7HccfUw1PLc4CjHqpcaxW8DHklNkQ= +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.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +golang.org/x/crypto v0.32.0 h1:euUpcYgM8WcP71gNpTqQCn6rC2t6ULUPiOzfWaXVVfc= +golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= +golang.org/x/net v0.34.0 h1:Mb7Mrk043xzHgnRM88suvJFwzVrRfHEHJEl5/71CKw0= +golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/healthvalidations_client.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/healthvalidations_client.go new file mode 100644 index 000000000000..ed29bb62d291 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/healthvalidations_client.go @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher + +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" +) + +// HealthValidationsClient contains the methods for the HealthValidations group. +// Don't use this type directly, use NewHealthValidationsClient() instead. +type HealthValidationsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewHealthValidationsClient creates a new instance of HealthValidationsClient 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 NewHealthValidationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*HealthValidationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &HealthValidationsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a HealthValidation +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - healthValidationName - The health validation resource name. +// - options - HealthValidationsClientGetOptions contains the optional parameters for the HealthValidationsClient.Get method. +func (client *HealthValidationsClient) Get(ctx context.Context, resourceGroupName string, watcherName string, healthValidationName string, options *HealthValidationsClientGetOptions) (HealthValidationsClientGetResponse, error) { + var err error + const operationName = "HealthValidationsClient.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, watcherName, healthValidationName, options) + if err != nil { + return HealthValidationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return HealthValidationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return HealthValidationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *HealthValidationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, healthValidationName string, _ *HealthValidationsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + if healthValidationName == "" { + return nil, errors.New("parameter healthValidationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{healthValidationName}", url.PathEscape(healthValidationName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *HealthValidationsClient) getHandleResponse(resp *http.Response) (HealthValidationsClientGetResponse, error) { + result := HealthValidationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HealthValidation); err != nil { + return HealthValidationsClientGetResponse{}, err + } + return result, nil +} + +// NewListByParentPager - List HealthValidation resources by Watcher +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - options - HealthValidationsClientListByParentOptions contains the optional parameters for the HealthValidationsClient.NewListByParentPager +// method. +func (client *HealthValidationsClient) NewListByParentPager(resourceGroupName string, watcherName string, options *HealthValidationsClientListByParentOptions) *runtime.Pager[HealthValidationsClientListByParentResponse] { + return runtime.NewPager(runtime.PagingHandler[HealthValidationsClientListByParentResponse]{ + More: func(page HealthValidationsClientListByParentResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *HealthValidationsClientListByParentResponse) (HealthValidationsClientListByParentResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "HealthValidationsClient.NewListByParentPager") + 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.listByParentCreateRequest(ctx, resourceGroupName, watcherName, options) + }, nil) + if err != nil { + return HealthValidationsClientListByParentResponse{}, err + } + return client.listByParentHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByParentCreateRequest creates the ListByParent request. +func (client *HealthValidationsClient) listByParentCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, _ *HealthValidationsClientListByParentOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByParentHandleResponse handles the ListByParent response. +func (client *HealthValidationsClient) listByParentHandleResponse(resp *http.Response) (HealthValidationsClientListByParentResponse, error) { + result := HealthValidationsClientListByParentResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.HealthValidationListResult); err != nil { + return HealthValidationsClientListByParentResponse{}, err + } + return result, nil +} + +// BeginStartValidation - Starts health validation for a watcher. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - healthValidationName - The health validation resource name. +// - options - HealthValidationsClientBeginStartValidationOptions contains the optional parameters for the HealthValidationsClient.BeginStartValidation +// method. +func (client *HealthValidationsClient) BeginStartValidation(ctx context.Context, resourceGroupName string, watcherName string, healthValidationName string, options *HealthValidationsClientBeginStartValidationOptions) (*runtime.Poller[HealthValidationsClientStartValidationResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.startValidation(ctx, resourceGroupName, watcherName, healthValidationName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[HealthValidationsClientStartValidationResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[HealthValidationsClientStartValidationResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// StartValidation - Starts health validation for a watcher. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +func (client *HealthValidationsClient) startValidation(ctx context.Context, resourceGroupName string, watcherName string, healthValidationName string, options *HealthValidationsClientBeginStartValidationOptions) (*http.Response, error) { + var err error + const operationName = "HealthValidationsClient.BeginStartValidation" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.startValidationCreateRequest(ctx, resourceGroupName, watcherName, healthValidationName, 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 +} + +// startValidationCreateRequest creates the StartValidation request. +func (client *HealthValidationsClient) startValidationCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, healthValidationName string, _ *HealthValidationsClientBeginStartValidationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName}/startValidation" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + if healthValidationName == "" { + return nil, errors.New("parameter healthValidationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{healthValidationName}", url.PathEscape(healthValidationName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/healthvalidations_client_example_test.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/healthvalidations_client_example_test.go new file mode 100644 index 000000000000..f721a6d8e59f --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/healthvalidations_client_example_test.go @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasewatcher/armdatabasewatcher" + "log" +) + +// Generated from example definition: 2025-01-02/HealthValidations_Get_MaximumSet_Gen.json +func ExampleHealthValidationsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewHealthValidationsClient().Get(ctx, "rgWatcher", "testWatcher", "testHealthValidation", 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 = armdatabasewatcher.HealthValidationsClientGetResponse{ + // HealthValidation: &armdatabasewatcher.HealthValidation{ + // Properties: &armdatabasewatcher.HealthValidationProperties{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-07T19:42:55.594Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-07T19:42:55.594Z"); return t}()), + // Status: to.Ptr(armdatabasewatcher.ValidationStatusSucceeded), + // Issues: []*armdatabasewatcher.ValidationIssue{ + // { + // ErrorCode: to.Ptr("ReadDatasetError"), + // ErrorMessage: to.Ptr("Invalid operation. The connection is closed."), + // AdditionalDetails: to.Ptr("There seems to be a connection issue."), + // RecommendationMessage: to.Ptr("Please check the connection."), + // RecommendationURL: to.Ptr("https://aka.ms/issuerecommendation"), + // RelatedResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/test-setup/providers/Microsoft.Sql/servers/test-setup/databases/test-1"), + // RelatedResourceType: to.Ptr("Microsoft.Sql/servers"), + // }, + // }, + // ProvisioningState: to.Ptr(armdatabasewatcher.ResourceProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/rgWatcher/providers/microsoft.databasewatcher/watchers/testWatcher/healthValidations/testHealthValidation"), + // Name: to.Ptr("testHealthValidation"), + // Type: to.Ptr("microsoft.databasewatcher/watchers/healthValidations"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-02/HealthValidations_ListByParent_MaximumSet_Gen.json +func ExampleHealthValidationsClient_NewListByParentPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewHealthValidationsClient().NewListByParentPager("rgWatcher", "testWatcher", 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 = armdatabasewatcher.HealthValidationsClientListByParentResponse{ + // HealthValidationListResult: armdatabasewatcher.HealthValidationListResult{ + // Value: []*armdatabasewatcher.HealthValidation{ + // { + // Properties: &armdatabasewatcher.HealthValidationProperties{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-07T19:42:55.594Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-07T19:42:55.594Z"); return t}()), + // Status: to.Ptr(armdatabasewatcher.ValidationStatusSucceeded), + // Issues: []*armdatabasewatcher.ValidationIssue{ + // { + // ErrorCode: to.Ptr("ReadDatasetError"), + // ErrorMessage: to.Ptr("Invalid operation. The connection is closed."), + // AdditionalDetails: to.Ptr("There seems to be a connection issue."), + // RecommendationMessage: to.Ptr("Please check the connection."), + // RecommendationURL: to.Ptr("https://aka.ms/issuerecommendation"), + // RelatedResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/test-setup/providers/Microsoft.Sql/servers/test-setup/databases/test-1"), + // RelatedResourceType: to.Ptr("Microsoft.Sql/servers"), + // }, + // }, + // ProvisioningState: to.Ptr(armdatabasewatcher.ResourceProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/rgWatcher/providers/microsoft.databasewatcher/watchers/testWatcher/healthValidations/testHealthValidation"), + // Name: to.Ptr("testHealthValidation"), + // Type: to.Ptr("microsoft.databasewatcher/watchers/healthValidations"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2025-01-02/HealthValidations_StartValidation_MaximumSet_Gen.json +func ExampleHealthValidationsClient_BeginStartValidation() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewHealthValidationsClient().BeginStartValidation(ctx, "rgWatcher", "testWatcher", "testHealthValidation", 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 = armdatabasewatcher.HealthValidationsClientStartValidationResponse{ + // HealthValidation: &armdatabasewatcher.HealthValidation{ + // Properties: &armdatabasewatcher.HealthValidationProperties{ + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-07T19:42:55.594Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-10-07T19:42:55.594Z"); return t}()), + // Status: to.Ptr(armdatabasewatcher.ValidationStatusRunning), + // Issues: []*armdatabasewatcher.ValidationIssue{ + // }, + // }, + // ID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/rgWatcher/providers/microsoft.databasewatcher/watchers/testWatcher/healthValidations/testHealthValidation"), + // Name: to.Ptr("testHealthValidation"), + // Type: to.Ptr("microsoft.databasewatcher/watchers/healthValidations"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/interfaces.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/interfaces.go new file mode 100644 index 000000000000..19fec6f8296b --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/interfaces.go @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armdatabasewatcher + +// TargetPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetTargetProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *SQLDbElasticPoolTargetProperties, *SQLDbSingleDatabaseTargetProperties, *SQLMiTargetProperties, *TargetProperties +type TargetPropertiesClassification interface { + // GetTargetProperties returns the TargetProperties content of the underlying type. + GetTargetProperties() *TargetProperties +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/models.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/models.go new file mode 100644 index 000000000000..000a4d2e0879 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/models.go @@ -0,0 +1,554 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher + +import "time" + +// AlertRuleResource - Concrete proxy resource types can be created by aliasing this type using a specific property type. +type AlertRuleResource struct { + // The resource-specific properties for this resource. + Properties *AlertRuleResourceProperties + + // READ-ONLY; The alert rule proxy resource name. + 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 +} + +// AlertRuleResourceListResult - The response of a AlertRuleResource list operation. +type AlertRuleResourceListResult struct { + // REQUIRED; The AlertRuleResource items on this page + Value []*AlertRuleResource + + // The link to the next page of items + NextLink *string +} + +// AlertRuleResourceProperties - The generic properties of the alert rule proxy resource. +type AlertRuleResourceProperties struct { + // REQUIRED; The resource ID of the alert rule resource. + AlertRuleResourceID *string + + // REQUIRED; The template ID associated with alert rule resource. + AlertRuleTemplateID *string + + // REQUIRED; The alert rule template version. + AlertRuleTemplateVersion *string + + // REQUIRED; The properties with which the alert rule resource was created. + CreatedWithProperties *AlertRuleCreationProperties + + // REQUIRED; The creation time of the alert rule resource. + CreationTime *time.Time + + // READ-ONLY; The provisioning state of the alert rule resource. + ProvisioningState *ResourceProvisioningState +} + +// Datastore - The properties of a data store. +type Datastore struct { + // REQUIRED; The Kusto cluster URI. + KustoClusterURI *string + + // REQUIRED; The Kusto data ingestion URI. + KustoDataIngestionURI *string + + // REQUIRED; The name of a Kusto database. + KustoDatabaseName *string + + // REQUIRED; The Kusto management URL. + KustoManagementURL *string + + // REQUIRED; The type of a Kusto offering. + KustoOfferingType *KustoOfferingType + + // The Azure resource ID of an Azure Data Explorer cluster. + AdxClusterResourceID *string + + // The Kusto cluster display name. + KustoClusterDisplayName *string +} + +// HealthValidation - Concrete proxy resource types can be created by aliasing this type using a specific property type. +type HealthValidation struct { + // The resource-specific properties for this resource. + Properties *HealthValidationProperties + + // READ-ONLY; The health validation resource name. + 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 +} + +// HealthValidationListResult - The response of a HealthValidation list operation. +type HealthValidationListResult struct { + // REQUIRED; The HealthValidation items on this page + Value []*HealthValidation + + // The link to the next page of items + NextLink *string +} + +// HealthValidationProperties - The generic properties of the health validation resource. +type HealthValidationProperties struct { + // READ-ONLY; The end time of health validation, in UTC. + EndTime *time.Time + + // READ-ONLY; The list of issues found by health validation. + Issues []*ValidationIssue + + // READ-ONLY; The start time of health validation, in UTC. + StartTime *time.Time + + // READ-ONLY; The current health validation status. + Status *ValidationStatus + + // READ-ONLY; The provisioning state of the health validation resource. + ProvisioningState *ResourceProvisioningState +} + +// ManagedServiceIdentityV4 - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentityV4 struct { + // REQUIRED; The type of managed identity assigned to this resource. + Type *ManagedServiceIdentityType + + // The identities assigned to this resource by the user. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Extensible 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 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 +} + +// SQLDbElasticPoolTargetProperties - The properties specific to an elastic pool in Azure SQL Database. +type SQLDbElasticPoolTargetProperties struct { + // REQUIRED; The Azure resource ID of the anchor database used to connect to an elastic pool. + AnchorDatabaseResourceID *string + + // REQUIRED; The FQDN host name of the server to use in the connection string when connecting to a target. For example, for + // an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; + // for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. + // Port number and instance name must be specified separately. + ConnectionServerName *string + + // REQUIRED; The Azure resource ID of an Azure SQL DB elastic pool target. + SQLEpResourceID *string + + // REQUIRED; The type of authentication to use when connecting to a target. + TargetAuthenticationType *TargetAuthenticationType + + // CONSTANT; The Azure SQL DB elastic pool target. + // Field has constant value "SqlEp", any specified value is ignored. + TargetType *string + + // Set to true to monitor a high availability replica of specified target, if any. + ReadIntent *bool + + // To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + TargetVault *VaultSecret + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ResourceProvisioningState +} + +// GetTargetProperties implements the TargetPropertiesClassification interface for type SQLDbElasticPoolTargetProperties. +func (s *SQLDbElasticPoolTargetProperties) GetTargetProperties() *TargetProperties { + return &TargetProperties{ + ConnectionServerName: s.ConnectionServerName, + ProvisioningState: s.ProvisioningState, + TargetAuthenticationType: s.TargetAuthenticationType, + TargetType: s.TargetType, + TargetVault: s.TargetVault, + } +} + +// SQLDbSingleDatabaseTargetProperties - The properties specific to a database in Azure SQL Database. +type SQLDbSingleDatabaseTargetProperties struct { + // REQUIRED; The FQDN host name of the server to use in the connection string when connecting to a target. For example, for + // an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; + // for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. + // Port number and instance name must be specified separately. + ConnectionServerName *string + + // REQUIRED; The Azure resource ID of an Azure SQL DB database target. + SQLDbResourceID *string + + // REQUIRED; The type of authentication to use when connecting to a target. + TargetAuthenticationType *TargetAuthenticationType + + // CONSTANT; The Azure SQL DB single database target. + // Field has constant value "SqlDb", any specified value is ignored. + TargetType *string + + // Set to true to monitor a high availability replica of specified target, if any. + ReadIntent *bool + + // To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + TargetVault *VaultSecret + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ResourceProvisioningState +} + +// GetTargetProperties implements the TargetPropertiesClassification interface for type SQLDbSingleDatabaseTargetProperties. +func (s *SQLDbSingleDatabaseTargetProperties) GetTargetProperties() *TargetProperties { + return &TargetProperties{ + ConnectionServerName: s.ConnectionServerName, + ProvisioningState: s.ProvisioningState, + TargetAuthenticationType: s.TargetAuthenticationType, + TargetType: s.TargetType, + TargetVault: s.TargetVault, + } +} + +// SQLMiTargetProperties - The properties specific to Azure SQL Managed Instance targets. +type SQLMiTargetProperties struct { + // REQUIRED; The FQDN host name of the server to use in the connection string when connecting to a target. For example, for + // an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; + // for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. + // Port number and instance name must be specified separately. + ConnectionServerName *string + + // REQUIRED; The Azure resource ID of an Azure SQL Managed Instance target. + SQLMiResourceID *string + + // REQUIRED; The type of authentication to use when connecting to a target. + TargetAuthenticationType *TargetAuthenticationType + + // CONSTANT; The Azure SQL Managed Instance target. + // Field has constant value "SqlMi", any specified value is ignored. + TargetType *string + + // The TCP port number to optionally use in the connection string when connecting to an Azure SQL Managed Instance target. + ConnectionTCPPort *int32 + + // Set to true to monitor a high availability replica of specified target, if any. + ReadIntent *bool + + // To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + TargetVault *VaultSecret + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ResourceProvisioningState +} + +// GetTargetProperties implements the TargetPropertiesClassification interface for type SQLMiTargetProperties. +func (s *SQLMiTargetProperties) GetTargetProperties() *TargetProperties { + return &TargetProperties{ + ConnectionServerName: s.ConnectionServerName, + ProvisioningState: s.ProvisioningState, + TargetAuthenticationType: s.TargetAuthenticationType, + TargetType: s.TargetType, + TargetVault: s.TargetVault, + } +} + +// SharedPrivateLinkResource - Concrete proxy resource types can be created by aliasing this type using a specific property +// type. +type SharedPrivateLinkResource struct { + // The resource-specific properties for this resource. + Properties *SharedPrivateLinkResourceProperties + + // READ-ONLY; The Shared Private Link resource name. + 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 +} + +// SharedPrivateLinkResourceListResult - The response of a SharedPrivateLinkResource list operation. +type SharedPrivateLinkResourceListResult struct { + // REQUIRED; The SharedPrivateLinkResource items on this page + Value []*SharedPrivateLinkResource + + // The link to the next page of items + NextLink *string +} + +// SharedPrivateLinkResourceProperties - The generic properties of a Shared Private Link resource. +type SharedPrivateLinkResourceProperties struct { + // REQUIRED; The group id from the provider of resource the shared private link resource is for. + GroupID *string + + // REQUIRED; The resource ID of the resource the shared private link resource is for. + PrivateLinkResourceID *string + + // REQUIRED; The request message for requesting approval of the shared private link resource. + RequestMessage *string + + // The DNS zone segment to be included in the DNS name of the shared private link. Value is required for Azure Data Explorer + // clusters and SQL managed instances, and must be omitted for SQL logical servers and key vaults. The value is the second + // segment of the host FQDN name of the resource that the shared private link resource is for. For example: if the host name + // is 'adx-cluster-21187695.eastus.kusto.windows.net', then the value is 'eastus'; if the host name is 'sql-mi-23961134.767d5869f605.database.windows.net', + // then the value is '767d5869f605'. + DNSZone *string + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ResourceProvisioningState + + // READ-ONLY; Status of the shared private link resource. Can be Pending, Approved, Rejected or Disconnected. + Status *SharedPrivateLinkResourceStatus +} + +// 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 +} + +// Target - Concrete proxy resource types can be created by aliasing this type using a specific property type. +type Target struct { + // The resource-specific properties for this resource. + Properties TargetPropertiesClassification + + // READ-ONLY; The target resource name. + 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 +} + +// TargetListResult - The response of a Target list operation. +type TargetListResult struct { + // REQUIRED; The Target items on this page + Value []*Target + + // The link to the next page of items + NextLink *string +} + +// TargetProperties - The generic properties of a target. +type TargetProperties struct { + // REQUIRED; The FQDN host name of the server to use in the connection string when connecting to a target. For example, for + // an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; + // for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. + // Port number and instance name must be specified separately. + ConnectionServerName *string + + // REQUIRED; The type of authentication to use when connecting to a target. + TargetAuthenticationType *TargetAuthenticationType + + // REQUIRED; Discriminator property for TargetProperties. + TargetType *string + + // To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + TargetVault *VaultSecret + + // READ-ONLY; The provisioning state of the resource. + ProvisioningState *ResourceProvisioningState +} + +// GetTargetProperties implements the TargetPropertiesClassification interface for type TargetProperties. +func (t *TargetProperties) GetTargetProperties() *TargetProperties { return t } + +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} + +// ValidationIssue - The model of a health validation issue. +type ValidationIssue struct { + // READ-ONLY; The error code of the issue. + ErrorCode *string + + // READ-ONLY; The error message of the issue. + ErrorMessage *string + + // READ-ONLY; The recommendation for resolving the issue. + RecommendationMessage *string + + // READ-ONLY; The additional details for the issue. + AdditionalDetails *string + + // READ-ONLY; The URL related to resolving the issue. + RecommendationURL *string + + // READ-ONLY; The resource ID of the Azure resource related to the issue. + RelatedResourceID *string + + // READ-ONLY; The type of the Azure resource related to the issue. + RelatedResourceType *string +} + +// VaultSecret - The vault specific details required if using SQL authentication to connect to a target. +type VaultSecret struct { + // The Azure resource ID of the Key Vault instance storing database authentication secrets. + AkvResourceID *string + + // The path to the Key Vault secret storing the password for authentication to a target. + AkvTargetPassword *string + + // The path to the Key Vault secret storing the login name (aka user name, aka account name) for authentication to a target. + AkvTargetUser *string +} + +// Watcher - The DatabaseWatcherProviderHub resource. +type Watcher struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // READ-ONLY; The database watcher name. + Name *string + + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentityV4 + + // The resource-specific properties for this resource. + Properties *WatcherProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; 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 +} + +// WatcherListResult - The response of a Watcher list operation. +type WatcherListResult struct { + // REQUIRED; The Watcher items on this page + Value []*Watcher + + // The link to the next page of items + NextLink *string +} + +// WatcherProperties - The RP specific properties of the resource. +type WatcherProperties struct { + // The data store for collected monitoring data. + Datastore *Datastore + + // The resource ID of a user-assigned managed identity that will be assigned to a new alert rule. + DefaultAlertRuleIdentityResourceID *string + + // READ-ONLY; The provisioning state of the resource watcher. + ProvisioningState *ProvisioningState + + // READ-ONLY; The monitoring collection status of the watcher. + Status *WatcherStatus +} + +// WatcherUpdate - The type used for update operations of the Watcher. +type WatcherUpdate struct { + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentityV4 + + // The resource-specific properties for this resource. + Properties *WatcherUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// WatcherUpdateProperties - The updatable properties of the Watcher. +type WatcherUpdateProperties struct { + // The data store for collected monitoring data. + Datastore *Datastore + + // The resource ID of a user-assigned managed identity that will be assigned to a new alert rule. + DefaultAlertRuleIdentityResourceID *string +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/models_serde.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/models_serde.go new file mode 100644 index 000000000000..e456d6003a7a --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/models_serde.go @@ -0,0 +1,1227 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AlertRuleResource. +func (a AlertRuleResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleResource. +func (a *AlertRuleResource) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + 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 AlertRuleResourceListResult. +func (a AlertRuleResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleResourceListResult. +func (a *AlertRuleResourceListResult) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + 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 AlertRuleResourceProperties. +func (a AlertRuleResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "alertRuleResourceId", a.AlertRuleResourceID) + populate(objectMap, "alertRuleTemplateId", a.AlertRuleTemplateID) + populate(objectMap, "alertRuleTemplateVersion", a.AlertRuleTemplateVersion) + populate(objectMap, "createdWithProperties", a.CreatedWithProperties) + populateDateTimeRFC3339(objectMap, "creationTime", a.CreationTime) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertRuleResourceProperties. +func (a *AlertRuleResourceProperties) UnmarshalJSON(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 "alertRuleResourceId": + err = unpopulate(val, "AlertRuleResourceID", &a.AlertRuleResourceID) + delete(rawMsg, key) + case "alertRuleTemplateId": + err = unpopulate(val, "AlertRuleTemplateID", &a.AlertRuleTemplateID) + delete(rawMsg, key) + case "alertRuleTemplateVersion": + err = unpopulate(val, "AlertRuleTemplateVersion", &a.AlertRuleTemplateVersion) + delete(rawMsg, key) + case "createdWithProperties": + err = unpopulate(val, "CreatedWithProperties", &a.CreatedWithProperties) + delete(rawMsg, key) + case "creationTime": + err = unpopulateDateTimeRFC3339(val, "CreationTime", &a.CreationTime) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + 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 Datastore. +func (d Datastore) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adxClusterResourceId", d.AdxClusterResourceID) + populate(objectMap, "kustoClusterDisplayName", d.KustoClusterDisplayName) + populate(objectMap, "kustoClusterUri", d.KustoClusterURI) + populate(objectMap, "kustoDataIngestionUri", d.KustoDataIngestionURI) + populate(objectMap, "kustoDatabaseName", d.KustoDatabaseName) + populate(objectMap, "kustoManagementUrl", d.KustoManagementURL) + populate(objectMap, "kustoOfferingType", d.KustoOfferingType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Datastore. +func (d *Datastore) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "adxClusterResourceId": + err = unpopulate(val, "AdxClusterResourceID", &d.AdxClusterResourceID) + delete(rawMsg, key) + case "kustoClusterDisplayName": + err = unpopulate(val, "KustoClusterDisplayName", &d.KustoClusterDisplayName) + delete(rawMsg, key) + case "kustoClusterUri": + err = unpopulate(val, "KustoClusterURI", &d.KustoClusterURI) + delete(rawMsg, key) + case "kustoDataIngestionUri": + err = unpopulate(val, "KustoDataIngestionURI", &d.KustoDataIngestionURI) + delete(rawMsg, key) + case "kustoDatabaseName": + err = unpopulate(val, "KustoDatabaseName", &d.KustoDatabaseName) + delete(rawMsg, key) + case "kustoManagementUrl": + err = unpopulate(val, "KustoManagementURL", &d.KustoManagementURL) + delete(rawMsg, key) + case "kustoOfferingType": + err = unpopulate(val, "KustoOfferingType", &d.KustoOfferingType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HealthValidation. +func (h HealthValidation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", h.ID) + populate(objectMap, "name", h.Name) + populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) + populate(objectMap, "type", h.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HealthValidation. +func (h *HealthValidation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &h.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &h.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &h.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &h.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HealthValidationListResult. +func (h HealthValidationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", h.NextLink) + populate(objectMap, "value", h.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HealthValidationListResult. +func (h *HealthValidationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &h.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &h.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HealthValidationProperties. +func (h HealthValidationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "endTime", h.EndTime) + populate(objectMap, "issues", h.Issues) + populate(objectMap, "provisioningState", h.ProvisioningState) + populateDateTimeRFC3339(objectMap, "startTime", h.StartTime) + populate(objectMap, "status", h.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HealthValidationProperties. +func (h *HealthValidationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &h.EndTime) + delete(rawMsg, key) + case "issues": + err = unpopulate(val, "Issues", &h.Issues) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &h.ProvisioningState) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &h.StartTime) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &h.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentityV4. +func (m ManagedServiceIdentityV4) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentityV4. +func (m *ManagedServiceIdentityV4) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLDbElasticPoolTargetProperties. +func (s SQLDbElasticPoolTargetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "anchorDatabaseResourceId", s.AnchorDatabaseResourceID) + populate(objectMap, "connectionServerName", s.ConnectionServerName) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "readIntent", s.ReadIntent) + populate(objectMap, "sqlEpResourceId", s.SQLEpResourceID) + populate(objectMap, "targetAuthenticationType", s.TargetAuthenticationType) + objectMap["targetType"] = "SqlEp" + populate(objectMap, "targetVault", s.TargetVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDbElasticPoolTargetProperties. +func (s *SQLDbElasticPoolTargetProperties) UnmarshalJSON(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 "anchorDatabaseResourceId": + err = unpopulate(val, "AnchorDatabaseResourceID", &s.AnchorDatabaseResourceID) + delete(rawMsg, key) + case "connectionServerName": + err = unpopulate(val, "ConnectionServerName", &s.ConnectionServerName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "readIntent": + err = unpopulate(val, "ReadIntent", &s.ReadIntent) + delete(rawMsg, key) + case "sqlEpResourceId": + err = unpopulate(val, "SQLEpResourceID", &s.SQLEpResourceID) + delete(rawMsg, key) + case "targetAuthenticationType": + err = unpopulate(val, "TargetAuthenticationType", &s.TargetAuthenticationType) + delete(rawMsg, key) + case "targetType": + err = unpopulate(val, "TargetType", &s.TargetType) + delete(rawMsg, key) + case "targetVault": + err = unpopulate(val, "TargetVault", &s.TargetVault) + 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 SQLDbSingleDatabaseTargetProperties. +func (s SQLDbSingleDatabaseTargetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionServerName", s.ConnectionServerName) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "readIntent", s.ReadIntent) + populate(objectMap, "sqlDbResourceId", s.SQLDbResourceID) + populate(objectMap, "targetAuthenticationType", s.TargetAuthenticationType) + objectMap["targetType"] = "SqlDb" + populate(objectMap, "targetVault", s.TargetVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDbSingleDatabaseTargetProperties. +func (s *SQLDbSingleDatabaseTargetProperties) UnmarshalJSON(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 "connectionServerName": + err = unpopulate(val, "ConnectionServerName", &s.ConnectionServerName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "readIntent": + err = unpopulate(val, "ReadIntent", &s.ReadIntent) + delete(rawMsg, key) + case "sqlDbResourceId": + err = unpopulate(val, "SQLDbResourceID", &s.SQLDbResourceID) + delete(rawMsg, key) + case "targetAuthenticationType": + err = unpopulate(val, "TargetAuthenticationType", &s.TargetAuthenticationType) + delete(rawMsg, key) + case "targetType": + err = unpopulate(val, "TargetType", &s.TargetType) + delete(rawMsg, key) + case "targetVault": + err = unpopulate(val, "TargetVault", &s.TargetVault) + 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 SQLMiTargetProperties. +func (s SQLMiTargetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionServerName", s.ConnectionServerName) + populate(objectMap, "connectionTcpPort", s.ConnectionTCPPort) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "readIntent", s.ReadIntent) + populate(objectMap, "sqlMiResourceId", s.SQLMiResourceID) + populate(objectMap, "targetAuthenticationType", s.TargetAuthenticationType) + objectMap["targetType"] = "SqlMi" + populate(objectMap, "targetVault", s.TargetVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLMiTargetProperties. +func (s *SQLMiTargetProperties) UnmarshalJSON(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 "connectionServerName": + err = unpopulate(val, "ConnectionServerName", &s.ConnectionServerName) + delete(rawMsg, key) + case "connectionTcpPort": + err = unpopulate(val, "ConnectionTCPPort", &s.ConnectionTCPPort) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "readIntent": + err = unpopulate(val, "ReadIntent", &s.ReadIntent) + delete(rawMsg, key) + case "sqlMiResourceId": + err = unpopulate(val, "SQLMiResourceID", &s.SQLMiResourceID) + delete(rawMsg, key) + case "targetAuthenticationType": + err = unpopulate(val, "TargetAuthenticationType", &s.TargetAuthenticationType) + delete(rawMsg, key) + case "targetType": + err = unpopulate(val, "TargetType", &s.TargetType) + delete(rawMsg, key) + case "targetVault": + err = unpopulate(val, "TargetVault", &s.TargetVault) + 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 SharedPrivateLinkResource. +func (s SharedPrivateLinkResource) 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 SharedPrivateLinkResource. +func (s *SharedPrivateLinkResource) UnmarshalJSON(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 SharedPrivateLinkResourceListResult. +func (s SharedPrivateLinkResourceListResult) 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 SharedPrivateLinkResourceListResult. +func (s *SharedPrivateLinkResourceListResult) UnmarshalJSON(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 SharedPrivateLinkResourceProperties. +func (s SharedPrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dnsZone", s.DNSZone) + populate(objectMap, "groupId", s.GroupID) + populate(objectMap, "privateLinkResourceId", s.PrivateLinkResourceID) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "requestMessage", s.RequestMessage) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SharedPrivateLinkResourceProperties. +func (s *SharedPrivateLinkResourceProperties) UnmarshalJSON(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 "dnsZone": + err = unpopulate(val, "DNSZone", &s.DNSZone) + delete(rawMsg, key) + case "groupId": + err = unpopulate(val, "GroupID", &s.GroupID) + delete(rawMsg, key) + case "privateLinkResourceId": + err = unpopulate(val, "PrivateLinkResourceID", &s.PrivateLinkResourceID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "requestMessage": + err = unpopulate(val, "RequestMessage", &s.RequestMessage) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + 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 Target. +func (t Target) 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 Target. +func (t *Target) UnmarshalJSON(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": + t.Properties, err = unmarshalTargetPropertiesClassification(val) + 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 TargetListResult. +func (t TargetListResult) 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 TargetListResult. +func (t *TargetListResult) UnmarshalJSON(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 TargetProperties. +func (t TargetProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectionServerName", t.ConnectionServerName) + populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "targetAuthenticationType", t.TargetAuthenticationType) + populate(objectMap, "targetType", t.TargetType) + populate(objectMap, "targetVault", t.TargetVault) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TargetProperties. +func (t *TargetProperties) UnmarshalJSON(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 "connectionServerName": + err = unpopulate(val, "ConnectionServerName", &t.ConnectionServerName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + case "targetAuthenticationType": + err = unpopulate(val, "TargetAuthenticationType", &t.TargetAuthenticationType) + delete(rawMsg, key) + case "targetType": + err = unpopulate(val, "TargetType", &t.TargetType) + delete(rawMsg, key) + case "targetVault": + err = unpopulate(val, "TargetVault", &t.TargetVault) + 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 UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(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 "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + 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 ValidationIssue. +func (v ValidationIssue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalDetails", v.AdditionalDetails) + populate(objectMap, "errorCode", v.ErrorCode) + populate(objectMap, "errorMessage", v.ErrorMessage) + populate(objectMap, "recommendationMessage", v.RecommendationMessage) + populate(objectMap, "recommendationUrl", v.RecommendationURL) + populate(objectMap, "relatedResourceId", v.RelatedResourceID) + populate(objectMap, "relatedResourceType", v.RelatedResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ValidationIssue. +func (v *ValidationIssue) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalDetails": + err = unpopulate(val, "AdditionalDetails", &v.AdditionalDetails) + delete(rawMsg, key) + case "errorCode": + err = unpopulate(val, "ErrorCode", &v.ErrorCode) + delete(rawMsg, key) + case "errorMessage": + err = unpopulate(val, "ErrorMessage", &v.ErrorMessage) + delete(rawMsg, key) + case "recommendationMessage": + err = unpopulate(val, "RecommendationMessage", &v.RecommendationMessage) + delete(rawMsg, key) + case "recommendationUrl": + err = unpopulate(val, "RecommendationURL", &v.RecommendationURL) + delete(rawMsg, key) + case "relatedResourceId": + err = unpopulate(val, "RelatedResourceID", &v.RelatedResourceID) + delete(rawMsg, key) + case "relatedResourceType": + err = unpopulate(val, "RelatedResourceType", &v.RelatedResourceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaultSecret. +func (v VaultSecret) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "akvResourceId", v.AkvResourceID) + populate(objectMap, "akvTargetPassword", v.AkvTargetPassword) + populate(objectMap, "akvTargetUser", v.AkvTargetUser) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultSecret. +func (v *VaultSecret) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "akvResourceId": + err = unpopulate(val, "AkvResourceID", &v.AkvResourceID) + delete(rawMsg, key) + case "akvTargetPassword": + err = unpopulate(val, "AkvTargetPassword", &v.AkvTargetPassword) + delete(rawMsg, key) + case "akvTargetUser": + err = unpopulate(val, "AkvTargetUser", &v.AkvTargetUser) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Watcher. +func (w Watcher) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", w.ID) + populate(objectMap, "identity", w.Identity) + populate(objectMap, "location", w.Location) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) + populate(objectMap, "tags", w.Tags) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Watcher. +func (w *Watcher) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &w.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &w.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WatcherListResult. +func (w WatcherListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WatcherListResult. +func (w *WatcherListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WatcherProperties. +func (w WatcherProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "datastore", w.Datastore) + populate(objectMap, "defaultAlertRuleIdentityResourceId", w.DefaultAlertRuleIdentityResourceID) + populate(objectMap, "provisioningState", w.ProvisioningState) + populate(objectMap, "status", w.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WatcherProperties. +func (w *WatcherProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "datastore": + err = unpopulate(val, "Datastore", &w.Datastore) + delete(rawMsg, key) + case "defaultAlertRuleIdentityResourceId": + err = unpopulate(val, "DefaultAlertRuleIdentityResourceID", &w.DefaultAlertRuleIdentityResourceID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &w.ProvisioningState) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &w.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WatcherUpdate. +func (w WatcherUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", w.Identity) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "tags", w.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WatcherUpdate. +func (w *WatcherUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, "Identity", &w.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &w.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WatcherUpdateProperties. +func (w WatcherUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "datastore", w.Datastore) + populate(objectMap, "defaultAlertRuleIdentityResourceId", w.DefaultAlertRuleIdentityResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WatcherUpdateProperties. +func (w *WatcherUpdateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "datastore": + err = unpopulate(val, "Datastore", &w.Datastore) + delete(rawMsg, key) + case "defaultAlertRuleIdentityResourceId": + err = unpopulate(val, "DefaultAlertRuleIdentityResourceID", &w.DefaultAlertRuleIdentityResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, 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/databasewatcher/armdatabasewatcher/operations_client.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/operations_client.go new file mode 100644 index 000000000000..d259aa1e4f14 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/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 armdatabasewatcher + +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 2025-01-02 +// - 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.DatabaseWatcher/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", "2025-01-02") + 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/databasewatcher/armdatabasewatcher/operations_client_example_test.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/operations_client_example_test.go new file mode 100644 index 000000000000..622b7c3d1546 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/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 armdatabasewatcher_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasewatcher/armdatabasewatcher" + "log" +) + +// Generated from example definition: 2025-01-02/Operations_List_MaximumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMaximumSet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.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 = armdatabasewatcher.OperationsClientListResponse{ + // OperationListResult: armdatabasewatcher.OperationListResult{ + // Value: []*armdatabasewatcher.Operation{ + // { + // Name: to.Ptr("snzrdvltunnrz"), + // IsDataAction: to.Ptr(true), + // Display: &armdatabasewatcher.OperationDisplay{ + // Provider: to.Ptr("dtfrqzamclscchmghtxn"), + // Resource: to.Ptr("lvlhnsfnquorjuuutjxex"), + // Operation: to.Ptr("vbgvamoxqwthpbdghxzaw"), + // Description: to.Ptr("nvbtuwwjfehylzmoatd"), + // }, + // Origin: to.Ptr(armdatabasewatcher.OriginUser), + // ActionType: to.Ptr(armdatabasewatcher.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/awfba"), + // }, + // } + } +} + +// Generated from example definition: 2025-01-02/Operations_List_MinimumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMinimumSet() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.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 = armdatabasewatcher.OperationsClientListResponse{ + // OperationListResult: armdatabasewatcher.OperationListResult{ + // }, + // } + } +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/options.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/options.go new file mode 100644 index 000000000000..62604d77b938 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/options.go @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher + +// AlertRuleResourcesClientCreateOrUpdateOptions contains the optional parameters for the AlertRuleResourcesClient.CreateOrUpdate +// method. +type AlertRuleResourcesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// AlertRuleResourcesClientDeleteOptions contains the optional parameters for the AlertRuleResourcesClient.Delete method. +type AlertRuleResourcesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AlertRuleResourcesClientGetOptions contains the optional parameters for the AlertRuleResourcesClient.Get method. +type AlertRuleResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// AlertRuleResourcesClientListByParentOptions contains the optional parameters for the AlertRuleResourcesClient.NewListByParentPager +// method. +type AlertRuleResourcesClientListByParentOptions struct { + // placeholder for future optional parameters +} + +// HealthValidationsClientBeginStartValidationOptions contains the optional parameters for the HealthValidationsClient.BeginStartValidation +// method. +type HealthValidationsClientBeginStartValidationOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// HealthValidationsClientGetOptions contains the optional parameters for the HealthValidationsClient.Get method. +type HealthValidationsClientGetOptions struct { + // placeholder for future optional parameters +} + +// HealthValidationsClientListByParentOptions contains the optional parameters for the HealthValidationsClient.NewListByParentPager +// method. +type HealthValidationsClientListByParentOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} + +// SharedPrivateLinkResourcesClientBeginCreateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreate +// method. +type SharedPrivateLinkResourcesClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SharedPrivateLinkResourcesClientBeginDeleteOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginDelete +// method. +type SharedPrivateLinkResourcesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get +// method. +type SharedPrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// SharedPrivateLinkResourcesClientListByWatcherOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListByWatcherPager +// method. +type SharedPrivateLinkResourcesClientListByWatcherOptions struct { + // placeholder for future optional parameters +} + +// TargetsClientCreateOrUpdateOptions contains the optional parameters for the TargetsClient.CreateOrUpdate method. +type TargetsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// TargetsClientDeleteOptions contains the optional parameters for the TargetsClient.Delete method. +type TargetsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// TargetsClientGetOptions contains the optional parameters for the TargetsClient.Get method. +type TargetsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TargetsClientListByWatcherOptions contains the optional parameters for the TargetsClient.NewListByWatcherPager method. +type TargetsClientListByWatcherOptions struct { + // placeholder for future optional parameters +} + +// WatchersClientBeginCreateOrUpdateOptions contains the optional parameters for the WatchersClient.BeginCreateOrUpdate method. +type WatchersClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// WatchersClientBeginDeleteOptions contains the optional parameters for the WatchersClient.BeginDelete method. +type WatchersClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// WatchersClientBeginStartOptions contains the optional parameters for the WatchersClient.BeginStart method. +type WatchersClientBeginStartOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// WatchersClientBeginStopOptions contains the optional parameters for the WatchersClient.BeginStop method. +type WatchersClientBeginStopOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// WatchersClientBeginUpdateOptions contains the optional parameters for the WatchersClient.BeginUpdate method. +type WatchersClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// WatchersClientGetOptions contains the optional parameters for the WatchersClient.Get method. +type WatchersClientGetOptions struct { + // placeholder for future optional parameters +} + +// WatchersClientListByResourceGroupOptions contains the optional parameters for the WatchersClient.NewListByResourceGroupPager +// method. +type WatchersClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// WatchersClientListBySubscriptionOptions contains the optional parameters for the WatchersClient.NewListBySubscriptionPager +// method. +type WatchersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/polymorphic_helpers.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/polymorphic_helpers.go new file mode 100644 index 000000000000..23f16ce00208 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/polymorphic_helpers.go @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher + +import "encoding/json" + +func unmarshalTargetPropertiesClassification(rawMsg json.RawMessage) (TargetPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b TargetPropertiesClassification + switch m["targetType"] { + case "SqlDb": + b = &SQLDbSingleDatabaseTargetProperties{} + case "SqlEp": + b = &SQLDbElasticPoolTargetProperties{} + case "SqlMi": + b = &SQLMiTargetProperties{} + default: + b = &TargetProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/responses.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/responses.go new file mode 100644 index 000000000000..ddd743dc6a42 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/responses.go @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher + +// AlertRuleResourcesClientCreateOrUpdateResponse contains the response from method AlertRuleResourcesClient.CreateOrUpdate. +type AlertRuleResourcesClientCreateOrUpdateResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + AlertRuleResource +} + +// AlertRuleResourcesClientDeleteResponse contains the response from method AlertRuleResourcesClient.Delete. +type AlertRuleResourcesClientDeleteResponse struct { + // placeholder for future response values +} + +// AlertRuleResourcesClientGetResponse contains the response from method AlertRuleResourcesClient.Get. +type AlertRuleResourcesClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + AlertRuleResource +} + +// AlertRuleResourcesClientListByParentResponse contains the response from method AlertRuleResourcesClient.NewListByParentPager. +type AlertRuleResourcesClientListByParentResponse struct { + // The response of a AlertRuleResource list operation. + AlertRuleResourceListResult +} + +// HealthValidationsClientGetResponse contains the response from method HealthValidationsClient.Get. +type HealthValidationsClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + HealthValidation +} + +// HealthValidationsClientListByParentResponse contains the response from method HealthValidationsClient.NewListByParentPager. +type HealthValidationsClientListByParentResponse struct { + // The response of a HealthValidation list operation. + HealthValidationListResult +} + +// HealthValidationsClientStartValidationResponse contains the response from method HealthValidationsClient.BeginStartValidation. +type HealthValidationsClientStartValidationResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + HealthValidation +} + +// 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 +} + +// SharedPrivateLinkResourcesClientCreateResponse contains the response from method SharedPrivateLinkResourcesClient.BeginCreate. +type SharedPrivateLinkResourcesClientCreateResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + SharedPrivateLinkResource +} + +// SharedPrivateLinkResourcesClientDeleteResponse contains the response from method SharedPrivateLinkResourcesClient.BeginDelete. +type SharedPrivateLinkResourcesClientDeleteResponse struct { + // placeholder for future response values +} + +// SharedPrivateLinkResourcesClientGetResponse contains the response from method SharedPrivateLinkResourcesClient.Get. +type SharedPrivateLinkResourcesClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + SharedPrivateLinkResource +} + +// SharedPrivateLinkResourcesClientListByWatcherResponse contains the response from method SharedPrivateLinkResourcesClient.NewListByWatcherPager. +type SharedPrivateLinkResourcesClientListByWatcherResponse struct { + // The response of a SharedPrivateLinkResource list operation. + SharedPrivateLinkResourceListResult +} + +// TargetsClientCreateOrUpdateResponse contains the response from method TargetsClient.CreateOrUpdate. +type TargetsClientCreateOrUpdateResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + Target +} + +// TargetsClientDeleteResponse contains the response from method TargetsClient.Delete. +type TargetsClientDeleteResponse struct { + // placeholder for future response values +} + +// TargetsClientGetResponse contains the response from method TargetsClient.Get. +type TargetsClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. + Target +} + +// TargetsClientListByWatcherResponse contains the response from method TargetsClient.NewListByWatcherPager. +type TargetsClientListByWatcherResponse struct { + // The response of a Target list operation. + TargetListResult +} + +// WatchersClientCreateOrUpdateResponse contains the response from method WatchersClient.BeginCreateOrUpdate. +type WatchersClientCreateOrUpdateResponse struct { + // The DatabaseWatcherProviderHub resource. + Watcher +} + +// WatchersClientDeleteResponse contains the response from method WatchersClient.BeginDelete. +type WatchersClientDeleteResponse struct { + // placeholder for future response values +} + +// WatchersClientGetResponse contains the response from method WatchersClient.Get. +type WatchersClientGetResponse struct { + // The DatabaseWatcherProviderHub resource. + Watcher +} + +// WatchersClientListByResourceGroupResponse contains the response from method WatchersClient.NewListByResourceGroupPager. +type WatchersClientListByResourceGroupResponse struct { + // The response of a Watcher list operation. + WatcherListResult +} + +// WatchersClientListBySubscriptionResponse contains the response from method WatchersClient.NewListBySubscriptionPager. +type WatchersClientListBySubscriptionResponse struct { + // The response of a Watcher list operation. + WatcherListResult +} + +// WatchersClientStartResponse contains the response from method WatchersClient.BeginStart. +type WatchersClientStartResponse struct { + // placeholder for future response values +} + +// WatchersClientStopResponse contains the response from method WatchersClient.BeginStop. +type WatchersClientStopResponse struct { + // placeholder for future response values +} + +// WatchersClientUpdateResponse contains the response from method WatchersClient.BeginUpdate. +type WatchersClientUpdateResponse struct { + // The DatabaseWatcherProviderHub resource. + Watcher +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/sharedprivatelinkresources_client.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/sharedprivatelinkresources_client.go new file mode 100644 index 000000000000..fdd605d88af4 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/sharedprivatelinkresources_client.go @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher + +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" +) + +// SharedPrivateLinkResourcesClient contains the methods for the SharedPrivateLinkResources group. +// Don't use this type directly, use NewSharedPrivateLinkResourcesClient() instead. +type SharedPrivateLinkResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSharedPrivateLinkResourcesClient creates a new instance of SharedPrivateLinkResourcesClient 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 NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SharedPrivateLinkResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SharedPrivateLinkResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a SharedPrivateLinkResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - sharedPrivateLinkResourceName - The Shared Private Link resource name. +// - resource - Resource create parameters. +// - options - SharedPrivateLinkResourcesClientBeginCreateOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginCreate +// method. +func (client *SharedPrivateLinkResourcesClient) BeginCreate(ctx context.Context, resourceGroupName string, watcherName string, sharedPrivateLinkResourceName string, resource SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOptions) (*runtime.Poller[SharedPrivateLinkResourcesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, watcherName, sharedPrivateLinkResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientCreateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SharedPrivateLinkResourcesClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a SharedPrivateLinkResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +func (client *SharedPrivateLinkResourcesClient) create(ctx context.Context, resourceGroupName string, watcherName string, sharedPrivateLinkResourceName string, resource SharedPrivateLinkResource, options *SharedPrivateLinkResourcesClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "SharedPrivateLinkResourcesClient.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, watcherName, sharedPrivateLinkResourceName, 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 +} + +// createCreateRequest creates the Create request. +func (client *SharedPrivateLinkResourcesClient) createCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, sharedPrivateLinkResourceName string, resource SharedPrivateLinkResource, _ *SharedPrivateLinkResourcesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + if sharedPrivateLinkResourceName == "" { + return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) + 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", "2025-01-02") + 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 SharedPrivateLinkResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - sharedPrivateLinkResourceName - The Shared Private Link resource name. +// - options - SharedPrivateLinkResourcesClientBeginDeleteOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.BeginDelete +// method. +func (client *SharedPrivateLinkResourcesClient) BeginDelete(ctx context.Context, resourceGroupName string, watcherName string, sharedPrivateLinkResourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*runtime.Poller[SharedPrivateLinkResourcesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, watcherName, sharedPrivateLinkResourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SharedPrivateLinkResourcesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SharedPrivateLinkResourcesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a SharedPrivateLinkResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +func (client *SharedPrivateLinkResourcesClient) deleteOperation(ctx context.Context, resourceGroupName string, watcherName string, sharedPrivateLinkResourceName string, options *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "SharedPrivateLinkResourcesClient.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, watcherName, sharedPrivateLinkResourceName, 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 *SharedPrivateLinkResourcesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, sharedPrivateLinkResourceName string, _ *SharedPrivateLinkResourcesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + if sharedPrivateLinkResourceName == "" { + return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a SharedPrivateLinkResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - sharedPrivateLinkResourceName - The Shared Private Link resource name. +// - options - SharedPrivateLinkResourcesClientGetOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.Get +// method. +func (client *SharedPrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, watcherName string, sharedPrivateLinkResourceName string, options *SharedPrivateLinkResourcesClientGetOptions) (SharedPrivateLinkResourcesClientGetResponse, error) { + var err error + const operationName = "SharedPrivateLinkResourcesClient.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, watcherName, sharedPrivateLinkResourceName, options) + if err != nil { + return SharedPrivateLinkResourcesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SharedPrivateLinkResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SharedPrivateLinkResourcesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, sharedPrivateLinkResourceName string, _ *SharedPrivateLinkResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + if sharedPrivateLinkResourceName == "" { + return nil, errors.New("parameter sharedPrivateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sharedPrivateLinkResourceName}", url.PathEscape(sharedPrivateLinkResourceName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (SharedPrivateLinkResourcesClientGetResponse, error) { + result := SharedPrivateLinkResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResource); err != nil { + return SharedPrivateLinkResourcesClientGetResponse{}, err + } + return result, nil +} + +// NewListByWatcherPager - List SharedPrivateLinkResource resources by Watcher +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - options - SharedPrivateLinkResourcesClientListByWatcherOptions contains the optional parameters for the SharedPrivateLinkResourcesClient.NewListByWatcherPager +// method. +func (client *SharedPrivateLinkResourcesClient) NewListByWatcherPager(resourceGroupName string, watcherName string, options *SharedPrivateLinkResourcesClientListByWatcherOptions) *runtime.Pager[SharedPrivateLinkResourcesClientListByWatcherResponse] { + return runtime.NewPager(runtime.PagingHandler[SharedPrivateLinkResourcesClientListByWatcherResponse]{ + More: func(page SharedPrivateLinkResourcesClientListByWatcherResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SharedPrivateLinkResourcesClientListByWatcherResponse) (SharedPrivateLinkResourcesClientListByWatcherResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SharedPrivateLinkResourcesClient.NewListByWatcherPager") + 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.listByWatcherCreateRequest(ctx, resourceGroupName, watcherName, options) + }, nil) + if err != nil { + return SharedPrivateLinkResourcesClientListByWatcherResponse{}, err + } + return client.listByWatcherHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByWatcherCreateRequest creates the ListByWatcher request. +func (client *SharedPrivateLinkResourcesClient) listByWatcherCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, _ *SharedPrivateLinkResourcesClientListByWatcherOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByWatcherHandleResponse handles the ListByWatcher response. +func (client *SharedPrivateLinkResourcesClient) listByWatcherHandleResponse(resp *http.Response) (SharedPrivateLinkResourcesClientListByWatcherResponse, error) { + result := SharedPrivateLinkResourcesClientListByWatcherResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResourceListResult); err != nil { + return SharedPrivateLinkResourcesClientListByWatcherResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/sharedprivatelinkresources_client_example_test.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/sharedprivatelinkresources_client_example_test.go new file mode 100644 index 000000000000..2df401e2e1f4 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/sharedprivatelinkresources_client_example_test.go @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher_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/databasewatcher/armdatabasewatcher" + "log" +) + +// Generated from example definition: 2025-01-02/SharedPrivateLinkResources_Create_MaximumSet_Gen.json +func ExampleSharedPrivateLinkResourcesClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSharedPrivateLinkResourcesClient().BeginCreate(ctx, "apiTest-ddat4p", "databasemo3ej9ih", "monitoringh22eed", armdatabasewatcher.SharedPrivateLinkResource{ + Properties: &armdatabasewatcher.SharedPrivateLinkResourceProperties{ + PrivateLinkResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.KeyVault/vaults/kvmo3ej9ih"), + GroupID: to.Ptr("vault"), + RequestMessage: to.Ptr("request message"), + DNSZone: to.Ptr("ec3ae9d410ba"), + Status: to.Ptr(armdatabasewatcher.SharedPrivateLinkResourceStatusPending), + }, + }, 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 = armdatabasewatcher.SharedPrivateLinkResourcesClientCreateResponse{ + // SharedPrivateLinkResource: &armdatabasewatcher.SharedPrivateLinkResource{ + // Properties: &armdatabasewatcher.SharedPrivateLinkResourceProperties{ + // PrivateLinkResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.KeyVault/vaults/kvmo3ej9ih"), + // GroupID: to.Ptr("vault"), + // RequestMessage: to.Ptr("request message"), + // DNSZone: to.Ptr("ec3ae9d410ba"), + // Status: to.Ptr(armdatabasewatcher.SharedPrivateLinkResourceStatusPending), + // }, + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.DatabaseWatcher/watchers/databasemo3ej9ih/sharedPrivateLinkResources/monitoringh22eed"), + // Name: to.Ptr("monitoringh22eed"), + // Type: to.Ptr("microsoft.databasewatcher/watchers/sharedPrivateLinkResources"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-02/SharedPrivateLinkResources_Delete_MaximumSet_Gen.json +func ExampleSharedPrivateLinkResourcesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewSharedPrivateLinkResourcesClient().BeginDelete(ctx, "apiTest-ddat4p", "databasemo3ej9ih", "monitoringh22eed", 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: 2025-01-02/SharedPrivateLinkResources_Get_MaximumSet_Gen.json +func ExampleSharedPrivateLinkResourcesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewSharedPrivateLinkResourcesClient().Get(ctx, "apiTest-ddat4p", "databasemo3ej9ih", "monitoringh22eed", 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 = armdatabasewatcher.SharedPrivateLinkResourcesClientGetResponse{ + // SharedPrivateLinkResource: &armdatabasewatcher.SharedPrivateLinkResource{ + // Properties: &armdatabasewatcher.SharedPrivateLinkResourceProperties{ + // PrivateLinkResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.KeyVault/vaults/kvmo3ej9ih"), + // GroupID: to.Ptr("vault"), + // RequestMessage: to.Ptr("request message"), + // DNSZone: to.Ptr("ec3ae9d410ba"), + // Status: to.Ptr(armdatabasewatcher.SharedPrivateLinkResourceStatusPending), + // }, + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.DatabaseWatcher/watchers/databasemo3ej9ih/sharedPrivateLinkResources/monitoringh22eed"), + // Name: to.Ptr("monitoringh22eed"), + // Type: to.Ptr("microsoft.databasewatcher/watchers/sharedPrivateLinkResources"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-02/SharedPrivateLinkResources_ListByWatcher_MaximumSet_Gen.json +func ExampleSharedPrivateLinkResourcesClient_NewListByWatcherPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewSharedPrivateLinkResourcesClient().NewListByWatcherPager("apiTest-ddat4p", "databasemo3ej9ih", 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 = armdatabasewatcher.SharedPrivateLinkResourcesClientListByWatcherResponse{ + // SharedPrivateLinkResourceListResult: armdatabasewatcher.SharedPrivateLinkResourceListResult{ + // Value: []*armdatabasewatcher.SharedPrivateLinkResource{ + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.DatabaseWatcher/watchers/databasemo3ej9ih/sharedPrivateLinkResources/monitoringh22eed"), + // Name: to.Ptr("monitoringh22eed"), + // Type: to.Ptr("microsoft.databasewatcher/watchers/sharedPrivateLinkResources"), + // Properties: &armdatabasewatcher.SharedPrivateLinkResourceProperties{ + // PrivateLinkResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.KeyVault/vaults/kvmo3ej9ih"), + // GroupID: to.Ptr("vault"), + // RequestMessage: to.Ptr("request message"), + // DNSZone: to.Ptr("ec3ae9d410ba"), + // Status: to.Ptr(armdatabasewatcher.SharedPrivateLinkResourceStatusPending), + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/awfba"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/targets_client.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/targets_client.go new file mode 100644 index 000000000000..5f489961892f --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/targets_client.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 armdatabasewatcher + +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" +) + +// TargetsClient contains the methods for the Targets group. +// Don't use this type directly, use NewTargetsClient() instead. +type TargetsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewTargetsClient creates a new instance of TargetsClient 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 NewTargetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TargetsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TargetsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a Target +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - targetName - The target resource name. +// - resource - Resource create parameters. +// - options - TargetsClientCreateOrUpdateOptions contains the optional parameters for the TargetsClient.CreateOrUpdate method. +func (client *TargetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, watcherName string, targetName string, resource Target, options *TargetsClientCreateOrUpdateOptions) (TargetsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "TargetsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, watcherName, targetName, resource, options) + if err != nil { + return TargetsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TargetsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return TargetsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *TargetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, targetName string, resource Target, _ *TargetsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + if targetName == "" { + return nil, errors.New("parameter targetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{targetName}", url.PathEscape(targetName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *TargetsClient) createOrUpdateHandleResponse(resp *http.Response) (TargetsClientCreateOrUpdateResponse, error) { + result := TargetsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Target); err != nil { + return TargetsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a Target +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - targetName - The target resource name. +// - options - TargetsClientDeleteOptions contains the optional parameters for the TargetsClient.Delete method. +func (client *TargetsClient) Delete(ctx context.Context, resourceGroupName string, watcherName string, targetName string, options *TargetsClientDeleteOptions) (TargetsClientDeleteResponse, error) { + var err error + const operationName = "TargetsClient.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, watcherName, targetName, options) + if err != nil { + return TargetsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TargetsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return TargetsClientDeleteResponse{}, err + } + return TargetsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TargetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, targetName string, _ *TargetsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + if targetName == "" { + return nil, errors.New("parameter targetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{targetName}", url.PathEscape(targetName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Target +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - targetName - The target resource name. +// - options - TargetsClientGetOptions contains the optional parameters for the TargetsClient.Get method. +func (client *TargetsClient) Get(ctx context.Context, resourceGroupName string, watcherName string, targetName string, options *TargetsClientGetOptions) (TargetsClientGetResponse, error) { + var err error + const operationName = "TargetsClient.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, watcherName, targetName, options) + if err != nil { + return TargetsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TargetsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TargetsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TargetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, targetName string, _ *TargetsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + if targetName == "" { + return nil, errors.New("parameter targetName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{targetName}", url.PathEscape(targetName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TargetsClient) getHandleResponse(resp *http.Response) (TargetsClientGetResponse, error) { + result := TargetsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Target); err != nil { + return TargetsClientGetResponse{}, err + } + return result, nil +} + +// NewListByWatcherPager - List Target resources by Watcher +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - options - TargetsClientListByWatcherOptions contains the optional parameters for the TargetsClient.NewListByWatcherPager +// method. +func (client *TargetsClient) NewListByWatcherPager(resourceGroupName string, watcherName string, options *TargetsClientListByWatcherOptions) *runtime.Pager[TargetsClientListByWatcherResponse] { + return runtime.NewPager(runtime.PagingHandler[TargetsClientListByWatcherResponse]{ + More: func(page TargetsClientListByWatcherResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TargetsClientListByWatcherResponse) (TargetsClientListByWatcherResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "TargetsClient.NewListByWatcherPager") + 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.listByWatcherCreateRequest(ctx, resourceGroupName, watcherName, options) + }, nil) + if err != nil { + return TargetsClientListByWatcherResponse{}, err + } + return client.listByWatcherHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByWatcherCreateRequest creates the ListByWatcher request. +func (client *TargetsClient) listByWatcherCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, _ *TargetsClientListByWatcherOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByWatcherHandleResponse handles the ListByWatcher response. +func (client *TargetsClient) listByWatcherHandleResponse(resp *http.Response) (TargetsClientListByWatcherResponse, error) { + result := TargetsClientListByWatcherResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TargetListResult); err != nil { + return TargetsClientListByWatcherResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/targets_client_example_test.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/targets_client_example_test.go new file mode 100644 index 000000000000..60bca3d356ae --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/targets_client_example_test.go @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher_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/databasewatcher/armdatabasewatcher" + "log" +) + +// Generated from example definition: 2025-01-02/Targets_CreateOrUpdate_MaximumSet_Gen.json +func ExampleTargetsClient_CreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTargetsClient().CreateOrUpdate(ctx, "apiTest-ddat4p", "databasemo3ej9ih", "monitoringh22eed", armdatabasewatcher.Target{ + Properties: &armdatabasewatcher.SQLDbSingleDatabaseTargetProperties{ + TargetType: to.Ptr("SqlDb"), + TargetAuthenticationType: to.Ptr(armdatabasewatcher.TargetAuthenticationTypeAAD), + ConnectionServerName: to.Ptr("sqlServero1ihe2"), + SQLDbResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.Sql/servers/m1/databases/m2"), + }, + }, 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 = armdatabasewatcher.TargetsClientCreateOrUpdateResponse{ + // Target: &armdatabasewatcher.Target{ + // Properties: &armdatabasewatcher.SQLDbSingleDatabaseTargetProperties{ + // TargetType: to.Ptr("SqlDb"), + // TargetAuthenticationType: to.Ptr(armdatabasewatcher.TargetAuthenticationTypeAAD), + // ConnectionServerName: to.Ptr("sqlServero1ihe2"), + // SQLDbResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.Sql/servers/m1/databases/m2"), + // ProvisioningState: to.Ptr(armdatabasewatcher.ResourceProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-px9ma7/providers/Microsoft.DatabaseWatcher/watchers/databasemo3d9sgt/targets/monitoringzkndgm"), + // Name: to.Ptr("monitoringzkndgm"), + // Type: to.Ptr("microsoft.databasewatcher/watchers/targets"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-02/Targets_Delete_MaximumSet_Gen.json +func ExampleTargetsClient_Delete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTargetsClient().Delete(ctx, "apiTest-ddat4p", "databasemo3ej9ih", "monitoringh22eed", 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 = armdatabasewatcher.TargetsClientDeleteResponse{ + // } +} + +// Generated from example definition: 2025-01-02/Targets_Get_MaximumSet_Gen.json +func ExampleTargetsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTargetsClient().Get(ctx, "apiTest-ddat4p", "databasemo3ej9ih", "monitoringh22eed", 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 = armdatabasewatcher.TargetsClientGetResponse{ + // Target: &armdatabasewatcher.Target{ + // Properties: &armdatabasewatcher.SQLDbSingleDatabaseTargetProperties{ + // TargetType: to.Ptr("SqlDb"), + // TargetAuthenticationType: to.Ptr(armdatabasewatcher.TargetAuthenticationTypeAAD), + // ConnectionServerName: to.Ptr("sqlServero1ihe2"), + // SQLDbResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.Sql/servers/m1/databases/m2"), + // ProvisioningState: to.Ptr(armdatabasewatcher.ResourceProvisioningStateSucceeded), + // }, + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-px9ma7/providers/Microsoft.DatabaseWatcher/watchers/databasemo3d9sgt/targets/monitoringzkndgm"), + // Name: to.Ptr("monitoringzkndgm"), + // Type: to.Ptr("microsoft.databasewatcher/watchers/targets"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-02/Targets_ListByWatcher_MaximumSet_Gen.json +func ExampleTargetsClient_NewListByWatcherPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTargetsClient().NewListByWatcherPager("apiTest-ddat4p", "databasemo3ej9ih", 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 = armdatabasewatcher.TargetsClientListByWatcherResponse{ + // TargetListResult: armdatabasewatcher.TargetListResult{ + // Value: []*armdatabasewatcher.Target{ + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-px9ma7/providers/Microsoft.DatabaseWatcher/watchers/databasemo3d9sgt/targets/monitoringzkndgm"), + // Name: to.Ptr("monitoringzkndgm"), + // Type: to.Ptr("microsoft.databasewatcher/watchers/targets"), + // Properties: &armdatabasewatcher.SQLDbSingleDatabaseTargetProperties{ + // TargetType: to.Ptr("SqlDb"), + // TargetAuthenticationType: to.Ptr(armdatabasewatcher.TargetAuthenticationTypeAAD), + // ConnectionServerName: to.Ptr("sqlServero1ihe2"), + // SQLDbResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.Sql/servers/m1/databases/m2"), + // ProvisioningState: to.Ptr(armdatabasewatcher.ResourceProvisioningStateSucceeded), + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/time_rfc3339.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/time_rfc3339.go new file mode 100644 index 000000000000..5f90c03ee1a6 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/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 armdatabasewatcher + +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/databasewatcher/armdatabasewatcher/tsp-location.yaml b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/tsp-location.yaml new file mode 100644 index 000000000000..9b8f78437670 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/databasewatcher/DatabaseWatcher.Management +commit: 676334a284e5136f0a0721d6ae844bb04332f579 +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/watchers_client.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/watchers_client.go new file mode 100644 index 000000000000..73f92e8aa909 --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/watchers_client.go @@ -0,0 +1,606 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher + +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" +) + +// WatchersClient contains the methods for the Watchers group. +// Don't use this type directly, use NewWatchersClient() instead. +type WatchersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewWatchersClient creates a new instance of WatchersClient 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 NewWatchersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WatchersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &WatchersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Watcher +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - resource - Resource create parameters. +// - options - WatchersClientBeginCreateOrUpdateOptions contains the optional parameters for the WatchersClient.BeginCreateOrUpdate +// method. +func (client *WatchersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, watcherName string, resource Watcher, options *WatchersClientBeginCreateOrUpdateOptions) (*runtime.Poller[WatchersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, watcherName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientCreateOrUpdateResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WatchersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Watcher +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +func (client *WatchersClient) createOrUpdate(ctx context.Context, resourceGroupName string, watcherName string, resource Watcher, options *WatchersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "WatchersClient.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, watcherName, 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 *WatchersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, resource Watcher, _ *WatchersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + 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", "2025-01-02") + 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 Watcher +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - options - WatchersClientBeginDeleteOptions contains the optional parameters for the WatchersClient.BeginDelete method. +func (client *WatchersClient) BeginDelete(ctx context.Context, resourceGroupName string, watcherName string, options *WatchersClientBeginDeleteOptions) (*runtime.Poller[WatchersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, watcherName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WatchersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Watcher +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +func (client *WatchersClient) deleteOperation(ctx context.Context, resourceGroupName string, watcherName string, options *WatchersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "WatchersClient.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, watcherName, 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 *WatchersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, _ *WatchersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Watcher +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - options - WatchersClientGetOptions contains the optional parameters for the WatchersClient.Get method. +func (client *WatchersClient) Get(ctx context.Context, resourceGroupName string, watcherName string, options *WatchersClientGetOptions) (WatchersClientGetResponse, error) { + var err error + const operationName = "WatchersClient.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, watcherName, options) + if err != nil { + return WatchersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return WatchersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return WatchersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *WatchersClient) getCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, _ *WatchersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *WatchersClient) getHandleResponse(resp *http.Response) (WatchersClientGetResponse, error) { + result := WatchersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Watcher); err != nil { + return WatchersClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Watcher resources by resource group +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - WatchersClientListByResourceGroupOptions contains the optional parameters for the WatchersClient.NewListByResourceGroupPager +// method. +func (client *WatchersClient) NewListByResourceGroupPager(resourceGroupName string, options *WatchersClientListByResourceGroupOptions) *runtime.Pager[WatchersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[WatchersClientListByResourceGroupResponse]{ + More: func(page WatchersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WatchersClientListByResourceGroupResponse) (WatchersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WatchersClient.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 WatchersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *WatchersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *WatchersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *WatchersClient) listByResourceGroupHandleResponse(resp *http.Response) (WatchersClientListByResourceGroupResponse, error) { + result := WatchersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WatcherListResult); err != nil { + return WatchersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List Watcher resources by subscription ID +// +// Generated from API version 2025-01-02 +// - options - WatchersClientListBySubscriptionOptions contains the optional parameters for the WatchersClient.NewListBySubscriptionPager +// method. +func (client *WatchersClient) NewListBySubscriptionPager(options *WatchersClientListBySubscriptionOptions) *runtime.Pager[WatchersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[WatchersClientListBySubscriptionResponse]{ + More: func(page WatchersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *WatchersClientListBySubscriptionResponse) (WatchersClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WatchersClient.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 WatchersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *WatchersClient) listBySubscriptionCreateRequest(ctx context.Context, _ *WatchersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DatabaseWatcher/watchers" + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *WatchersClient) listBySubscriptionHandleResponse(resp *http.Response) (WatchersClientListBySubscriptionResponse, error) { + result := WatchersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.WatcherListResult); err != nil { + return WatchersClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginStart - The action to start monitoring all targets configured for a database watcher. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - options - WatchersClientBeginStartOptions contains the optional parameters for the WatchersClient.BeginStart method. +func (client *WatchersClient) BeginStart(ctx context.Context, resourceGroupName string, watcherName string, options *WatchersClientBeginStartOptions) (*runtime.Poller[WatchersClientStartResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.start(ctx, resourceGroupName, watcherName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WatchersClientStartResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Start - The action to start monitoring all targets configured for a database watcher. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +func (client *WatchersClient) start(ctx context.Context, resourceGroupName string, watcherName string, options *WatchersClientBeginStartOptions) (*http.Response, error) { + var err error + const operationName = "WatchersClient.BeginStart" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.startCreateRequest(ctx, resourceGroupName, watcherName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// startCreateRequest creates the Start request. +func (client *WatchersClient) startCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, _ *WatchersClientBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/start" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginStop - The action to stop monitoring all targets configured for a database watcher. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - options - WatchersClientBeginStopOptions contains the optional parameters for the WatchersClient.BeginStop method. +func (client *WatchersClient) BeginStop(ctx context.Context, resourceGroupName string, watcherName string, options *WatchersClientBeginStopOptions) (*runtime.Poller[WatchersClientStopResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.stop(ctx, resourceGroupName, watcherName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientStopResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WatchersClientStopResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Stop - The action to stop monitoring all targets configured for a database watcher. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +func (client *WatchersClient) stop(ctx context.Context, resourceGroupName string, watcherName string, options *WatchersClientBeginStopOptions) (*http.Response, error) { + var err error + const operationName = "WatchersClient.BeginStop" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.stopCreateRequest(ctx, resourceGroupName, watcherName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *WatchersClient) stopCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, _ *WatchersClientBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/stop" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + 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", "2025-01-02") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// BeginUpdate - Update a Watcher +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - watcherName - The database watcher name. +// - properties - The resource properties to be updated. +// - options - WatchersClientBeginUpdateOptions contains the optional parameters for the WatchersClient.BeginUpdate method. +func (client *WatchersClient) BeginUpdate(ctx context.Context, resourceGroupName string, watcherName string, properties WatcherUpdate, options *WatchersClientBeginUpdateOptions) (*runtime.Poller[WatchersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, watcherName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[WatchersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[WatchersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a Watcher +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-02 +func (client *WatchersClient) update(ctx context.Context, resourceGroupName string, watcherName string, properties WatcherUpdate, options *WatchersClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "WatchersClient.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, watcherName, 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 *WatchersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, watcherName string, properties WatcherUpdate, _ *WatchersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if watcherName == "" { + return nil, errors.New("parameter watcherName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{watcherName}", url.PathEscape(watcherName)) + 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", "2025-01-02") + 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/databasewatcher/armdatabasewatcher/watchers_client_example_test.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/watchers_client_example_test.go new file mode 100644 index 000000000000..dfeb47ba5b7a --- /dev/null +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/watchers_client_example_test.go @@ -0,0 +1,871 @@ +// Copyright (c) Microsoft 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 armdatabasewatcher_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/databasewatcher/armdatabasewatcher" + "log" +) + +// Generated from example definition: 2025-01-02/Watchers_CreateOrUpdate_MaximumSet_Gen.json +func ExampleWatchersClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewWatchersClient().BeginCreateOrUpdate(ctx, "rgWatcher", "testWatcher", armdatabasewatcher.Watcher{ + Properties: &armdatabasewatcher.WatcherProperties{ + Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + Datastore: &armdatabasewatcher.Datastore{ + AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + KustoManagementURL: to.Ptr("https://portal.azure.com/"), + KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + }, + }, + Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityTypeSystemAssigned), + }, + Tags: map[string]*string{}, + Location: to.Ptr("eastus2"), + }, 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 = armdatabasewatcher.WatchersClientCreateOrUpdateResponse{ + // Watcher: &armdatabasewatcher.Watcher{ + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityTypeSystemAssigned), + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("eastus2"), + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/dummyrg/providers/Microsoft.DatabaseWatcher/watchers/myWatcher"), + // Name: to.Ptr("myWatcher"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-02/Watchers_Delete_MaximumSet_Gen.json +func ExampleWatchersClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewWatchersClient().BeginDelete(ctx, "rgWatcher", "testWatcher", 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: 2025-01-02/Watchers_Get_MaximumSet_Gen.json +func ExampleWatchersClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewWatchersClient().Get(ctx, "rgWatcher", "myWatcher", 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 = armdatabasewatcher.WatchersClientGetResponse{ + // Watcher: &armdatabasewatcher.Watcher{ + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("eastus2"), + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/dummyrg/providers/Microsoft.DatabaseWatcher/watchers/myWatcher"), + // Name: to.Ptr("myWatcher"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-02/Watchers_ListByResourceGroup_MaximumSet_Gen.json +func ExampleWatchersClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewWatchersClient().NewListByResourceGroupPager("rgWatcher", 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 = armdatabasewatcher.WatchersClientListByResourceGroupResponse{ + // WatcherListResult: armdatabasewatcher.WatcherListResult{ + // Value: []*armdatabasewatcher.Watcher{ + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/dummyrg/providers/Microsoft.DatabaseWatcher/watchers/myWatcher"), + // Name: to.Ptr("myWatcher"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("West US"), + // Tags: map[string]*string{ + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-4sz1jg/providers/Microsoft.DatabaseWatcher/watchers/databasemo4o4zdf"), + // Name: to.Ptr("databasemo4o4zdf"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("westus"), + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-d77ftn/providers/Microsoft.DatabaseWatcher/watchers/databasemosn3h6l"), + // Name: to.Ptr("databasemosn3h6l"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("westus"), + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-nyb4gm/providers/Microsoft.DatabaseWatcher/watchers/databasemoyb6iar"), + // Name: to.Ptr("databasemoyb6iar"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("westus"), + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-llis4j/providers/Microsoft.DatabaseWatcher/watchers/databasemoi04xst"), + // Name: to.Ptr("databasemoi04xst"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("westus"), + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-thy6zd/providers/Microsoft.DatabaseWatcher/watchers/databasemonpyl24"), + // Name: to.Ptr("databasemonpyl24"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("westus"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("ysoqerxnmxqsvhmvjojoyzotc"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T18:01:18.690Z"); return t}()), + // LastModifiedBy: to.Ptr("yrilzsg"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T18:01:18.690Z"); return t}()), + // }, + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.DatabaseWatcher/watchers/databasemo3ej9ih"), + // Name: to.Ptr("databasemo3ej9ih"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("westus"), + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2025-01-02/Watchers_ListBySubscription_MaximumSet_Gen.json +func ExampleWatchersClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewWatchersClient().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 = armdatabasewatcher.WatchersClientListBySubscriptionResponse{ + // WatcherListResult: armdatabasewatcher.WatcherListResult{ + // Value: []*armdatabasewatcher.Watcher{ + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/dummyrg/providers/Microsoft.DatabaseWatcher/watchers/myWatcher"), + // Name: to.Ptr("myWatcher"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("West US"), + // Tags: map[string]*string{ + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityTypeSystemAssigned), + // }, + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-4sz1jg/providers/Microsoft.DatabaseWatcher/watchers/databasemo4o4zdf"), + // Name: to.Ptr("databasemo4o4zdf"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("westus"), + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-d77ftn/providers/Microsoft.DatabaseWatcher/watchers/databasemosn3h6l"), + // Name: to.Ptr("databasemosn3h6l"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("westus"), + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-nyb4gm/providers/Microsoft.DatabaseWatcher/watchers/databasemoyb6iar"), + // Name: to.Ptr("databasemoyb6iar"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("westus"), + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-llis4j/providers/Microsoft.DatabaseWatcher/watchers/databasemoi04xst"), + // Name: to.Ptr("databasemoi04xst"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("westus"), + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-thy6zd/providers/Microsoft.DatabaseWatcher/watchers/databasemonpyl24"), + // Name: to.Ptr("databasemonpyl24"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("westus"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("ysoqerxnmxqsvhmvjojoyzotc"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T18:01:18.690Z"); return t}()), + // LastModifiedBy: to.Ptr("yrilzsg"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T18:01:18.690Z"); return t}()), + // }, + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.DatabaseWatcher/watchers/databasemo3ej9ih"), + // Name: to.Ptr("databasemo3ej9ih"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // Location: to.Ptr("westus"), + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2025-01-02/Watchers_Start_MaximumSet_Gen.json +func ExampleWatchersClient_BeginStart() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewWatchersClient().BeginStart(ctx, "rgWatcher", "testWatcher", 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 = armdatabasewatcher.WatchersClientStartResponse{ + // } +} + +// Generated from example definition: 2025-01-02/Watchers_Stop_MaximumSet_Gen.json +func ExampleWatchersClient_BeginStop() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewWatchersClient().BeginStop(ctx, "rgWatcher", "myWatcher", 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 = armdatabasewatcher.WatchersClientStopResponse{ + // } +} + +// Generated from example definition: 2025-01-02/Watchers_Update_MaximumSet_Gen.json +func ExampleWatchersClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdatabasewatcher.NewClientFactory("A76F9850-996B-40B3-94D4-C98110A0EEC9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewWatchersClient().BeginUpdate(ctx, "rgWatcher", "testWatcher", armdatabasewatcher.WatcherUpdate{ + Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityTypeSystemAssigned), + }, + Properties: &armdatabasewatcher.WatcherUpdateProperties{ + Datastore: &armdatabasewatcher.Datastore{ + AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + KustoManagementURL: to.Ptr("https://portal.azure.com/"), + KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + }, + DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/newtest"), + }, + 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 = armdatabasewatcher.WatchersClientUpdateResponse{ + // Watcher: &armdatabasewatcher.Watcher{ + // Properties: &armdatabasewatcher.WatcherProperties{ + // Status: to.Ptr(armdatabasewatcher.WatcherStatusStarting), + // DefaultAlertRuleIdentityResourceID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + // Datastore: &armdatabasewatcher.Datastore{ + // AdxClusterResourceID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + // KustoClusterURI: to.Ptr("https://kustouri-adx.eastus.kusto.windows.net"), + // KustoClusterDisplayName: to.Ptr("kustoUri-adx"), + // KustoDataIngestionURI: to.Ptr("https://ingest-kustouri-adx.eastus.kusto.windows.net"), + // KustoDatabaseName: to.Ptr("kustoDatabaseName1"), + // KustoManagementURL: to.Ptr("https://portal.azure.com/"), + // KustoOfferingType: to.Ptr(armdatabasewatcher.KustoOfferingTypeAdx), + // }, + // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), + // }, + // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityTypeSystemAssigned), + // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ + // }, + // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // TenantID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), + // }, + // Tags: map[string]*string{ + // }, + // Location: to.Ptr("eastus2"), + // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/dummyrg/providers/Microsoft.DatabaseWatcher/watchers/myWatcher"), + // Name: to.Ptr("myWatcher"), + // Type: to.Ptr("microsoft.databasewatcher/watchers"), + // SystemData: &armdatabasewatcher.SystemData{ + // CreatedBy: to.Ptr("enbpvlpqbwd"), + // CreatedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // LastModifiedBy: to.Ptr("mxp"), + // LastModifiedByType: to.Ptr(armdatabasewatcher.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-25T15:38:47.092Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md b/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md index 4d58f300b978..ad7998d2e845 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2025-02-27) +### Other Changes + + ## 1.0.0 (2025-02-10) ### Features Added diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/constants.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/constants.go index 1a7e44fb45bc..6da3f4ded1d5 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/constants.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/constants.go @@ -6,7 +6,7 @@ package armdeviceregistry const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/deviceregistry/armdeviceregistry" - 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/deviceregistry/armdeviceregistry/tsp-location.yaml b/sdk/resourcemanager/deviceregistry/armdeviceregistry/tsp-location.yaml index f6af95165e4f..19166e7a63fc 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/tsp-location.yaml +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/deviceregistry/DeviceRegistry.Management -commit: 53b2029545881f27d0f0fad3892065f39b1b9e83 +commit: 676334a284e5136f0a0721d6ae844bb04332f579 repo: Azure/azure-rest-api-specs additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md index ff3cd4b4c66f..433b16510c0a 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 1.1.0 (2025-02-27) +### Features Added + +- New enum type `AvailabilityStatus` with values `AvailabilityStatusAvailable`, `AvailabilityStatusUnavailable` +- New enum type `CertificateStoreNameOption` with values `CertificateStoreNameOptionMy`, `CertificateStoreNameOptionRoot` +- New enum type `CheckNameAvailabilityReason` with values `CheckNameAvailabilityReasonAlreadyExists`, `CheckNameAvailabilityReasonInvalid` +- New enum type `EphemeralType` with values `EphemeralTypeAutomatic`, `EphemeralTypeCacheDisk`, `EphemeralTypeResourceDisk` +- New enum type `ResourceType` with values `ResourceTypeMicrosoftDevOpsInfrastructurePools` +- New function `*PoolsClient.CheckNameAvailability(context.Context, CheckNameAvailability, *PoolsClientCheckNameAvailabilityOptions) (PoolsClientCheckNameAvailabilityResponse, error)` +- New struct `CheckNameAvailability` +- New struct `CheckNameAvailabilityResult` +- New field `OpenAccess` in struct `Organization` +- New field `EphemeralType` in struct `PoolImage` +- New field `CertificateStoreName` in struct `SecretsManagementSettings` + + ## 1.0.0 (2024-11-20) ### Breaking Changes diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go index 982aced6c92c..410fabd9e209 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/constants.go @@ -6,7 +6,7 @@ package armdevopsinfrastructure const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -24,6 +24,24 @@ func PossibleActionTypeValues() []ActionType { } } +// AvailabilityStatus - AvailabilityStatus of a name. +type AvailabilityStatus string + +const ( + // AvailabilityStatusAvailable - The name is available. + AvailabilityStatusAvailable AvailabilityStatus = "Available" + // AvailabilityStatusUnavailable - The name is unavailable + AvailabilityStatusUnavailable AvailabilityStatus = "Unavailable" +) + +// PossibleAvailabilityStatusValues returns the possible values for the AvailabilityStatus const type. +func PossibleAvailabilityStatusValues() []AvailabilityStatus { + return []AvailabilityStatus{ + AvailabilityStatusAvailable, + AvailabilityStatusUnavailable, + } +} + // AzureDevOpsPermissionType - Determines who has admin permissions to the Azure DevOps pool. type AzureDevOpsPermissionType string @@ -66,6 +84,42 @@ func PossibleCachingTypeValues() []CachingType { } } +// CertificateStoreNameOption - The certificate store name type +type CertificateStoreNameOption string + +const ( + // CertificateStoreNameOptionMy - The X.509 certificate store for personal certificates. + CertificateStoreNameOptionMy CertificateStoreNameOption = "My" + // CertificateStoreNameOptionRoot - The X.509 certificate store for trusted root certificate authorities (CAs). + CertificateStoreNameOptionRoot CertificateStoreNameOption = "Root" +) + +// PossibleCertificateStoreNameOptionValues returns the possible values for the CertificateStoreNameOption const type. +func PossibleCertificateStoreNameOptionValues() []CertificateStoreNameOption { + return []CertificateStoreNameOption{ + CertificateStoreNameOptionMy, + CertificateStoreNameOptionRoot, + } +} + +// CheckNameAvailabilityReason - The reason code explaining why the name is unavailable. Will be null if the name is available. +type CheckNameAvailabilityReason string + +const ( + // CheckNameAvailabilityReasonAlreadyExists - The name already exists. + CheckNameAvailabilityReasonAlreadyExists CheckNameAvailabilityReason = "AlreadyExists" + // CheckNameAvailabilityReasonInvalid - The name is invalid. + CheckNameAvailabilityReasonInvalid CheckNameAvailabilityReason = "Invalid" +) + +// PossibleCheckNameAvailabilityReasonValues returns the possible values for the CheckNameAvailabilityReason const type. +func PossibleCheckNameAvailabilityReasonValues() []CheckNameAvailabilityReason { + return []CheckNameAvailabilityReason{ + CheckNameAvailabilityReasonAlreadyExists, + CheckNameAvailabilityReasonInvalid, + } +} + // CreatedByType - The kind of entity that created the resource. type CreatedByType string @@ -90,6 +144,27 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// EphemeralType - The type of Ephemeral option the pool will use on underlying VMs when loading this image. +type EphemeralType string + +const ( + // EphemeralTypeAutomatic - Ephemeral is handled by Managed DevOps Pools service. + EphemeralTypeAutomatic EphemeralType = "Automatic" + // EphemeralTypeCacheDisk - CacheDisk ephemeral only, requires that the SKU has a cache that is large enough for the image. + EphemeralTypeCacheDisk EphemeralType = "CacheDisk" + // EphemeralTypeResourceDisk - ResourceDisk ephemeral only, requires only that the SKU supports it. + EphemeralTypeResourceDisk EphemeralType = "ResourceDisk" +) + +// PossibleEphemeralTypeValues returns the possible values for the EphemeralType const type. +func PossibleEphemeralTypeValues() []EphemeralType { + return []EphemeralType{ + EphemeralTypeAutomatic, + EphemeralTypeCacheDisk, + EphemeralTypeResourceDisk, + } +} + // LogonType - Determines how the service should be run. type LogonType string @@ -334,6 +409,21 @@ func PossibleResourceStatusValues() []ResourceStatus { } } +// ResourceType - The type of resource. +type ResourceType string + +const ( + // ResourceTypeMicrosoftDevOpsInfrastructurePools - DevOpsInfrastructure pool resource. + ResourceTypeMicrosoftDevOpsInfrastructurePools ResourceType = "Microsoft.DevOpsInfrastructure/pools" +) + +// PossibleResourceTypeValues returns the possible values for the ResourceType const type. +func PossibleResourceTypeValues() []ResourceType { + return []ResourceType{ + ResourceTypeMicrosoftDevOpsInfrastructurePools, + } +} + // StorageAccountType - StorageAccountType enums type StorageAccountType string diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go index 170370591c3f..88c1b88d6e3a 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go @@ -20,6 +20,10 @@ import ( // PoolsServer is a fake server for instances of the armdevopsinfrastructure.PoolsClient type. type PoolsServer struct { + // CheckNameAvailability is the fake for method PoolsClient.CheckNameAvailability + // HTTP status codes to indicate success: http.StatusOK + CheckNameAvailability func(ctx context.Context, body armdevopsinfrastructure.CheckNameAvailability, options *armdevopsinfrastructure.PoolsClientCheckNameAvailabilityOptions) (resp azfake.Responder[armdevopsinfrastructure.PoolsClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) + // BeginCreateOrUpdate is the fake for method PoolsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, poolName string, resource armdevopsinfrastructure.Pool, options *armdevopsinfrastructure.PoolsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armdevopsinfrastructure.PoolsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) @@ -93,6 +97,8 @@ func (p *PoolsServerTransport) dispatchToMethodFake(req *http.Request, method st } if !intercepted { switch method { + case "PoolsClient.CheckNameAvailability": + res.resp, res.err = p.dispatchCheckNameAvailability(req) case "PoolsClient.BeginCreateOrUpdate": res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) case "PoolsClient.BeginDelete": @@ -124,6 +130,35 @@ func (p *PoolsServerTransport) dispatchToMethodFake(req *http.Request, method st } } +func (p *PoolsServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { + if p.srv.CheckNameAvailability == nil { + return nil, &nonRetriableError{errors.New("fake for method CheckNameAvailability not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/checkNameAvailability` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 1 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armdevopsinfrastructure.CheckNameAvailability](req) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.CheckNameAvailability(req.Context(), body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CheckNameAvailabilityResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (p *PoolsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { if p.srv.BeginCreateOrUpdate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go index e67fb049e3a9..81e28d410246 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client.go @@ -41,7 +41,7 @@ func NewImageVersionsClient(subscriptionID string, credential azcore.TokenCreden // NewListByImagePager - List ImageVersion resources by Image // -// Generated from API version 2024-10-19 +// Generated from API version 2025-01-21 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - imageName - Name of the image. // - options - ImageVersionsClientListByImageOptions contains the optional parameters for the ImageVersionsClient.NewListByImagePager @@ -89,7 +89,7 @@ func (client *ImageVersionsClient) listByImageCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-19") + reqQP.Set("api-version", "2025-01-21") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go index 7b5921223ee3..06abc8a1f545 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/imageversions_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2024-10-19/ImageVersions_ListByImage.json +// Generated from example definition: 2025-01-21/ImageVersions_ListByImage.json func ExampleImageVersionsClient_NewListByImagePager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go index 6ae02c449a5e..774b38db97c5 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models.go @@ -70,6 +70,30 @@ type AzureDevOpsPermissionProfile struct { Users []*string } +// CheckNameAvailability - The parameters used to check the availability of a resource. +type CheckNameAvailability struct { + // REQUIRED; The name of the resource. + Name *string + + // REQUIRED; The type of resource that is used as the scope of the availability check. + Type *ResourceType +} + +// CheckNameAvailabilityResult - The CheckNameAvailability operation response. +type CheckNameAvailabilityResult struct { + // REQUIRED; Availability status of the name. + Available *AvailabilityStatus + + // REQUIRED; A message explaining why the name is unavailable. Will be null if the name is available. + Message *string + + // REQUIRED; The name whose availability was checked. + Name *string + + // REQUIRED; The reason code explaining why the name is unavailable. Will be null if the name is available. + Reason *CheckNameAvailabilityReason +} + // DataDisk - The data disk of the VMSS. type DataDisk struct { // The type of caching to be enabled for the data disks. The default value for caching is readwrite. For information about @@ -198,12 +222,12 @@ type NetworkProfile struct { // 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. + // Localized display information for this particular operation. Display *OperationDisplay + // READ-ONLY; Extensible 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 Azure // Resource Manager/control-plane operations. IsDataAction *bool @@ -250,6 +274,9 @@ type Organization struct { // REQUIRED; The Azure DevOps organization URL in which the pool should be created. URL *string + // Determines if the pool should have open access to all projects in this organization. + OpenAccess *bool + // How many machines can be created at maximum in this organization out of the maximumConcurrency of the pool. Parallelism *int32 @@ -319,6 +346,9 @@ type PoolImage struct { // The percentage of the buffer to be allocated to this image. Buffer *string + // The ephemeral type of the image. + EphemeralType *EphemeralType + // The resource id of the image. ResourceID *string @@ -589,6 +619,9 @@ type SecretsManagementSettings struct { // Where to store certificates on the machine. CertificateStoreLocation *string + + // Name of the certificate store to use on the machine, currently 'My' and 'Root' are supported. + CertificateStoreName *CertificateStoreNameOption } // Stateful profile meaning that the machines will be returned to the pool after running a job. diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go index 507dc3d52167..259b1d3c84f7 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/models_serde.go @@ -147,6 +147,76 @@ func (a *AzureDevOpsPermissionProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailability. +func (c CheckNameAvailability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", c.Name) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailability. +func (c *CheckNameAvailability) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CheckNameAvailabilityResult. +func (c CheckNameAvailabilityResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "available", c.Available) + populate(objectMap, "message", c.Message) + populate(objectMap, "name", c.Name) + populate(objectMap, "reason", c.Reason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CheckNameAvailabilityResult. +func (c *CheckNameAvailabilityResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "available": + err = unpopulate(val, "Available", &c.Available) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &c.Message) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &c.Reason) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type DataDisk. func (d DataDisk) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -612,6 +682,7 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Organization. func (o Organization) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "openAccess", o.OpenAccess) populate(objectMap, "parallelism", o.Parallelism) populate(objectMap, "projects", o.Projects) populate(objectMap, "url", o.URL) @@ -627,6 +698,9 @@ func (o *Organization) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "openAccess": + err = unpopulate(val, "OpenAccess", &o.OpenAccess) + delete(rawMsg, key) case "parallelism": err = unpopulate(val, "Parallelism", &o.Parallelism) delete(rawMsg, key) @@ -793,6 +867,7 @@ func (p PoolImage) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "aliases", p.Aliases) populate(objectMap, "buffer", p.Buffer) + populate(objectMap, "ephemeralType", p.EphemeralType) populate(objectMap, "resourceId", p.ResourceID) populate(objectMap, "wellKnownImageName", p.WellKnownImageName) return json.Marshal(objectMap) @@ -813,6 +888,9 @@ func (p *PoolImage) UnmarshalJSON(data []byte) error { case "buffer": err = unpopulate(val, "Buffer", &p.Buffer) delete(rawMsg, key) + case "ephemeralType": + err = unpopulate(val, "EphemeralType", &p.EphemeralType) + delete(rawMsg, key) case "resourceId": err = unpopulate(val, "ResourceID", &p.ResourceID) delete(rawMsg, key) @@ -1497,6 +1575,7 @@ func (r *ResourceSKUZoneDetails) UnmarshalJSON(data []byte) error { func (s SecretsManagementSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "certificateStoreLocation", s.CertificateStoreLocation) + populate(objectMap, "certificateStoreName", s.CertificateStoreName) populate(objectMap, "keyExportable", s.KeyExportable) populate(objectMap, "observedCertificates", s.ObservedCertificates) return json.Marshal(objectMap) @@ -1514,6 +1593,9 @@ func (s *SecretsManagementSettings) UnmarshalJSON(data []byte) error { case "certificateStoreLocation": err = unpopulate(val, "CertificateStoreLocation", &s.CertificateStoreLocation) delete(rawMsg, key) + case "certificateStoreName": + err = unpopulate(val, "CertificateStoreName", &s.CertificateStoreName) + delete(rawMsg, key) case "keyExportable": err = unpopulate(val, "KeyExportable", &s.KeyExportable) delete(rawMsg, key) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go index ed41fb299331..dcc7f2d33a53 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/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-10-19 +// Generated from API version 2025-01-21 // - 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-10-19") + reqQP.Set("api-version", "2025-01-21") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go index 3808c6d3cfac..cabc7014187d 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/operations_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2024-10-19/ListOperations.json +// Generated from example definition: 2025-01-21/ListOperations.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go index 2da748c0acfc..8043e77cc7fd 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/options.go @@ -33,6 +33,11 @@ type PoolsClientBeginUpdateOptions struct { ResumeToken string } +// PoolsClientCheckNameAvailabilityOptions contains the optional parameters for the PoolsClient.CheckNameAvailability method. +type PoolsClientCheckNameAvailabilityOptions struct { + // placeholder for future optional parameters +} + // PoolsClientGetOptions contains the optional parameters for the PoolsClient.Get method. type PoolsClientGetOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go index 94873e863f47..6deb49e7a07a 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client.go @@ -39,10 +39,70 @@ func NewPoolsClient(subscriptionID string, credential azcore.TokenCredential, op return client, nil } +// CheckNameAvailability - Checks that the pool name is valid and is not already in use. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-21 +// - body - The CheckAvailability request +// - options - PoolsClientCheckNameAvailabilityOptions contains the optional parameters for the PoolsClient.CheckNameAvailability +// method. +func (client *PoolsClient) CheckNameAvailability(ctx context.Context, body CheckNameAvailability, options *PoolsClientCheckNameAvailabilityOptions) (PoolsClientCheckNameAvailabilityResponse, error) { + var err error + const operationName = "PoolsClient.CheckNameAvailability" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.checkNameAvailabilityCreateRequest(ctx, body, options) + if err != nil { + return PoolsClientCheckNameAvailabilityResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PoolsClientCheckNameAvailabilityResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PoolsClientCheckNameAvailabilityResponse{}, err + } + resp, err := client.checkNameAvailabilityHandleResponse(httpResp) + return resp, err +} + +// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. +func (client *PoolsClient) checkNameAvailabilityCreateRequest(ctx context.Context, body CheckNameAvailability, _ *PoolsClientCheckNameAvailabilityOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/checkNameAvailability" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-01-21") + 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 +} + +// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. +func (client *PoolsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (PoolsClientCheckNameAvailabilityResponse, error) { + result := PoolsClientCheckNameAvailabilityResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { + return PoolsClientCheckNameAvailabilityResponse{}, err + } + return result, nil +} + // BeginCreateOrUpdate - Create a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-19 +// Generated from API version 2025-01-21 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - resource - Resource create parameters. @@ -69,7 +129,7 @@ func (client *PoolsClient) BeginCreateOrUpdate(ctx context.Context, resourceGrou // CreateOrUpdate - Create a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-19 +// Generated from API version 2025-01-21 func (client *PoolsClient) createOrUpdate(ctx context.Context, resourceGroupName string, poolName string, resource Pool, options *PoolsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginCreateOrUpdate" @@ -111,7 +171,7 @@ func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-19") + reqQP.Set("api-version", "2025-01-21") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -124,7 +184,7 @@ func (client *PoolsClient) createOrUpdateCreateRequest(ctx context.Context, reso // BeginDelete - Delete a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-19 +// Generated from API version 2025-01-21 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - options - PoolsClientBeginDeleteOptions contains the optional parameters for the PoolsClient.BeginDelete method. @@ -148,7 +208,7 @@ func (client *PoolsClient) BeginDelete(ctx context.Context, resourceGroupName st // Delete - Delete a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-19 +// Generated from API version 2025-01-21 func (client *PoolsClient) deleteOperation(ctx context.Context, resourceGroupName string, poolName string, options *PoolsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginDelete" @@ -190,7 +250,7 @@ func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-19") + reqQP.Set("api-version", "2025-01-21") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -199,7 +259,7 @@ func (client *PoolsClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Get a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-19 +// Generated from API version 2025-01-21 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - options - PoolsClientGetOptions contains the optional parameters for the PoolsClient.Get method. @@ -245,7 +305,7 @@ func (client *PoolsClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-19") + reqQP.Set("api-version", "2025-01-21") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,7 +322,7 @@ func (client *PoolsClient) getHandleResponse(resp *http.Response) (PoolsClientGe // NewListByResourceGroupPager - List Pool resources by resource group // -// Generated from API version 2024-10-19 +// Generated from API version 2025-01-21 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - PoolsClientListByResourceGroupOptions contains the optional parameters for the PoolsClient.NewListByResourceGroupPager // method. @@ -305,7 +365,7 @@ func (client *PoolsClient) listByResourceGroupCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-19") + reqQP.Set("api-version", "2025-01-21") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,7 +382,7 @@ func (client *PoolsClient) listByResourceGroupHandleResponse(resp *http.Response // NewListBySubscriptionPager - List Pool resources by subscription ID // -// Generated from API version 2024-10-19 +// Generated from API version 2025-01-21 // - options - PoolsClientListBySubscriptionOptions contains the optional parameters for the PoolsClient.NewListBySubscriptionPager // method. func (client *PoolsClient) NewListBySubscriptionPager(options *PoolsClientListBySubscriptionOptions) *runtime.Pager[PoolsClientListBySubscriptionResponse] { @@ -360,7 +420,7 @@ func (client *PoolsClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-19") + reqQP.Set("api-version", "2025-01-21") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -378,7 +438,7 @@ func (client *PoolsClient) listBySubscriptionHandleResponse(resp *http.Response) // BeginUpdate - Update a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-19 +// Generated from API version 2025-01-21 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - properties - The resource properties to be updated. @@ -403,7 +463,7 @@ func (client *PoolsClient) BeginUpdate(ctx context.Context, resourceGroupName st // Update - Update a Pool // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-19 +// Generated from API version 2025-01-21 func (client *PoolsClient) update(ctx context.Context, resourceGroupName string, poolName string, properties PoolUpdate, options *PoolsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "PoolsClient.BeginUpdate" @@ -445,7 +505,7 @@ func (client *PoolsClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-19") + reqQP.Set("api-version", "2025-01-21") 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/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go index 7212fff354d0..4e09902a6239 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/pools_client_example_test.go @@ -12,7 +12,38 @@ import ( "log" ) -// Generated from example definition: 2024-10-19/CreateOrUpdatePool.json +// Generated from example definition: 2025-01-21/Pools_CheckNameAvailability.json +func ExamplePoolsClient_CheckNameAvailability() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armdevopsinfrastructure.NewClientFactory("a2e95d27-c161-4b61-bda4-11512c14c2c2", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPoolsClient().CheckNameAvailability(ctx, armdevopsinfrastructure.CheckNameAvailability{ + Name: to.Ptr("mydevopspool"), + Type: to.Ptr(armdevopsinfrastructure.ResourceTypeMicrosoftDevOpsInfrastructurePools), + }, 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 = armdevopsinfrastructure.PoolsClientCheckNameAvailabilityResponse{ + // CheckNameAvailabilityResult: &armdevopsinfrastructure.CheckNameAvailabilityResult{ + // Available: to.Ptr(armdevopsinfrastructure.AvailabilityStatusUnavailable), + // Message: to.Ptr("Managed DevOps pool mydevopspool is already in use. Please choose a pool name that has not been taken."), + // Name: to.Ptr("mydevopspool"), + // Reason: to.Ptr(armdevopsinfrastructure.CheckNameAvailabilityReasonAlreadyExists), + // }, + // } +} + +// Generated from example definition: 2025-01-21/CreateOrUpdatePool.json func ExamplePoolsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -33,7 +64,8 @@ func ExamplePoolsClient_BeginCreateOrUpdate() { Kind: to.Ptr("AzureDevOps"), Organizations: []*armdevopsinfrastructure.Organization{ { - URL: to.Ptr("https://mseng.visualstudio.com"), + URL: to.Ptr("https://mseng.visualstudio.com"), + OpenAccess: to.Ptr(true), }, }, }, @@ -47,7 +79,17 @@ func ExamplePoolsClient_BeginCreateOrUpdate() { }, Images: []*armdevopsinfrastructure.PoolImage{ { - ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), + ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), + EphemeralType: to.Ptr(armdevopsinfrastructure.EphemeralTypeAutomatic), + }, + }, + OSProfile: &armdevopsinfrastructure.OsProfile{ + SecretsManagementSettings: &armdevopsinfrastructure.SecretsManagementSettings{ + CertificateStoreName: to.Ptr(armdevopsinfrastructure.CertificateStoreNameOptionRoot), + ObservedCertificates: []*string{ + to.Ptr("https://abc.vault.azure.net/secrets/one"), + }, + KeyExportable: to.Ptr(false), }, }, }, @@ -90,6 +132,15 @@ func ExamplePoolsClient_BeginCreateOrUpdate() { // ResourceID: to.Ptr("/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest"), // }, // }, + // OSProfile: &armdevopsinfrastructure.OsProfile{ + // SecretsManagementSettings: &armdevopsinfrastructure.SecretsManagementSettings{ + // CertificateStoreName: to.Ptr(armdevopsinfrastructure.CertificateStoreNameOptionRoot), + // ObservedCertificates: []*string{ + // to.Ptr("https://abc.vault.azure.net/secrets/one"), + // }, + // KeyExportable: to.Ptr(false), + // }, + // }, // }, // }, // ID: to.Ptr("/subscriptions/a2e95d27-c161-4b61-bda4-11512c14c2c2/resourceGroups/rg/providers/Microsoft.DevOpsInfrastructure/Pools/pool"), @@ -98,7 +149,7 @@ func ExamplePoolsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: 2024-10-19/DeletePool.json +// Generated from example definition: 2025-01-21/DeletePool.json func ExamplePoolsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -119,7 +170,7 @@ func ExamplePoolsClient_BeginDelete() { } } -// Generated from example definition: 2024-10-19/GetPool.json +// Generated from example definition: 2025-01-21/GetPool.json func ExamplePoolsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -172,7 +223,7 @@ func ExamplePoolsClient_Get() { // } } -// Generated from example definition: 2024-10-19/ListPoolsBySubscriptionAndResourceGroup.json +// Generated from example definition: 2025-01-21/ListPoolsBySubscriptionAndResourceGroup.json func ExamplePoolsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -207,7 +258,7 @@ func ExamplePoolsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: 2024-10-19/ListPoolsBySubscription.json +// Generated from example definition: 2025-01-21/ListPoolsBySubscription.json func ExamplePoolsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -242,7 +293,7 @@ func ExamplePoolsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: 2024-10-19/UpdatePool.json +// Generated from example definition: 2025-01-21/UpdatePool.json func ExamplePoolsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go index a6f45ca24b4d..6cef375578f4 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client.go @@ -41,7 +41,7 @@ func NewResourceDetailsClient(subscriptionID string, credential azcore.TokenCred // NewListByPoolPager - List ResourceDetailsObject resources by Pool // -// Generated from API version 2024-10-19 +// Generated from API version 2025-01-21 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - poolName - Name of the pool. It needs to be globally unique. // - options - ResourceDetailsClientListByPoolOptions contains the optional parameters for the ResourceDetailsClient.NewListByPoolPager @@ -89,7 +89,7 @@ func (client *ResourceDetailsClient) listByPoolCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-19") + reqQP.Set("api-version", "2025-01-21") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go index 958a8be7c85a..5987c15e59a6 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/resourcedetails_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2024-10-19/ResourceDetails_ListByPool.json +// Generated from example definition: 2025-01-21/ResourceDetails_ListByPool.json func ExampleResourceDetailsClient_NewListByPoolPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go index ca74a46c3c40..c23ebf41bc71 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/responses.go @@ -16,6 +16,12 @@ type OperationsClientListResponse struct { OperationListResult } +// PoolsClientCheckNameAvailabilityResponse contains the response from method PoolsClient.CheckNameAvailability. +type PoolsClientCheckNameAvailabilityResponse struct { + // The CheckNameAvailability operation response. + CheckNameAvailabilityResult +} + // PoolsClientCreateOrUpdateResponse contains the response from method PoolsClient.BeginCreateOrUpdate. type PoolsClientCreateOrUpdateResponse struct { // Concrete tracked resource types can be created by aliasing this type using a specific property type. diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go index 1b3a6762c841..a0eb66968680 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client.go @@ -41,7 +41,7 @@ func NewSKUClient(subscriptionID string, credential azcore.TokenCredential, opti // NewListByLocationPager - List ResourceSku resources by subscription ID // -// Generated from API version 2024-10-19 +// Generated from API version 2025-01-21 // - locationName - Name of the location. // - options - SKUClientListByLocationOptions contains the optional parameters for the SKUClient.NewListByLocationPager method. func (client *SKUClient) NewListByLocationPager(locationName string, options *SKUClientListByLocationOptions) *runtime.Pager[SKUClientListByLocationResponse] { @@ -83,7 +83,7 @@ func (client *SKUClient) listByLocationCreateRequest(ctx context.Context, locati return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-19") + reqQP.Set("api-version", "2025-01-21") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go index 13f94b53335b..85d7e4dfba21 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/sku_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2024-10-19/Sku_ListByLocation.json +// Generated from example definition: 2025-01-21/Sku_ListByLocation.json func ExampleSKUClient_NewListByLocationPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go index f65ab469bb3e..f5ec7c90ba72 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client.go @@ -41,7 +41,7 @@ func NewSubscriptionUsagesClient(subscriptionID string, credential azcore.TokenC // NewUsagesPager - List Quota resources by subscription ID // -// Generated from API version 2024-10-19 +// Generated from API version 2025-01-21 // - location - The name of the Azure region. // - options - SubscriptionUsagesClientUsagesOptions contains the optional parameters for the SubscriptionUsagesClient.NewUsagesPager // method. @@ -84,7 +84,7 @@ func (client *SubscriptionUsagesClient) usagesCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-19") + reqQP.Set("api-version", "2025-01-21") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go index 89ea9b79654c..a78a73d9d59b 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/subscriptionusages_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2024-10-19/SubscriptionUsages_Usages.json +// Generated from example definition: 2025-01-21/SubscriptionUsages_Usages.json func ExampleSubscriptionUsagesClient_NewUsagesPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml index 77686a6437bb..52e128bd4c1b 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/devopsinfrastructure/Microsoft.DevOpsInfrastructure.Management -commit: d477c7caa09bf82e22c419be0a99d170552b5892 +commit: 676334a284e5136f0a0721d6ae844bb04332f579 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/impactreporting/armimpactreporting/CHANGELOG.md b/sdk/resourcemanager/impactreporting/armimpactreporting/CHANGELOG.md index 4109b5bd2a2e..a77df8e68303 100644 --- a/sdk/resourcemanager/impactreporting/armimpactreporting/CHANGELOG.md +++ b/sdk/resourcemanager/impactreporting/armimpactreporting/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2025-02-27) +### Other Changes + + ## 0.1.0 (2025-02-25) ### Other Changes diff --git a/sdk/resourcemanager/impactreporting/armimpactreporting/constants.go b/sdk/resourcemanager/impactreporting/armimpactreporting/constants.go index ef0ffc3378dc..9cdd8cb533dc 100644 --- a/sdk/resourcemanager/impactreporting/armimpactreporting/constants.go +++ b/sdk/resourcemanager/impactreporting/armimpactreporting/constants.go @@ -6,7 +6,7 @@ package armimpactreporting const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/impactreporting/armimpactreporting" - 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/impactreporting/armimpactreporting/tsp-location.yaml b/sdk/resourcemanager/impactreporting/armimpactreporting/tsp-location.yaml index f5b1e4191a76..f817b593d5bb 100644 --- a/sdk/resourcemanager/impactreporting/armimpactreporting/tsp-location.yaml +++ b/sdk/resourcemanager/impactreporting/armimpactreporting/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/impact/Impact.Management -commit: 2f4175af8e79fe3957f71c4d0c9c79d865622698 +commit: 676334a284e5136f0a0721d6ae844bb04332f579 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 127b7a374721..ad036648b878 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md +++ b/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2025-02-27) +### Other Changes + + ## 1.0.0 (2024-12-12) ### Breaking Changes diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/constants.go b/sdk/resourcemanager/iotoperations/armiotoperations/constants.go index 1cf40a4b83ed..9b717ae241d3 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 = "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/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/models.go b/sdk/resourcemanager/iotoperations/armiotoperations/models.go index ef1a2229ab7d..2c7a60ec3a49 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/models.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/models.go @@ -1134,12 +1134,12 @@ type Metrics struct { // 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. + // Localized display information for this particular operation. Display *OperationDisplay + // READ-ONLY; Extensible 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 Azure // Resource Manager/control-plane operations. IsDataAction *bool diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/tsp-location.yaml b/sdk/resourcemanager/iotoperations/armiotoperations/tsp-location.yaml index 613fd52508c3..f8a9e6a33599 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: ab67c148ec716a0d0075770742d54468f128c72e +commit: 676334a284e5136f0a0721d6ae844bb04332f579 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..643b6b773600 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md +++ b/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md @@ -1,5 +1,14 @@ # Release History +## 1.1.0-beta.1 (2025-02-27) +### Features Added + +- New enum type `DataAPIMode` with values `DataAPIModeDisabled`, `DataAPIModeEnabled` +- New struct `DataAPIProperties` +- New field `DataAPI` in struct `Properties` +- New field `DataAPI` in struct `UpdateProperties` + + ## 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..c742c7cf2bb3 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.1.0-beta.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -90,6 +90,24 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } +// DataAPIMode - The mode to apply to the Mongo Data API. +type DataAPIMode string + +const ( + // DataAPIModeDisabled - Mongo Data API is disabled for the cluster. + DataAPIModeDisabled DataAPIMode = "Disabled" + // DataAPIModeEnabled - Mongo Data API is enabled for the cluster. + DataAPIModeEnabled DataAPIMode = "Enabled" +) + +// PossibleDataAPIModeValues returns the possible values for the DataAPIMode const type. +func PossibleDataAPIModeValues() []DataAPIMode { + return []DataAPIMode{ + DataAPIModeDisabled, + DataAPIModeEnabled, + } +} + // HighAvailabilityMode - The high availability modes for a cluster. type HighAvailabilityMode string 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.go b/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client.go index 6796ca9e9b9c..f14df4739d24 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client.go @@ -42,7 +42,7 @@ func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - firewallRuleName - The name of the mongo cluster firewall rule. @@ -70,7 +70,7 @@ func (client *FirewallRulesClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule on a mongo cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview func (client *FirewallRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, resource FirewallRule, options *FirewallRulesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "FirewallRulesClient.BeginCreateOrUpdate" @@ -116,7 +116,7 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + 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"} @@ -129,7 +129,7 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Deletes a mongo cluster firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - firewallRuleName - The name of the mongo cluster firewall rule. @@ -155,7 +155,7 @@ func (client *FirewallRulesClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Deletes a mongo cluster firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview func (client *FirewallRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, mongoClusterName string, firewallRuleName string, options *FirewallRulesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "FirewallRulesClient.BeginDelete" @@ -201,7 +201,7 @@ func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -210,7 +210,7 @@ func (client *FirewallRulesClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets information about a mongo cluster firewall rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - firewallRuleName - The name of the mongo cluster firewall rule. @@ -261,7 +261,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -278,7 +278,7 @@ func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (Firew // NewListByMongoClusterPager - List all the firewall rules in a given mongo cluster. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - options - FirewallRulesClientListByMongoClusterOptions contains the optional parameters for the FirewallRulesClient.NewListByMongoClusterPager @@ -326,7 +326,7 @@ func (client *FirewallRulesClient) listByMongoClusterCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/firewallrules_client_example_test.go index 46b9b0d8cb32..7d26ee5a6f7e 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-10-01-preview/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-10-01-preview/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-10-01-preview/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-10-01-preview/MongoClusters_FirewallRuleList.json func ExampleFirewallRulesClient_NewListByMongoClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/models.go b/sdk/resourcemanager/mongocluster/armmongocluster/models.go index 9494835cd5da..93171db81dbe 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/models.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/models.go @@ -62,6 +62,12 @@ type ConnectionString struct { Name *string } +// DataAPIProperties - Data API properties. +type DataAPIProperties struct { + // The mode to indicate whether the Mongo Data API is enabled for a cluster. + Mode *DataAPIMode +} + // FirewallRule - Represents a mongo cluster firewall rule. type FirewallRule struct { // The resource-specific properties for this resource. @@ -148,12 +154,12 @@ type MongoCluster struct { // 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. + // Localized display information for this particular operation. Display *OperationDisplay + // READ-ONLY; Extensible 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 Azure // Resource Manager/control-plane operations. IsDataAction *bool @@ -337,6 +343,9 @@ type Properties struct { // The mode to create a mongo cluster. CreateMode *CreateMode + // The Data API properties of the mongo cluster. + DataAPI *DataAPIProperties + // The high availability properties of the mongo cluster. HighAvailability *HighAvailabilityProperties @@ -492,6 +501,9 @@ type UpdateProperties struct { // The compute properties of the mongo cluster. Compute *ComputeProperties + // The Data API properties of the mongo cluster. + DataAPI *DataAPIProperties + // The high availability properties of the mongo cluster. HighAvailability *HighAvailabilityProperties diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/models_serde.go b/sdk/resourcemanager/mongocluster/armmongocluster/models_serde.go index fba590971cba..82e653df63c0 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/models_serde.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/models_serde.go @@ -197,6 +197,33 @@ func (c *ConnectionString) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DataAPIProperties. +func (d DataAPIProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "mode", d.Mode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataAPIProperties. +func (d *DataAPIProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "mode": + err = unpopulate(val, "Mode", &d.Mode) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type FirewallRule. func (f FirewallRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -922,6 +949,7 @@ func (p Properties) MarshalJSON() ([]byte, error) { populate(objectMap, "compute", p.Compute) populate(objectMap, "connectionString", p.ConnectionString) populate(objectMap, "createMode", p.CreateMode) + populate(objectMap, "dataApi", p.DataAPI) populate(objectMap, "highAvailability", p.HighAvailability) populate(objectMap, "infrastructureVersion", p.InfrastructureVersion) populate(objectMap, "previewFeatures", p.PreviewFeatures) @@ -964,6 +992,9 @@ func (p *Properties) UnmarshalJSON(data []byte) error { case "createMode": err = unpopulate(val, "CreateMode", &p.CreateMode) delete(rawMsg, key) + case "dataApi": + err = unpopulate(val, "DataAPI", &p.DataAPI) + delete(rawMsg, key) case "highAvailability": err = unpopulate(val, "HighAvailability", &p.HighAvailability) delete(rawMsg, key) @@ -1317,6 +1348,7 @@ func (u UpdateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "administrator", u.Administrator) populate(objectMap, "backup", u.Backup) populate(objectMap, "compute", u.Compute) + populate(objectMap, "dataApi", u.DataAPI) populate(objectMap, "highAvailability", u.HighAvailability) populate(objectMap, "previewFeatures", u.PreviewFeatures) populate(objectMap, "publicNetworkAccess", u.PublicNetworkAccess) @@ -1344,6 +1376,9 @@ func (u *UpdateProperties) UnmarshalJSON(data []byte) error { case "compute": err = unpopulate(val, "Compute", &u.Compute) delete(rawMsg, key) + case "dataApi": + err = unpopulate(val, "DataAPI", &u.DataAPI) + delete(rawMsg, key) case "highAvailability": err = unpopulate(val, "HighAvailability", &u.HighAvailability) delete(rawMsg, key) diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go index 14410d6a7eab..741f5fc56c7a 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client.go @@ -42,8 +42,8 @@ func NewMongoClustersClient(subscriptionID string, credential azcore.TokenCreden // CheckNameAvailability - Check if mongo cluster name is available for use. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 -// - location - The location name. +// Generated from API version 2024-10-01-preview +// - location - The name of the Azure region. // - body - The CheckAvailability request // - options - MongoClustersClientCheckNameAvailabilityOptions contains the optional parameters for the MongoClustersClient.CheckNameAvailability // method. @@ -85,7 +85,7 @@ func (client *MongoClustersClient) checkNameAvailabilityCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + 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"} @@ -108,7 +108,7 @@ func (client *MongoClustersClient) checkNameAvailabilityHandleResponse(resp *htt // some of the properties, use PATCH. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - resource - Resource create parameters. @@ -136,7 +136,7 @@ func (client *MongoClustersClient) BeginCreateOrUpdate(ctx context.Context, reso // of the properties, use PATCH. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview func (client *MongoClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, mongoClusterName string, resource MongoCluster, options *MongoClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "MongoClustersClient.BeginCreateOrUpdate" @@ -178,7 +178,7 @@ func (client *MongoClustersClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + 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"} @@ -191,7 +191,7 @@ func (client *MongoClustersClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Deletes a mongo cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - options - MongoClustersClientBeginDeleteOptions contains the optional parameters for the MongoClustersClient.BeginDelete @@ -216,7 +216,7 @@ func (client *MongoClustersClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Deletes a mongo cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview func (client *MongoClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, mongoClusterName string, options *MongoClustersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "MongoClustersClient.BeginDelete" @@ -258,7 +258,7 @@ func (client *MongoClustersClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -267,7 +267,7 @@ func (client *MongoClustersClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets information about a mongo cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - options - MongoClustersClientGetOptions contains the optional parameters for the MongoClustersClient.Get method. @@ -313,7 +313,7 @@ func (client *MongoClustersClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -330,7 +330,7 @@ func (client *MongoClustersClient) getHandleResponse(resp *http.Response) (Mongo // NewListPager - List all the mongo clusters in a given subscription. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - options - MongoClustersClientListOptions contains the optional parameters for the MongoClustersClient.NewListPager method. func (client *MongoClustersClient) NewListPager(options *MongoClustersClientListOptions) *runtime.Pager[MongoClustersClientListResponse] { return runtime.NewPager(runtime.PagingHandler[MongoClustersClientListResponse]{ @@ -367,7 +367,7 @@ func (client *MongoClustersClient) listCreateRequest(ctx context.Context, _ *Mon return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -384,7 +384,7 @@ func (client *MongoClustersClient) listHandleResponse(resp *http.Response) (Mong // NewListByResourceGroupPager - List all the mongo clusters in a given resource group. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - MongoClustersClientListByResourceGroupOptions contains the optional parameters for the MongoClustersClient.NewListByResourceGroupPager // method. @@ -427,7 +427,7 @@ func (client *MongoClustersClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -446,7 +446,7 @@ func (client *MongoClustersClient) listByResourceGroupHandleResponse(resp *http. // as well as other connection strings supported by the cluster. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - options - MongoClustersClientListConnectionStringsOptions contains the optional parameters for the MongoClustersClient.ListConnectionStrings @@ -493,7 +493,7 @@ func (client *MongoClustersClient) listConnectionStringsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -511,7 +511,7 @@ func (client *MongoClustersClient) listConnectionStringsHandleResponse(resp *htt // BeginPromote - Promotes a replica mongo cluster to a primary role. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - body - The content of the action request @@ -537,7 +537,7 @@ func (client *MongoClustersClient) BeginPromote(ctx context.Context, resourceGro // Promote - Promotes a replica mongo cluster to a primary role. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview func (client *MongoClustersClient) promote(ctx context.Context, resourceGroupName string, mongoClusterName string, body PromoteReplicaRequest, options *MongoClustersClientBeginPromoteOptions) (*http.Response, error) { var err error const operationName = "MongoClustersClient.BeginPromote" @@ -579,7 +579,7 @@ func (client *MongoClustersClient) promoteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + 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"} @@ -593,7 +593,7 @@ func (client *MongoClustersClient) promoteCreateRequest(ctx context.Context, res // the normal mongo cluster definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - properties - The resource properties to be updated. @@ -620,7 +620,7 @@ func (client *MongoClustersClient) BeginUpdate(ctx context.Context, resourceGrou // mongo cluster definition. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview func (client *MongoClustersClient) update(ctx context.Context, resourceGroupName string, mongoClusterName string, properties Update, options *MongoClustersClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "MongoClustersClient.BeginUpdate" @@ -662,7 +662,7 @@ func (client *MongoClustersClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + 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"} diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client_example_test.go b/sdk/resourcemanager/mongocluster/armmongocluster/mongoclusters_client_example_test.go index 5e7f6481eb99..d07abec7a662 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-10-01-preview/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-10-01-preview/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-10-01-preview/MongoClusters_Create.json func ExampleMongoClustersClient_BeginCreateOrUpdate_createsANewMongoClusterResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -156,13 +156,16 @@ func ExampleMongoClustersClient_BeginCreateOrUpdate_createsANewMongoClusterResou // Replica: &armmongocluster.ReplicationProperties{ // Role: to.Ptr(armmongocluster.ReplicationRolePrimary), // }, + // DataAPI: &armmongocluster.DataAPIProperties{ + // Mode: to.Ptr(armmongocluster.DataAPIModeDisabled), + // }, // }, // Location: to.Ptr("westus2"), // }, // } } -// 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-10-01-preview/MongoClusters_CreateGeoReplica.json func ExampleMongoClustersClient_BeginCreateOrUpdate_createsAReplicaMongoClusterResourceFromASourceResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -230,13 +233,16 @@ func ExampleMongoClustersClient_BeginCreateOrUpdate_createsAReplicaMongoClusterR // SourceResourceID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/mySourceMongoCluster"), // ReplicationState: to.Ptr(armmongocluster.ReplicationStateProvisioning), // }, + // DataAPI: &armmongocluster.DataAPIProperties{ + // Mode: to.Ptr(armmongocluster.DataAPIModeDisabled), + // }, // }, // Location: to.Ptr("centralus"), // }, // } } -// 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-10-01-preview/MongoClusters_CreatePITR.json func ExampleMongoClustersClient_BeginCreateOrUpdate_createsAMongoClusterResourceFromAPointInTimeRestore() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -301,13 +307,16 @@ func ExampleMongoClustersClient_BeginCreateOrUpdate_createsAMongoClusterResource // Replica: &armmongocluster.ReplicationProperties{ // Role: to.Ptr(armmongocluster.ReplicationRolePrimary), // }, + // DataAPI: &armmongocluster.DataAPIProperties{ + // Mode: to.Ptr(armmongocluster.DataAPIModeDisabled), + // }, // }, // Location: to.Ptr("westus2"), // }, // } } -// 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-10-01-preview/MongoClusters_Delete.json func ExampleMongoClustersClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -328,7 +337,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-10-01-preview/MongoClusters_Get.json func ExampleMongoClustersClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -394,13 +403,16 @@ func ExampleMongoClustersClient_Get() { // ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive), // Role: to.Ptr(armmongocluster.ReplicationRolePrimary), // }, + // DataAPI: &armmongocluster.DataAPIProperties{ + // Mode: to.Ptr(armmongocluster.DataAPIModeDisabled), + // }, // }, // Location: to.Ptr("westus2"), // }, // } } -// 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-10-01-preview/MongoClusters_List.json func ExampleMongoClustersClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -472,6 +484,9 @@ func ExampleMongoClustersClient_NewListPager() { // ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive), // Role: to.Ptr(armmongocluster.ReplicationRolePrimary), // }, + // DataAPI: &armmongocluster.DataAPIProperties{ + // Mode: to.Ptr(armmongocluster.DataAPIModeDisabled), + // }, // }, // Location: to.Ptr("westus2"), // }, @@ -520,6 +535,9 @@ func ExampleMongoClustersClient_NewListPager() { // ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive), // Role: to.Ptr(armmongocluster.ReplicationRolePrimary), // }, + // DataAPI: &armmongocluster.DataAPIProperties{ + // Mode: to.Ptr(armmongocluster.DataAPIModeDisabled), + // }, // }, // Location: to.Ptr("eastus"), // }, @@ -529,7 +547,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-10-01-preview/MongoClusters_ListByResourceGroup.json func ExampleMongoClustersClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -601,6 +619,9 @@ func ExampleMongoClustersClient_NewListByResourceGroupPager() { // ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive), // Role: to.Ptr(armmongocluster.ReplicationRolePrimary), // }, + // DataAPI: &armmongocluster.DataAPIProperties{ + // Mode: to.Ptr(armmongocluster.DataAPIModeDisabled), + // }, // }, // Location: to.Ptr("westus2"), // }, @@ -649,6 +670,9 @@ func ExampleMongoClustersClient_NewListByResourceGroupPager() { // ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive), // Role: to.Ptr(armmongocluster.ReplicationRolePrimary), // }, + // DataAPI: &armmongocluster.DataAPIProperties{ + // Mode: to.Ptr(armmongocluster.DataAPIModeDisabled), + // }, // }, // Location: to.Ptr("eastus"), // }, @@ -658,7 +682,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-10-01-preview/MongoClusters_ListConnectionStrings.json func ExampleMongoClustersClient_ListConnectionStrings() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -688,7 +712,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-10-01-preview/MongoClusters_ForcePromoteReplica.json func ExampleMongoClustersClient_BeginPromote() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -712,7 +736,112 @@ 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-10-01-preview/MongoClusters_PatchDataApi.json +func ExampleMongoClustersClient_BeginUpdate_enablesDataApiOnAMongoClusterResource() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armmongocluster.NewClientFactory("ffffffff-ffff-ffff-ffff-ffffffffffff", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewMongoClustersClient().BeginUpdate(ctx, "TestResourceGroup", "myMongoCluster", armmongocluster.Update{ + Properties: &armmongocluster.UpdateProperties{ + DataAPI: &armmongocluster.DataAPIProperties{ + Mode: to.Ptr(armmongocluster.DataAPIModeEnabled), + }, + }, + }, 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 = armmongocluster.MongoClustersClientUpdateResponse{ + // MongoCluster: &armmongocluster.MongoCluster{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster"), + // Name: to.Ptr("myMongoCluster"), + // Type: to.Ptr("/Microsoft.DocumentDB/mongoClusters"), + // SystemData: &armmongocluster.SystemData{ + // CreatedBy: to.Ptr("user1"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T17:18:19.1234567Z"); return t}()), + // LastModifiedBy: to.Ptr("user2"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-02T17:18:19.1234567Z"); return t}()), + // }, + // Properties: &armmongocluster.Properties{ + // Administrator: &armmongocluster.AdministratorProperties{ + // UserName: to.Ptr("mongoAdmin"), + // }, + // ServerVersion: to.Ptr("5.0"), + // Storage: &armmongocluster.StorageProperties{ + // SizeGb: to.Ptr[int64](256), + // }, + // Compute: &armmongocluster.ComputeProperties{ + // Tier: to.Ptr("M30"), + // }, + // Sharding: &armmongocluster.ShardingProperties{ + // ShardCount: to.Ptr[int32](4), + // }, + // HighAvailability: &armmongocluster.HighAvailabilityProperties{ + // TargetMode: to.Ptr(armmongocluster.HighAvailabilityModeSameZone), + // }, + // Backup: &armmongocluster.BackupProperties{ + // EarliestRestoreTime: to.Ptr("2023-01-13T20:07:35Z"), + // }, + // PrivateEndpointConnections: []*armmongocluster.PrivateEndpointConnection{ + // { + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.DocumentDB/mongoClusters/myMongoCluster/privateEndpointConnections/mymongocluster-pe.ffffffff-ffff-ffff-ffff-ffffffffffff"), + // SystemData: &armmongocluster.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-06T04:00:25.0509765Z"); return t}()), + // CreatedBy: to.Ptr("ffffffff-ffff-ffff-ffff-ffffffffffff"), + // CreatedByType: to.Ptr(armmongocluster.CreatedByTypeApplication), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-02-06T04:00:25.0509765Z"); return t}()), + // LastModifiedBy: to.Ptr("ffffffff-ffff-ffff-ffff-ffffffffffff"), + // LastModifiedByType: to.Ptr(armmongocluster.CreatedByTypeApplication), + // }, + // Properties: &armmongocluster.PrivateEndpointConnectionProperties{ + // PrivateEndpoint: &armmongocluster.PrivateEndpoint{ + // ID: to.Ptr("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestResourceGroup/providers/Microsoft.Network/privateEndpoints/mymongocluster-pe"), + // }, + // GroupIDs: []*string{ + // to.Ptr("MongoCluster"), + // }, + // PrivateLinkServiceConnectionState: &armmongocluster.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armmongocluster.PrivateEndpointServiceConnectionStatusApproved), + // Description: to.Ptr("Auto-approved"), + // ActionsRequired: to.Ptr("None"), + // }, + // }, + // }, + // }, + // PreviewFeatures: []*armmongocluster.PreviewFeature{ + // }, + // InfrastructureVersion: to.Ptr("2.0"), + // PublicNetworkAccess: to.Ptr(armmongocluster.PublicNetworkAccessDisabled), + // ConnectionString: to.Ptr("mongodb+srv://:@myMongoCluster.mongocluster.cosmos.azure.com"), + // Replica: &armmongocluster.ReplicationProperties{ + // ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive), + // Role: to.Ptr(armmongocluster.ReplicationRolePrimary), + // }, + // DataAPI: &armmongocluster.DataAPIProperties{ + // Mode: to.Ptr(armmongocluster.DataAPIModeEnabled), + // }, + // }, + // Location: to.Ptr("westus2"), + // }, + // } +} + +// Generated from example definition: 2024-10-01-preview/MongoClusters_PatchDiskSize.json func ExampleMongoClustersClient_BeginUpdate_updatesTheDiskSizeOnAMongoClusterResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -782,13 +911,16 @@ func ExampleMongoClustersClient_BeginUpdate_updatesTheDiskSizeOnAMongoClusterRes // ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive), // Role: to.Ptr(armmongocluster.ReplicationRolePrimary), // }, + // DataAPI: &armmongocluster.DataAPIProperties{ + // Mode: to.Ptr(armmongocluster.DataAPIModeDisabled), + // }, // }, // Location: to.Ptr("westus2"), // }, // } } -// 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-10-01-preview/MongoClusters_PatchPrivateNetworkAccess.json func ExampleMongoClustersClient_BeginUpdate_disablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -882,13 +1014,16 @@ func ExampleMongoClustersClient_BeginUpdate_disablesPublicNetworkAccessOnAMongoC // ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive), // Role: to.Ptr(armmongocluster.ReplicationRolePrimary), // }, + // DataAPI: &armmongocluster.DataAPIProperties{ + // Mode: to.Ptr(armmongocluster.DataAPIModeDisabled), + // }, // }, // Location: to.Ptr("westus2"), // }, // } } -// 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-10-01-preview/MongoClusters_ResetPassword.json func ExampleMongoClustersClient_BeginUpdate_resetsTheAdministratorLoginPassword() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -959,13 +1094,16 @@ func ExampleMongoClustersClient_BeginUpdate_resetsTheAdministratorLoginPassword( // ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive), // Role: to.Ptr(armmongocluster.ReplicationRolePrimary), // }, + // DataAPI: &armmongocluster.DataAPIProperties{ + // Mode: to.Ptr(armmongocluster.DataAPIModeDisabled), + // }, // }, // Location: to.Ptr("westus2"), // }, // } } -// 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-10-01-preview/MongoClusters_Update.json func ExampleMongoClustersClient_BeginUpdate_updatesAMongoClusterResource() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1051,6 +1189,9 @@ func ExampleMongoClustersClient_BeginUpdate_updatesAMongoClusterResource() { // ReplicationState: to.Ptr(armmongocluster.ReplicationStateActive), // Role: to.Ptr(armmongocluster.ReplicationRolePrimary), // }, + // DataAPI: &armmongocluster.DataAPIProperties{ + // Mode: to.Ptr(armmongocluster.DataAPIModeDisabled), + // }, // }, // Location: to.Ptr("westus2"), // }, diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/operations_client.go b/sdk/resourcemanager/mongocluster/armmongocluster/operations_client.go index 92c1aa08839c..9de73877bc54 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/operations_client.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/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-07-01 +// 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]{ @@ -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-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, 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..8d1d7e995c38 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-10-01-preview/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client.go b/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client.go index 4a4bce2e5469..1faa32d0199a 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/privateendpointconnections_client.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/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-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. @@ -70,7 +70,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-07-01 +// Generated from API version 2024-10-01-preview func (client *PrivateEndpointConnectionsClient) create(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, resource PrivateEndpointConnectionResource, options *PrivateEndpointConnectionsClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginCreate" @@ -116,7 +116,7 @@ func (client *PrivateEndpointConnectionsClient) createCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + 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"} @@ -129,7 +129,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-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. @@ -155,7 +155,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-07-01 +// Generated from API version 2024-10-01-preview func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, mongoClusterName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PrivateEndpointConnectionsClient.BeginDelete" @@ -201,7 +201,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -210,7 +210,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-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - privateEndpointConnectionName - The name of the private endpoint connection associated with the Azure resource. @@ -262,7 +262,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -279,7 +279,7 @@ func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Res // NewListByMongoClusterPager - List existing private connections // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - options - PrivateEndpointConnectionsClientListByMongoClusterOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListByMongoClusterPager @@ -327,7 +327,7 @@ func (client *PrivateEndpointConnectionsClient) listByMongoClusterCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, 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..b74c02aa22ea 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-10-01-preview/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-10-01-preview/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-10-01-preview/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-10-01-preview/MongoClusters_PrivateEndpointConnectionList.json func ExamplePrivateEndpointConnectionsClient_NewListByMongoClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client.go b/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client.go index 840e98926789..00f3482c0faf 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/privatelinks_client.go @@ -41,7 +41,7 @@ func NewPrivateLinksClient(subscriptionID string, credential azcore.TokenCredent // NewListByMongoClusterPager - list private links on the given resource // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - options - PrivateLinksClientListByMongoClusterOptions contains the optional parameters for the PrivateLinksClient.NewListByMongoClusterPager @@ -89,7 +89,7 @@ func (client *PrivateLinksClient) listByMongoClusterCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, 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..22e24167562e 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-10-01-preview/MongoClusters_PrivateLinkResourceList.json func ExamplePrivateLinksClient_NewListByMongoClusterPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/replicas_client.go b/sdk/resourcemanager/mongocluster/armmongocluster/replicas_client.go index 61edf522a6f5..03b5b293df44 100644 --- a/sdk/resourcemanager/mongocluster/armmongocluster/replicas_client.go +++ b/sdk/resourcemanager/mongocluster/armmongocluster/replicas_client.go @@ -41,7 +41,7 @@ func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, // NewListByParentPager - List all the replicas for the mongo cluster. // -// Generated from API version 2024-07-01 +// Generated from API version 2024-10-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - mongoClusterName - The name of the mongo cluster. // - options - ReplicasClientListByParentOptions contains the optional parameters for the ReplicasClient.NewListByParentPager @@ -89,7 +89,7 @@ func (client *ReplicasClient) listByParentCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-07-01") + reqQP.Set("api-version", "2024-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, 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..49bbf366e086 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-10-01-preview/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..01993d153c08 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: 676334a284e5136f0a0721d6ae844bb04332f579 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/CHANGELOG.md b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/CHANGELOG.md index b1718bc8b92b..a7ad4b7dc158 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/CHANGELOG.md +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/CHANGELOG.md @@ -1,5 +1,259 @@ # Release History +## 1.0.0 (2025-02-27) +### Breaking Changes + +- Function `*ProtectedItemClient.BeginPlannedFailover` parameter(s) have been changed from `(context.Context, string, string, string, *ProtectedItemClientBeginPlannedFailoverOptions)` to `(context.Context, string, string, string, PlannedFailoverModel, *ProtectedItemClientBeginPlannedFailoverOptions)` +- Type of `EmailConfigurationModel.SystemData` has been changed from `*EmailConfigurationModelSystemData` to `*SystemData` +- Type of `EventModel.SystemData` has been changed from `*EventModelSystemData` to `*SystemData` +- Type of `FabricModel.SystemData` has been changed from `*FabricModelSystemData` to `*SystemData` +- Type of `FabricModelUpdate.SystemData` has been changed from `*FabricModelUpdateSystemData` to `*SystemData` +- Type of `PolicyModel.SystemData` has been changed from `*PolicyModelSystemData` to `*SystemData` +- Type of `ProtectedItemModel.SystemData` has been changed from `*ProtectedItemModelSystemData` to `*SystemData` +- Type of `ProtectedItemModelProperties.CurrentJob` has been changed from `*ProtectedItemModelPropertiesCurrentJob` to `*ProtectedItemJobProperties` +- Type of `ProtectedItemModelProperties.LastFailedEnableProtectionJob` has been changed from `*ProtectedItemModelPropertiesLastFailedEnableProtectionJob` to `*ProtectedItemJobProperties` +- Type of `ProtectedItemModelProperties.LastFailedPlannedFailoverJob` has been changed from `*ProtectedItemModelPropertiesLastFailedPlannedFailoverJob` to `*ProtectedItemJobProperties` +- Type of `ProtectedItemModelProperties.LastTestFailoverJob` has been changed from `*ProtectedItemModelPropertiesLastTestFailoverJob` to `*ProtectedItemJobProperties` +- Type of `RecoveryPointModel.SystemData` has been changed from `*RecoveryPointModelSystemData` to `*SystemData` +- Type of `ReplicationExtensionModel.SystemData` has been changed from `*ReplicationExtensionModelSystemData` to `*SystemData` +- Type of `VaultModel.SystemData` has been changed from `*VaultModelSystemData` to `*SystemData` +- Type of `VaultModelUpdate.SystemData` has been changed from `*VaultModelUpdateSystemData` to `*SystemData` +- Enum `WorkflowObjectType` has been removed +- Enum `WorkflowState` has been removed +- Function `NewAzureSiteRecoveryManagementServiceAPIClient` has been removed +- Function `*AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability` has been removed +- Function `*AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight` has been removed +- Function `*ClientFactory.NewAzureSiteRecoveryManagementServiceAPIClient` has been removed +- Function `*ClientFactory.NewDraClient` has been removed +- Function `*ClientFactory.NewDraOperationStatusClient` has been removed +- Function `*ClientFactory.NewFabricOperationsStatusClient` has been removed +- Function `*ClientFactory.NewPolicyOperationStatusClient` has been removed +- Function `*ClientFactory.NewProtectedItemOperationStatusClient` has been removed +- Function `*ClientFactory.NewRecoveryPointsClient` has been removed +- Function `*ClientFactory.NewReplicationExtensionOperationStatusClient` has been removed +- Function `*ClientFactory.NewVaultOperationStatusClient` has been removed +- Function `*ClientFactory.NewWorkflowClient` has been removed +- Function `*ClientFactory.NewWorkflowOperationStatusClient` has been removed +- Function `NewDraClient` has been removed +- Function `*DraClient.BeginCreate` has been removed +- Function `*DraClient.BeginDelete` has been removed +- Function `*DraClient.Get` has been removed +- Function `*DraClient.NewListPager` has been removed +- Function `*DraModelCustomProperties.GetDraModelCustomProperties` has been removed +- Function `NewDraOperationStatusClient` has been removed +- Function `*DraOperationStatusClient.Get` has been removed +- Function `NewFabricOperationsStatusClient` has been removed +- Function `*FabricOperationsStatusClient.Get` has been removed +- Function `*FailoverWorkflowModelCustomProperties.GetWorkflowModelCustomProperties` has been removed +- Function `NewPolicyOperationStatusClient` has been removed +- Function `*PolicyOperationStatusClient.Get` has been removed +- Function `NewProtectedItemOperationStatusClient` has been removed +- Function `*ProtectedItemOperationStatusClient.Get` has been removed +- Function `NewRecoveryPointsClient` has been removed +- Function `*RecoveryPointsClient.Get` has been removed +- Function `*RecoveryPointsClient.NewListPager` has been removed +- Function `NewReplicationExtensionOperationStatusClient` has been removed +- Function `*ReplicationExtensionOperationStatusClient.Get` has been removed +- Function `*TestFailoverCleanupWorkflowModelCustomProperties.GetWorkflowModelCustomProperties` has been removed +- Function `*TestFailoverWorkflowModelCustomProperties.GetWorkflowModelCustomProperties` has been removed +- Function `*VMwareDraModelCustomProperties.GetDraModelCustomProperties` has been removed +- Function `NewVaultOperationStatusClient` has been removed +- Function `*VaultOperationStatusClient.Get` has been removed +- Function `NewWorkflowClient` has been removed +- Function `*WorkflowClient.Get` has been removed +- Function `*WorkflowClient.NewListPager` has been removed +- Function `*WorkflowModelCustomProperties.GetWorkflowModelCustomProperties` has been removed +- Function `NewWorkflowOperationStatusClient` has been removed +- Function `*WorkflowOperationStatusClient.Get` has been removed +- Struct `DraModel` has been removed +- Struct `DraModelCollection` has been removed +- Struct `DraModelProperties` has been removed +- Struct `DraModelSystemData` has been removed +- Struct `EmailConfigurationModelCollection` has been removed +- Struct `EmailConfigurationModelSystemData` has been removed +- Struct `EventModelCollection` has been removed +- Struct `EventModelSystemData` has been removed +- Struct `FabricModelCollection` has been removed +- Struct `FabricModelSystemData` has been removed +- Struct `FabricModelUpdateSystemData` has been removed +- Struct `FailoverWorkflowModelCustomProperties` has been removed +- Struct `PolicyModelCollection` has been removed +- Struct `PolicyModelSystemData` has been removed +- Struct `ProtectedItemModelCollection` has been removed +- Struct `ProtectedItemModelPropertiesCurrentJob` has been removed +- Struct `ProtectedItemModelPropertiesLastFailedEnableProtectionJob` has been removed +- Struct `ProtectedItemModelPropertiesLastFailedPlannedFailoverJob` has been removed +- Struct `ProtectedItemModelPropertiesLastTestFailoverJob` has been removed +- Struct `ProtectedItemModelSystemData` has been removed +- Struct `RecoveryPointModelCollection` has been removed +- Struct `RecoveryPointModelSystemData` has been removed +- Struct `ReplicationExtensionModelCollection` has been removed +- Struct `ReplicationExtensionModelSystemData` has been removed +- Struct `TestFailoverCleanupWorkflowModelCustomProperties` has been removed +- Struct `TestFailoverWorkflowModelCustomProperties` has been removed +- Struct `VMwareDraModelCustomProperties` has been removed +- Struct `VaultModelCollection` has been removed +- Struct `VaultModelSystemData` has been removed +- Struct `VaultModelUpdateSystemData` has been removed +- Struct `WorkflowModel` has been removed +- Struct `WorkflowModelCollection` has been removed +- Struct `WorkflowModelProperties` has been removed +- Struct `WorkflowModelSystemData` has been removed +- Field `EmailConfigurationModelCollection` of struct `EmailConfigurationClientListResponse` has been removed +- Field `Filter` of struct `EventClientListOptions` has been removed +- Field `EventModelCollection` of struct `EventClientListResponse` has been removed +- Field `ContinuationToken` of struct `FabricClientListBySubscriptionOptions` has been removed +- Field `FabricModelCollection` of struct `FabricClientListBySubscriptionResponse` has been removed +- Field `FabricModelCollection` of struct `FabricClientListResponse` has been removed +- Field `SourceDraName`, `TargetDraName` of struct `HyperVToAzStackHCIProtectedItemModelCustomProperties` has been removed +- Field `PolicyModelCollection` of struct `PolicyClientListResponse` has been removed +- Field `Body` of struct `ProtectedItemClientBeginPlannedFailoverOptions` has been removed +- Field `ProtectedItemModelCollection` of struct `ProtectedItemClientListResponse` has been removed +- Field `DraID`, `TargetDraID` of struct `ProtectedItemModelProperties` has been removed +- Field `ReplicationExtensionModelCollection` of struct `ReplicationExtensionClientListResponse` has been removed +- Field `ChildrenWorkflows` of struct `TaskModel` has been removed +- Field `SourceDraName`, `TargetDraName` of struct `VMwareToAzStackHCIProtectedItemModelCustomProperties` has been removed +- Field `ContinuationToken` of struct `VaultClientListBySubscriptionOptions` has been removed +- Field `VaultModelCollection` of struct `VaultClientListBySubscriptionResponse` has been removed +- Field `VaultModelCollection` of struct `VaultClientListResponse` has been removed + +### Features Added + +- New enum type `CreatedByType` with values `CreatedByTypeApplication`, `CreatedByTypeKey`, `CreatedByTypeManagedIdentity`, `CreatedByTypeUser` +- New enum type `JobObjectType` with values `JobObjectTypeAvsDiskPool`, `JobObjectTypeFabric`, `JobObjectTypeFabricAgent`, `JobObjectTypePolicy`, `JobObjectTypeProtectedItem`, `JobObjectTypeRecoveryPlan`, `JobObjectTypeReplicationExtension`, `JobObjectTypeVault` +- New enum type `JobState` with values `JobStateCancelled`, `JobStateCancelling`, `JobStateCompletedWithErrors`, `JobStateCompletedWithInformation`, `JobStateCompletedWithWarnings`, `JobStateFailed`, `JobStatePending`, `JobStateStarted`, `JobStateSucceeded` +- New enum type `ManagedServiceIdentityType` with values `ManagedServiceIdentityTypeNone`, `ManagedServiceIdentityTypeSystemAssigned`, `ManagedServiceIdentityTypeSystemAssignedUserAssigned`, `ManagedServiceIdentityTypeUserAssigned` +- New enum type `PrivateEndpointConnectionStatus` with values `PrivateEndpointConnectionStatusApproved`, `PrivateEndpointConnectionStatusDisconnected`, `PrivateEndpointConnectionStatusPending`, `PrivateEndpointConnectionStatusRejected` +- New enum type `VaultIdentityType` with values `VaultIdentityTypeNone`, `VaultIdentityTypeSystemAssigned`, `VaultIdentityTypeUserAssigned` +- New function `NewCheckNameAvailabilityClient(string, azcore.TokenCredential, *arm.ClientOptions) (*CheckNameAvailabilityClient, error)` +- New function `*CheckNameAvailabilityClient.Post(context.Context, string, *CheckNameAvailabilityClientPostOptions) (CheckNameAvailabilityClientPostResponse, error)` +- New function `*ClientFactory.NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient` +- New function `*ClientFactory.NewDeploymentPreflightClient() *DeploymentPreflightClient` +- New function `*ClientFactory.NewFabricAgentClient() *FabricAgentClient` +- New function `*ClientFactory.NewJobClient() *JobClient` +- New function `*ClientFactory.NewOperationResultsClient() *OperationResultsClient` +- New function `*ClientFactory.NewPrivateEndpointConnectionProxiesClient() *PrivateEndpointConnectionProxiesClient` +- New function `*ClientFactory.NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient` +- New function `*ClientFactory.NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient` +- New function `*ClientFactory.NewRecoveryPointClient() *RecoveryPointClient` +- New function `NewDeploymentPreflightClient(string, azcore.TokenCredential, *arm.ClientOptions) (*DeploymentPreflightClient, error)` +- New function `*DeploymentPreflightClient.Post(context.Context, string, string, *DeploymentPreflightClientPostOptions) (DeploymentPreflightClientPostResponse, error)` +- New function `NewFabricAgentClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FabricAgentClient, error)` +- New function `*FabricAgentClient.BeginCreate(context.Context, string, string, string, FabricAgentModel, *FabricAgentClientBeginCreateOptions) (*runtime.Poller[FabricAgentClientCreateResponse], error)` +- New function `*FabricAgentClient.BeginDelete(context.Context, string, string, string, *FabricAgentClientBeginDeleteOptions) (*runtime.Poller[FabricAgentClientDeleteResponse], error)` +- New function `*FabricAgentClient.Get(context.Context, string, string, string, *FabricAgentClientGetOptions) (FabricAgentClientGetResponse, error)` +- New function `*FabricAgentClient.NewListPager(string, string, *FabricAgentClientListOptions) *runtime.Pager[FabricAgentClientListResponse]` +- New function `*FabricAgentModelCustomProperties.GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties` +- New function `*FailoverJobModelCustomProperties.GetJobModelCustomProperties() *JobModelCustomProperties` +- New function `*HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate.GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate` +- New function `NewJobClient(string, azcore.TokenCredential, *arm.ClientOptions) (*JobClient, error)` +- New function `*JobClient.Get(context.Context, string, string, string, *JobClientGetOptions) (JobClientGetResponse, error)` +- New function `*JobClient.NewListPager(string, string, *JobClientListOptions) *runtime.Pager[JobClientListResponse]` +- New function `*JobModelCustomProperties.GetJobModelCustomProperties() *JobModelCustomProperties` +- New function `NewOperationResultsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*OperationResultsClient, error)` +- New function `*OperationResultsClient.Get(context.Context, string, string, *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error)` +- New function `NewPrivateEndpointConnectionProxiesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateEndpointConnectionProxiesClient, error)` +- New function `*PrivateEndpointConnectionProxiesClient.Create(context.Context, string, string, string, PrivateEndpointConnectionProxy, *PrivateEndpointConnectionProxiesClientCreateOptions) (PrivateEndpointConnectionProxiesClientCreateResponse, error)` +- New function `*PrivateEndpointConnectionProxiesClient.BeginDelete(context.Context, string, string, string, *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionProxiesClientDeleteResponse], error)` +- New function `*PrivateEndpointConnectionProxiesClient.Get(context.Context, string, string, string, *PrivateEndpointConnectionProxiesClientGetOptions) (PrivateEndpointConnectionProxiesClientGetResponse, error)` +- New function `*PrivateEndpointConnectionProxiesClient.NewListPager(string, string, *PrivateEndpointConnectionProxiesClientListOptions) *runtime.Pager[PrivateEndpointConnectionProxiesClientListResponse]` +- New function `*PrivateEndpointConnectionProxiesClient.Validate(context.Context, string, string, string, PrivateEndpointConnectionProxy, *PrivateEndpointConnectionProxiesClientValidateOptions) (PrivateEndpointConnectionProxiesClientValidateResponse, error)` +- New function `NewPrivateEndpointConnectionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error)` +- New function `*PrivateEndpointConnectionsClient.BeginDelete(context.Context, string, string, string, *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error)` +- New function `*PrivateEndpointConnectionsClient.Get(context.Context, string, string, string, *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error)` +- New function `*PrivateEndpointConnectionsClient.NewListPager(string, string, *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse]` +- New function `*PrivateEndpointConnectionsClient.Update(context.Context, string, string, string, PrivateEndpointConnection, *PrivateEndpointConnectionsClientUpdateOptions) (PrivateEndpointConnectionsClientUpdateResponse, error)` +- New function `NewPrivateLinkResourcesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PrivateLinkResourcesClient, error)` +- New function `*PrivateLinkResourcesClient.Get(context.Context, string, string, string, *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error)` +- New function `*PrivateLinkResourcesClient.NewListPager(string, string, *PrivateLinkResourcesClientListOptions) *runtime.Pager[PrivateLinkResourcesClientListResponse]` +- New function `*ProtectedItemClient.BeginUpdate(context.Context, string, string, string, ProtectedItemModelUpdate, *ProtectedItemClientBeginUpdateOptions) (*runtime.Poller[ProtectedItemClientUpdateResponse], error)` +- New function `*ProtectedItemModelCustomPropertiesUpdate.GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate` +- New function `NewRecoveryPointClient(string, azcore.TokenCredential, *arm.ClientOptions) (*RecoveryPointClient, error)` +- New function `*RecoveryPointClient.Get(context.Context, string, string, string, string, *RecoveryPointClientGetOptions) (RecoveryPointClientGetResponse, error)` +- New function `*RecoveryPointClient.NewListPager(string, string, string, *RecoveryPointClientListOptions) *runtime.Pager[RecoveryPointClientListResponse]` +- New function `*TestFailoverCleanupJobModelCustomProperties.GetJobModelCustomProperties() *JobModelCustomProperties` +- New function `*TestFailoverJobModelCustomProperties.GetJobModelCustomProperties() *JobModelCustomProperties` +- New function `*VMwareFabricAgentModelCustomProperties.GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties` +- New function `*VMwareToAzStackHCIEventModelCustomProperties.GetEventModelCustomProperties() *EventModelCustomProperties` +- New function `*VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate.GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate` +- New function `*VMwareToAzStackHCIRecoveryPointModelCustomProperties.GetRecoveryPointModelCustomProperties() *RecoveryPointModelCustomProperties` +- New struct `ConnectionDetails` +- New struct `DiskControllerInputs` +- New struct `EmailConfigurationModelListResult` +- New struct `EventModelListResult` +- New struct `FabricAgentModel` +- New struct `FabricAgentModelListResult` +- New struct `FabricAgentModelProperties` +- New struct `FabricModelListResult` +- New struct `FailoverJobModelCustomProperties` +- New struct `GroupConnectivityInformation` +- New struct `HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate` +- New struct `JobModel` +- New struct `JobModelCustomPropertiesAffectedObjectDetails` +- New struct `JobModelListResult` +- New struct `JobModelProperties` +- New struct `ManagedServiceIdentity` +- New struct `PolicyModelListResult` +- New struct `PrivateEndpoint` +- New struct `PrivateEndpointConnection` +- New struct `PrivateEndpointConnectionListResult` +- New struct `PrivateEndpointConnectionProxy` +- New struct `PrivateEndpointConnectionProxyListResult` +- New struct `PrivateEndpointConnectionProxyProperties` +- New struct `PrivateEndpointConnectionResponseProperties` +- New struct `PrivateLinkResource` +- New struct `PrivateLinkResourceListResult` +- New struct `PrivateLinkResourceProperties` +- New struct `PrivateLinkServiceConnection` +- New struct `PrivateLinkServiceConnectionState` +- New struct `PrivateLinkServiceProxy` +- New struct `ProtectedItemJobProperties` +- New struct `ProtectedItemModelListResult` +- New struct `ProtectedItemModelPropertiesUpdate` +- New struct `ProtectedItemModelUpdate` +- New struct `RecoveryPointModelListResult` +- New struct `RemotePrivateEndpoint` +- New struct `RemotePrivateEndpointConnection` +- New struct `ReplicationExtensionModelListResult` +- New struct `SystemData` +- New struct `TestFailoverCleanupJobModelCustomProperties` +- New struct `TestFailoverJobModelCustomProperties` +- New struct `UserAssignedIdentity` +- New struct `VMwareFabricAgentModelCustomProperties` +- New struct `VMwareToAzStackHCIEventModelCustomProperties` +- New struct `VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate` +- New struct `VMwareToAzStackHCIRecoveryPointModelCustomProperties` +- New struct `VaultIdentityModel` +- New struct `VaultModelListResult` +- New field `Properties` in struct `DeploymentPreflightResource` +- New anonymous field `EmailConfigurationModelListResult` in struct `EmailConfigurationClientListResponse` +- New field `ProvisioningState` in struct `EmailConfigurationModelProperties` +- New field `OdataOptions`, `PageSize` in struct `EventClientListOptions` +- New anonymous field `EventModelListResult` in struct `EventClientListResponse` +- New field `ProvisioningState` in struct `EventModelProperties` +- New anonymous field `FabricModelListResult` in struct `FabricClientListBySubscriptionResponse` +- New anonymous field `FabricModelListResult` in struct `FabricClientListResponse` +- New field `DiskBlockSize`, `DiskController`, `DiskIdentifier`, `DiskLogicalSectorSize`, `DiskPhysicalSectorSize` in struct `HyperVToAzStackHCIDiskInput` +- New field `IsMacMigrationEnabled`, `IsStaticIPMigrationEnabled` in struct `HyperVToAzStackHCINicInput` +- New field `DiskBlockSize`, `DiskLogicalSectorSize`, `DiskPhysicalSectorSize` in struct `HyperVToAzStackHCIProtectedDiskProperties` +- New field `SourceFabricAgentName`, `TargetFabricAgentName` in struct `HyperVToAzStackHCIProtectedItemModelCustomProperties` +- New anonymous field `PolicyModelListResult` in struct `PolicyClientListResponse` +- New field `ContinuationToken`, `OdataOptions`, `PageSize` in struct `ProtectedItemClientListOptions` +- New anonymous field `ProtectedItemModelListResult` in struct `ProtectedItemClientListResponse` +- New field `FabricAgentID`, `TargetFabricAgentID` in struct `ProtectedItemModelProperties` +- New field `ProvisioningState` in struct `RecoveryPointModelProperties` +- New anonymous field `ReplicationExtensionModelListResult` in struct `ReplicationExtensionClientListResponse` +- New field `ChildrenJobs` in struct `TaskModel` +- New field `DiskBlockSize`, `DiskController`, `DiskIdentifier`, `DiskLogicalSectorSize`, `DiskPhysicalSectorSize` in struct `VMwareToAzStackHCIDiskInput` +- New field `IsMacMigrationEnabled`, `IsStaticIPMigrationEnabled` in struct `VMwareToAzStackHCINicInput` +- New field `DiskBlockSize`, `DiskLogicalSectorSize`, `DiskPhysicalSectorSize` in struct `VMwareToAzStackHCIProtectedDiskProperties` +- New field `SourceFabricAgentName`, `TargetFabricAgentName` in struct `VMwareToAzStackHCIProtectedItemModelCustomProperties` +- New anonymous field `VaultModelListResult` in struct `VaultClientListBySubscriptionResponse` +- New anonymous field `VaultModelListResult` in struct `VaultClientListResponse` +- New field `Identity` in struct `VaultModel` +- New field `Identity` in struct `VaultModelUpdate` + + ## 0.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/README.md b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/README.md index 8b606b67d68d..dc9d153c496b 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/README.md +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/README.md @@ -55,7 +55,7 @@ clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory( see https://aka.ms/autorest - -``` yaml -azure-arm: true -require: -- https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.2.0 -tag: package-2021-02-16-preview -``` \ No newline at end of file diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client.go deleted file mode 100644 index 2a3e44d70258..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client.go +++ /dev/null @@ -1,181 +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 armrecoveryservicesdatareplication - -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" -) - -// AzureSiteRecoveryManagementServiceAPIClient contains the methods for the AzureSiteRecoveryManagementServiceAPI group. -// Don't use this type directly, use NewAzureSiteRecoveryManagementServiceAPIClient() instead. -type AzureSiteRecoveryManagementServiceAPIClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAzureSiteRecoveryManagementServiceAPIClient creates a new instance of AzureSiteRecoveryManagementServiceAPIClient 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 NewAzureSiteRecoveryManagementServiceAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureSiteRecoveryManagementServiceAPIClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AzureSiteRecoveryManagementServiceAPIClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CheckNameAvailability - Checks the resource name availability. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - location - The name of the Azure region. -// - options - AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions contains the optional parameters for -// the AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability method. -func (client *AzureSiteRecoveryManagementServiceAPIClient) CheckNameAvailability(ctx context.Context, location string, options *AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions) (AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse, error) { - var err error - const operationName = "AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.checkNameAvailabilityCreateRequest(ctx, location, options) - if err != nil { - return AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse{}, err - } - resp, err := client.checkNameAvailabilityHandleResponse(httpResp) - return resp, err -} - -// checkNameAvailabilityCreateRequest creates the CheckNameAvailability request. -func (client *AzureSiteRecoveryManagementServiceAPIClient) checkNameAvailabilityCreateRequest(ctx context.Context, location string, options *AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability" - 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", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// checkNameAvailabilityHandleResponse handles the CheckNameAvailability response. -func (client *AzureSiteRecoveryManagementServiceAPIClient) checkNameAvailabilityHandleResponse(resp *http.Response) (AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse, error) { - result := AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponseModel); err != nil { - return AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse{}, err - } - return result, nil -} - -// DeploymentPreflight - Performs resource deployment validation. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - deploymentID - Deployment Id. -// - options - AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions contains the optional parameters for the -// AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight method. -func (client *AzureSiteRecoveryManagementServiceAPIClient) DeploymentPreflight(ctx context.Context, resourceGroupName string, deploymentID string, options *AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions) (AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse, error) { - var err error - const operationName = "AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deploymentPreflightCreateRequest(ctx, resourceGroupName, deploymentID, options) - if err != nil { - return AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse{}, err - } - resp, err := client.deploymentPreflightHandleResponse(httpResp) - return resp, err -} - -// deploymentPreflightCreateRequest creates the DeploymentPreflight request. -func (client *AzureSiteRecoveryManagementServiceAPIClient) deploymentPreflightCreateRequest(ctx context.Context, resourceGroupName string, deploymentID string, options *AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if deploymentID == "" { - return nil, errors.New("parameter deploymentID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{deploymentId}", url.PathEscape(deploymentID)) - 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", "2021-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil - } - return req, nil -} - -// deploymentPreflightHandleResponse handles the DeploymentPreflight response. -func (client *AzureSiteRecoveryManagementServiceAPIClient) deploymentPreflightHandleResponse(resp *http.Response) (AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse, error) { - result := AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentPreflightModel); err != nil { - return AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client_example_test.go deleted file mode 100644 index 2af8e81c4f31..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/azuresiterecoverymanagementserviceapi_client_example_test.go +++ /dev/null @@ -1,86 +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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/CheckNameAvailability.json -func ExampleAzureSiteRecoveryManagementServiceAPIClient_CheckNameAvailability() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureSiteRecoveryManagementServiceAPIClient().CheckNameAvailability(ctx, "trfqtbtmusswpibw", &armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions{Body: &armrecoveryservicesdatareplication.CheckNameAvailabilityModel{ - Name: to.Ptr("updkdcixs"), - Type: to.Ptr("gngmcancdauwhdixjjvqnfkvqc"), - }, - }) - 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.CheckNameAvailabilityResponseModel = armrecoveryservicesdatareplication.CheckNameAvailabilityResponseModel{ - // Message: to.Ptr("gddmrunlrhtuhm"), - // NameAvailable: to.Ptr(true), - // Reason: to.Ptr("wwbvswyrmghbmv"), - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/DeploymentPreflight.json -func ExampleAzureSiteRecoveryManagementServiceAPIClient_DeploymentPreflight() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAzureSiteRecoveryManagementServiceAPIClient().DeploymentPreflight(ctx, "rgrecoveryservicesdatareplication", "kjoiahxljomjcmvabaobumg", &armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions{Body: &armrecoveryservicesdatareplication.DeploymentPreflightModel{ - Resources: []*armrecoveryservicesdatareplication.DeploymentPreflightResource{ - { - Name: to.Ptr("xtgugoflfc"), - Type: to.Ptr("nsnaptduolqcxsikrewvgjbxqpt"), - APIVersion: to.Ptr("otihymhvzblycdoxo"), - Location: to.Ptr("cbsgtxkjdzwbyp"), - }}, - }, - }) - 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.DeploymentPreflightModel = armrecoveryservicesdatareplication.DeploymentPreflightModel{ - // Resources: []*armrecoveryservicesdatareplication.DeploymentPreflightResource{ - // { - // Name: to.Ptr("xtgugoflfc"), - // Type: to.Ptr("nsnaptduolqcxsikrewvgjbxqpt"), - // APIVersion: to.Ptr("otihymhvzblycdoxo"), - // Location: to.Ptr("cbsgtxkjdzwbyp"), - // }}, - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/build.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/build.go deleted file mode 100644 index cd5948344dab..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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/recoveryservicesdatareplication/armrecoveryservicesdatareplication - -package armrecoveryservicesdatareplication diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client.go new file mode 100644 index 000000000000..75fb4c8569d3 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client.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 armrecoveryservicesdatareplication + +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" +) + +// CheckNameAvailabilityClient contains the methods for the CheckNameAvailability group. +// Don't use this type directly, use NewCheckNameAvailabilityClient() instead. +type CheckNameAvailabilityClient struct { + internal *arm.Client + subscriptionID string +} + +// NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient 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 NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CheckNameAvailabilityClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CheckNameAvailabilityClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Post - Performs the resource name availability check. +// +// Checks the resource name availability. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - location - The name of the Azure region. +// - options - CheckNameAvailabilityClientPostOptions contains the optional parameters for the CheckNameAvailabilityClient.Post +// method. +func (client *CheckNameAvailabilityClient) Post(ctx context.Context, location string, options *CheckNameAvailabilityClientPostOptions) (CheckNameAvailabilityClientPostResponse, error) { + var err error + const operationName = "CheckNameAvailabilityClient.Post" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.postCreateRequest(ctx, location, options) + if err != nil { + return CheckNameAvailabilityClientPostResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CheckNameAvailabilityClientPostResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CheckNameAvailabilityClientPostResponse{}, err + } + resp, err := client.postHandleResponse(httpResp) + return resp, err +} + +// postCreateRequest creates the Post request. +func (client *CheckNameAvailabilityClient) postCreateRequest(ctx context.Context, location string, options *CheckNameAvailabilityClientPostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/locations/{location}/checkNameAvailability" + 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"} + 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 + } + return req, nil + } + return req, nil +} + +// postHandleResponse handles the Post response. +func (client *CheckNameAvailabilityClient) postHandleResponse(resp *http.Response) (CheckNameAvailabilityClientPostResponse, error) { + result := CheckNameAvailabilityClientPostResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponseModel); err != nil { + return CheckNameAvailabilityClientPostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client_example_test.go similarity index 52% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client_example_test.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client_example_test.go index 19de2a72b6a0..7ff513da7eb9 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/checknameavailability_client_example_test.go @@ -1,45 +1,44 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/VaultOperationStatus_Get.json -func ExampleVaultOperationStatusClient_Get() { +// Generated from example definition: 2024-09-01/CheckNameAvailability_Post.json +func ExampleCheckNameAvailabilityClient_Post() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewVaultOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "vsdvwe", nil) + res, err := clientFactory.NewCheckNameAvailabilityClient().Post(ctx, "trfqtbtmusswpibw", &CheckNameAvailabilityClientPostOptions{ + body: &armrecoveryservicesdatareplication.CheckNameAvailabilityModel{ + Name: to.Ptr("updkdcixs"), + Type: to.Ptr("gngmcancdauwhdixjjvqnfkvqc"), + }}) 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), + // res = armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostResponse{ + // CheckNameAvailabilityResponseModel: &armrecoveryservicesdatareplication.CheckNameAvailabilityResponseModel{ + // NameAvailable: to.Ptr(true), + // Reason: to.Ptr("wwbvswyrmghbmv"), + // Message: to.Ptr("gddmrunlrhtuhm"), + // }, // } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/client_factory.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/client_factory.go index 5524eca60a1b..2f1ce90c9bea 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/client_factory.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 armrecoveryservicesdatareplication @@ -17,8 +13,7 @@ import ( // Don't use this type directly, use NewClientFactory instead. type ClientFactory struct { subscriptionID string - credential azcore.TokenCredential - options *arm.ClientOptions + internal *arm.Client } // NewClientFactory creates a new instance of ClientFactory with the specified values. @@ -27,126 +22,147 @@ type ClientFactory struct { // - 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) { - _, err := arm.NewClient(moduleName, moduleVersion, credential, options) + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } return &ClientFactory{ - subscriptionID: subscriptionID, credential: credential, - options: options.Clone(), + subscriptionID: subscriptionID, + internal: internal, }, nil } -// NewAzureSiteRecoveryManagementServiceAPIClient creates a new instance of AzureSiteRecoveryManagementServiceAPIClient. -func (c *ClientFactory) NewAzureSiteRecoveryManagementServiceAPIClient() *AzureSiteRecoveryManagementServiceAPIClient { - subClient, _ := NewAzureSiteRecoveryManagementServiceAPIClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewDraClient creates a new instance of DraClient. -func (c *ClientFactory) NewDraClient() *DraClient { - subClient, _ := NewDraClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient. +func (c *ClientFactory) NewCheckNameAvailabilityClient() *CheckNameAvailabilityClient { + return &CheckNameAvailabilityClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewDraOperationStatusClient creates a new instance of DraOperationStatusClient. -func (c *ClientFactory) NewDraOperationStatusClient() *DraOperationStatusClient { - subClient, _ := NewDraOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewDeploymentPreflightClient creates a new instance of DeploymentPreflightClient. +func (c *ClientFactory) NewDeploymentPreflightClient() *DeploymentPreflightClient { + return &DeploymentPreflightClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewEmailConfigurationClient creates a new instance of EmailConfigurationClient. func (c *ClientFactory) NewEmailConfigurationClient() *EmailConfigurationClient { - subClient, _ := NewEmailConfigurationClient(c.subscriptionID, c.credential, c.options) - return subClient + return &EmailConfigurationClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewEventClient creates a new instance of EventClient. func (c *ClientFactory) NewEventClient() *EventClient { - subClient, _ := NewEventClient(c.subscriptionID, c.credential, c.options) - return subClient + return &EventClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewFabricAgentClient creates a new instance of FabricAgentClient. +func (c *ClientFactory) NewFabricAgentClient() *FabricAgentClient { + return &FabricAgentClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewFabricClient creates a new instance of FabricClient. func (c *ClientFactory) NewFabricClient() *FabricClient { - subClient, _ := NewFabricClient(c.subscriptionID, c.credential, c.options) - return subClient + return &FabricClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewFabricOperationsStatusClient creates a new instance of FabricOperationsStatusClient. -func (c *ClientFactory) NewFabricOperationsStatusClient() *FabricOperationsStatusClient { - subClient, _ := NewFabricOperationsStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewJobClient creates a new instance of JobClient. +func (c *ClientFactory) NewJobClient() *JobClient { + return &JobClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationResultsClient creates a new instance of OperationResultsClient. +func (c *ClientFactory) NewOperationResultsClient() *OperationResultsClient { + return &OperationResultsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { - subClient, _ := NewOperationsClient(c.credential, c.options) - return subClient + return &OperationsClient{ + internal: c.internal, + } } // NewPolicyClient creates a new instance of PolicyClient. func (c *ClientFactory) NewPolicyClient() *PolicyClient { - subClient, _ := NewPolicyClient(c.subscriptionID, c.credential, c.options) - return subClient + return &PolicyClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewPolicyOperationStatusClient creates a new instance of PolicyOperationStatusClient. -func (c *ClientFactory) NewPolicyOperationStatusClient() *PolicyOperationStatusClient { - subClient, _ := NewPolicyOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewPrivateEndpointConnectionProxiesClient creates a new instance of PrivateEndpointConnectionProxiesClient. +func (c *ClientFactory) NewPrivateEndpointConnectionProxiesClient() *PrivateEndpointConnectionProxiesClient { + return &PrivateEndpointConnectionProxiesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewProtectedItemClient creates a new instance of ProtectedItemClient. -func (c *ClientFactory) NewProtectedItemClient() *ProtectedItemClient { - subClient, _ := NewProtectedItemClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewProtectedItemOperationStatusClient creates a new instance of ProtectedItemOperationStatusClient. -func (c *ClientFactory) NewProtectedItemOperationStatusClient() *ProtectedItemOperationStatusClient { - subClient, _ := NewProtectedItemOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewRecoveryPointsClient creates a new instance of RecoveryPointsClient. -func (c *ClientFactory) NewRecoveryPointsClient() *RecoveryPointsClient { - subClient, _ := NewRecoveryPointsClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewProtectedItemClient creates a new instance of ProtectedItemClient. +func (c *ClientFactory) NewProtectedItemClient() *ProtectedItemClient { + return &ProtectedItemClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewReplicationExtensionClient creates a new instance of ReplicationExtensionClient. -func (c *ClientFactory) NewReplicationExtensionClient() *ReplicationExtensionClient { - subClient, _ := NewReplicationExtensionClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewRecoveryPointClient creates a new instance of RecoveryPointClient. +func (c *ClientFactory) NewRecoveryPointClient() *RecoveryPointClient { + return &RecoveryPointClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } -// NewReplicationExtensionOperationStatusClient creates a new instance of ReplicationExtensionOperationStatusClient. -func (c *ClientFactory) NewReplicationExtensionOperationStatusClient() *ReplicationExtensionOperationStatusClient { - subClient, _ := NewReplicationExtensionOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient +// NewReplicationExtensionClient creates a new instance of ReplicationExtensionClient. +func (c *ClientFactory) NewReplicationExtensionClient() *ReplicationExtensionClient { + return &ReplicationExtensionClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } // NewVaultClient creates a new instance of VaultClient. func (c *ClientFactory) NewVaultClient() *VaultClient { - subClient, _ := NewVaultClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewVaultOperationStatusClient creates a new instance of VaultOperationStatusClient. -func (c *ClientFactory) NewVaultOperationStatusClient() *VaultOperationStatusClient { - subClient, _ := NewVaultOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewWorkflowClient creates a new instance of WorkflowClient. -func (c *ClientFactory) NewWorkflowClient() *WorkflowClient { - subClient, _ := NewWorkflowClient(c.subscriptionID, c.credential, c.options) - return subClient -} - -// NewWorkflowOperationStatusClient creates a new instance of WorkflowOperationStatusClient. -func (c *ClientFactory) NewWorkflowOperationStatusClient() *WorkflowOperationStatusClient { - subClient, _ := NewWorkflowOperationStatusClient(c.subscriptionID, c.credential, c.options) - return subClient + return &VaultClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/constants.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/constants.go index bde98da71bdc..9910189149e4 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/constants.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/constants.go @@ -1,22 +1,19 @@ -//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 armrecoveryservicesdatareplication const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - moduleVersion = "v0.2.0" + moduleVersion = "v1.0.0" ) -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +// 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" ) @@ -27,13 +24,40 @@ func PossibleActionTypeValues() []ActionType { } } +// 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, + } +} + // HealthStatus - Gets or sets the fabric health. type HealthStatus string const ( + // HealthStatusCritical - Critical Status. HealthStatusCritical HealthStatus = "Critical" - HealthStatusNormal HealthStatus = "Normal" - HealthStatusWarning HealthStatus = "Warning" + // HealthStatusNormal - Healthy Status. + HealthStatusNormal HealthStatus = "Normal" + // HealthStatusWarning - Warning Status. + HealthStatusWarning HealthStatus = "Warning" ) // PossibleHealthStatusValues returns the possible values for the HealthStatus const type. @@ -45,13 +69,115 @@ func PossibleHealthStatusValues() []HealthStatus { } } +// JobObjectType - Gets or sets the object type. +type JobObjectType string + +const ( + // JobObjectTypeAvsDiskPool - AVS disk pool. + JobObjectTypeAvsDiskPool JobObjectType = "AvsDiskPool" + // JobObjectTypeFabric - Fabric level job. + JobObjectTypeFabric JobObjectType = "Fabric" + // JobObjectTypeFabricAgent - Fabric agent level workflow. + JobObjectTypeFabricAgent JobObjectType = "FabricAgent" + // JobObjectTypePolicy - Policy level job. + JobObjectTypePolicy JobObjectType = "Policy" + // JobObjectTypeProtectedItem - Protected item level job. + JobObjectTypeProtectedItem JobObjectType = "ProtectedItem" + // JobObjectTypeRecoveryPlan - Recovery plan level job. + JobObjectTypeRecoveryPlan JobObjectType = "RecoveryPlan" + // JobObjectTypeReplicationExtension - Replication extension level job. + JobObjectTypeReplicationExtension JobObjectType = "ReplicationExtension" + // JobObjectTypeVault - Vault level job. + JobObjectTypeVault JobObjectType = "Vault" +) + +// PossibleJobObjectTypeValues returns the possible values for the JobObjectType const type. +func PossibleJobObjectTypeValues() []JobObjectType { + return []JobObjectType{ + JobObjectTypeAvsDiskPool, + JobObjectTypeFabric, + JobObjectTypeFabricAgent, + JobObjectTypePolicy, + JobObjectTypeProtectedItem, + JobObjectTypeRecoveryPlan, + JobObjectTypeReplicationExtension, + JobObjectTypeVault, + } +} + +// JobState - Gets or sets the job state. +type JobState string + +const ( + // JobStateCancelled - Job has been cancelled. + JobStateCancelled JobState = "Cancelled" + // JobStateCancelling - Job cancellation is in progress. + JobStateCancelling JobState = "Cancelling" + // JobStateCompletedWithErrors - Job has completed with errors. + JobStateCompletedWithErrors JobState = "CompletedWithErrors" + // JobStateCompletedWithInformation - Job has completed with information. + JobStateCompletedWithInformation JobState = "CompletedWithInformation" + // JobStateCompletedWithWarnings - Job has completed with warnings. + JobStateCompletedWithWarnings JobState = "CompletedWithWarnings" + // JobStateFailed - Job failed. + JobStateFailed JobState = "Failed" + // JobStatePending - Job has not been started. + JobStatePending JobState = "Pending" + // JobStateStarted - Job is in progress. + JobStateStarted JobState = "Started" + // JobStateSucceeded - Job has completed successfully. + JobStateSucceeded JobState = "Succeeded" +) + +// PossibleJobStateValues returns the possible values for the JobState const type. +func PossibleJobStateValues() []JobState { + return []JobState{ + JobStateCancelled, + JobStateCancelling, + JobStateCompletedWithErrors, + JobStateCompletedWithInformation, + JobStateCompletedWithWarnings, + JobStateFailed, + JobStatePending, + JobStateStarted, + JobStateSucceeded, + } +} + +// ManagedServiceIdentityType - Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). +type ManagedServiceIdentityType string + +const ( + // ManagedServiceIdentityTypeNone - No managed identity. + ManagedServiceIdentityTypeNone ManagedServiceIdentityType = "None" + // ManagedServiceIdentityTypeSystemAssigned - System assigned managed identity. + ManagedServiceIdentityTypeSystemAssigned ManagedServiceIdentityType = "SystemAssigned" + // ManagedServiceIdentityTypeSystemAssignedUserAssigned - System and user assigned managed identity. + ManagedServiceIdentityTypeSystemAssignedUserAssigned ManagedServiceIdentityType = "SystemAssigned,UserAssigned" + // ManagedServiceIdentityTypeUserAssigned - User assigned managed identity. + ManagedServiceIdentityTypeUserAssigned ManagedServiceIdentityType = "UserAssigned" +) + +// PossibleManagedServiceIdentityTypeValues returns the possible values for the ManagedServiceIdentityType const type. +func PossibleManagedServiceIdentityTypeValues() []ManagedServiceIdentityType { + return []ManagedServiceIdentityType{ + ManagedServiceIdentityTypeNone, + ManagedServiceIdentityTypeSystemAssigned, + ManagedServiceIdentityTypeSystemAssignedUserAssigned, + ManagedServiceIdentityTypeUserAssigned, + } +} + // 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" + // 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" ) @@ -64,11 +190,37 @@ func PossibleOriginValues() []Origin { } } +// PrivateEndpointConnectionStatus - Gets or sets the status. +type PrivateEndpointConnectionStatus string + +const ( + // PrivateEndpointConnectionStatusApproved - Approved Status. + PrivateEndpointConnectionStatusApproved PrivateEndpointConnectionStatus = "Approved" + // PrivateEndpointConnectionStatusDisconnected - Disconnected Status. + PrivateEndpointConnectionStatusDisconnected PrivateEndpointConnectionStatus = "Disconnected" + // PrivateEndpointConnectionStatusPending - Pending Status. + PrivateEndpointConnectionStatusPending PrivateEndpointConnectionStatus = "Pending" + // PrivateEndpointConnectionStatusRejected - Rejected Status. + PrivateEndpointConnectionStatusRejected PrivateEndpointConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointConnectionStatusValues returns the possible values for the PrivateEndpointConnectionStatus const type. +func PossiblePrivateEndpointConnectionStatusValues() []PrivateEndpointConnectionStatus { + return []PrivateEndpointConnectionStatus{ + PrivateEndpointConnectionStatusApproved, + PrivateEndpointConnectionStatusDisconnected, + PrivateEndpointConnectionStatusPending, + PrivateEndpointConnectionStatusRejected, + } +} + // ProtectedItemActiveLocation - Gets or sets the location of the protected item. type ProtectedItemActiveLocation string const ( - ProtectedItemActiveLocationPrimary ProtectedItemActiveLocation = "Primary" + // ProtectedItemActiveLocationPrimary - Protected item is active on Primary. + ProtectedItemActiveLocationPrimary ProtectedItemActiveLocation = "Primary" + // ProtectedItemActiveLocationRecovery - Protected item is active on Recovery. ProtectedItemActiveLocationRecovery ProtectedItemActiveLocation = "Recovery" ) @@ -84,58 +236,112 @@ func PossibleProtectedItemActiveLocationValues() []ProtectedItemActiveLocation { type ProtectionState string const ( - ProtectionStateCancelFailoverFailedOnPrimary ProtectionState = "CancelFailoverFailedOnPrimary" - ProtectionStateCancelFailoverFailedOnRecovery ProtectionState = "CancelFailoverFailedOnRecovery" - ProtectionStateCancelFailoverInProgressOnPrimary ProtectionState = "CancelFailoverInProgressOnPrimary" - ProtectionStateCancelFailoverInProgressOnRecovery ProtectionState = "CancelFailoverInProgressOnRecovery" - ProtectionStateCancelFailoverStatesBegin ProtectionState = "CancelFailoverStatesBegin" - ProtectionStateCancelFailoverStatesEnd ProtectionState = "CancelFailoverStatesEnd" - ProtectionStateChangeRecoveryPointCompleted ProtectionState = "ChangeRecoveryPointCompleted" - ProtectionStateChangeRecoveryPointFailed ProtectionState = "ChangeRecoveryPointFailed" - ProtectionStateChangeRecoveryPointInitiated ProtectionState = "ChangeRecoveryPointInitiated" - ProtectionStateChangeRecoveryPointStatesBegin ProtectionState = "ChangeRecoveryPointStatesBegin" - ProtectionStateChangeRecoveryPointStatesEnd ProtectionState = "ChangeRecoveryPointStatesEnd" - ProtectionStateCommitFailoverCompleted ProtectionState = "CommitFailoverCompleted" - ProtectionStateCommitFailoverFailedOnPrimary ProtectionState = "CommitFailoverFailedOnPrimary" - ProtectionStateCommitFailoverFailedOnRecovery ProtectionState = "CommitFailoverFailedOnRecovery" - ProtectionStateCommitFailoverInProgressOnPrimary ProtectionState = "CommitFailoverInProgressOnPrimary" - ProtectionStateCommitFailoverInProgressOnRecovery ProtectionState = "CommitFailoverInProgressOnRecovery" - ProtectionStateCommitFailoverStatesBegin ProtectionState = "CommitFailoverStatesBegin" - ProtectionStateCommitFailoverStatesEnd ProtectionState = "CommitFailoverStatesEnd" - ProtectionStateDisablingFailed ProtectionState = "DisablingFailed" - ProtectionStateDisablingProtection ProtectionState = "DisablingProtection" - ProtectionStateEnablingFailed ProtectionState = "EnablingFailed" - ProtectionStateEnablingProtection ProtectionState = "EnablingProtection" - ProtectionStateInitialReplicationCompletedOnPrimary ProtectionState = "InitialReplicationCompletedOnPrimary" - ProtectionStateInitialReplicationCompletedOnRecovery ProtectionState = "InitialReplicationCompletedOnRecovery" - ProtectionStateInitialReplicationFailed ProtectionState = "InitialReplicationFailed" - ProtectionStateInitialReplicationInProgress ProtectionState = "InitialReplicationInProgress" - ProtectionStateInitialReplicationStatesBegin ProtectionState = "InitialReplicationStatesBegin" - ProtectionStateInitialReplicationStatesEnd ProtectionState = "InitialReplicationStatesEnd" - ProtectionStateMarkedForDeletion ProtectionState = "MarkedForDeletion" - ProtectionStatePlannedFailoverCompleted ProtectionState = "PlannedFailoverCompleted" - ProtectionStatePlannedFailoverCompleting ProtectionState = "PlannedFailoverCompleting" - ProtectionStatePlannedFailoverCompletionFailed ProtectionState = "PlannedFailoverCompletionFailed" - ProtectionStatePlannedFailoverFailed ProtectionState = "PlannedFailoverFailed" - ProtectionStatePlannedFailoverInitiated ProtectionState = "PlannedFailoverInitiated" - ProtectionStatePlannedFailoverTransitionStatesBegin ProtectionState = "PlannedFailoverTransitionStatesBegin" - ProtectionStatePlannedFailoverTransitionStatesEnd ProtectionState = "PlannedFailoverTransitionStatesEnd" - ProtectionStateProtected ProtectionState = "Protected" - ProtectionStateProtectedStatesBegin ProtectionState = "ProtectedStatesBegin" - ProtectionStateProtectedStatesEnd ProtectionState = "ProtectedStatesEnd" - ProtectionStateReprotectFailed ProtectionState = "ReprotectFailed" - ProtectionStateReprotectInitiated ProtectionState = "ReprotectInitiated" - ProtectionStateReprotectStatesBegin ProtectionState = "ReprotectStatesBegin" - ProtectionStateReprotectStatesEnd ProtectionState = "ReprotectStatesEnd" - ProtectionStateUnplannedFailoverCompleted ProtectionState = "UnplannedFailoverCompleted" - ProtectionStateUnplannedFailoverCompleting ProtectionState = "UnplannedFailoverCompleting" - ProtectionStateUnplannedFailoverCompletionFailed ProtectionState = "UnplannedFailoverCompletionFailed" - ProtectionStateUnplannedFailoverFailed ProtectionState = "UnplannedFailoverFailed" - ProtectionStateUnplannedFailoverInitiated ProtectionState = "UnplannedFailoverInitiated" + // ProtectionStateCancelFailoverFailedOnPrimary - Cancel failover failed on the primary side. + ProtectionStateCancelFailoverFailedOnPrimary ProtectionState = "CancelFailoverFailedOnPrimary" + // ProtectionStateCancelFailoverFailedOnRecovery - Cancel failover failed on the recovery side. + ProtectionStateCancelFailoverFailedOnRecovery ProtectionState = "CancelFailoverFailedOnRecovery" + // ProtectionStateCancelFailoverInProgressOnPrimary - Cancel failover is in progress on the primary side. + ProtectionStateCancelFailoverInProgressOnPrimary ProtectionState = "CancelFailoverInProgressOnPrimary" + // ProtectionStateCancelFailoverInProgressOnRecovery - Cancel failover is in progress on the recovery side. + ProtectionStateCancelFailoverInProgressOnRecovery ProtectionState = "CancelFailoverInProgressOnRecovery" + // ProtectionStateCancelFailoverStatesBegin - Begin marker for cancel failover states. + ProtectionStateCancelFailoverStatesBegin ProtectionState = "CancelFailoverStatesBegin" + // ProtectionStateCancelFailoverStatesEnd - End marker for cancel failover states. + ProtectionStateCancelFailoverStatesEnd ProtectionState = "CancelFailoverStatesEnd" + // ProtectionStateChangeRecoveryPointCompleted - Change recovery point has been completed successfully. + ProtectionStateChangeRecoveryPointCompleted ProtectionState = "ChangeRecoveryPointCompleted" + // ProtectionStateChangeRecoveryPointFailed - Change recovery point has failed. + ProtectionStateChangeRecoveryPointFailed ProtectionState = "ChangeRecoveryPointFailed" + // ProtectionStateChangeRecoveryPointInitiated - Change recovery point has been initiated.. + ProtectionStateChangeRecoveryPointInitiated ProtectionState = "ChangeRecoveryPointInitiated" + // ProtectionStateChangeRecoveryPointStatesBegin - Begin marker for change recovery point states. + ProtectionStateChangeRecoveryPointStatesBegin ProtectionState = "ChangeRecoveryPointStatesBegin" + // ProtectionStateChangeRecoveryPointStatesEnd - End marker for change recovery point states. + ProtectionStateChangeRecoveryPointStatesEnd ProtectionState = "ChangeRecoveryPointStatesEnd" + // ProtectionStateCommitFailoverCompleted - Commit failover has been completed successfully. + ProtectionStateCommitFailoverCompleted ProtectionState = "CommitFailoverCompleted" + // ProtectionStateCommitFailoverFailedOnPrimary - Commit failover failed on the primary side. + ProtectionStateCommitFailoverFailedOnPrimary ProtectionState = "CommitFailoverFailedOnPrimary" + // ProtectionStateCommitFailoverFailedOnRecovery - Commit failover failed on the recovery side. + ProtectionStateCommitFailoverFailedOnRecovery ProtectionState = "CommitFailoverFailedOnRecovery" + // ProtectionStateCommitFailoverInProgressOnPrimary - Commit failover is in progress on the primary side. + ProtectionStateCommitFailoverInProgressOnPrimary ProtectionState = "CommitFailoverInProgressOnPrimary" + // ProtectionStateCommitFailoverInProgressOnRecovery - Commit failover is in progress on the recovery side. + ProtectionStateCommitFailoverInProgressOnRecovery ProtectionState = "CommitFailoverInProgressOnRecovery" + // ProtectionStateCommitFailoverStatesBegin - Begin marker for commit failover states. + ProtectionStateCommitFailoverStatesBegin ProtectionState = "CommitFailoverStatesBegin" + // ProtectionStateCommitFailoverStatesEnd - End marker for commit failover states. + ProtectionStateCommitFailoverStatesEnd ProtectionState = "CommitFailoverStatesEnd" + // ProtectionStateDisablingFailed - Disable protection failed. + ProtectionStateDisablingFailed ProtectionState = "DisablingFailed" + // ProtectionStateDisablingProtection - Disabling protection is in progress. + ProtectionStateDisablingProtection ProtectionState = "DisablingProtection" + // ProtectionStateEnablingFailed - Enable protection failed. + ProtectionStateEnablingFailed ProtectionState = "EnablingFailed" + // ProtectionStateEnablingProtection - Enable protection is in progress. + ProtectionStateEnablingProtection ProtectionState = "EnablingProtection" + // ProtectionStateInitialReplicationCompletedOnPrimary - Initial replication has completed on the primary side. + ProtectionStateInitialReplicationCompletedOnPrimary ProtectionState = "InitialReplicationCompletedOnPrimary" + // ProtectionStateInitialReplicationCompletedOnRecovery - Initial replication has completed on the recovery side. + ProtectionStateInitialReplicationCompletedOnRecovery ProtectionState = "InitialReplicationCompletedOnRecovery" + // ProtectionStateInitialReplicationFailed - Initial replication failed and would need to be started again. + ProtectionStateInitialReplicationFailed ProtectionState = "InitialReplicationFailed" + // ProtectionStateInitialReplicationInProgress - Initial replication is in progress. + ProtectionStateInitialReplicationInProgress ProtectionState = "InitialReplicationInProgress" + // ProtectionStateInitialReplicationStatesBegin - Begin marker for initial replication states. + ProtectionStateInitialReplicationStatesBegin ProtectionState = "InitialReplicationStatesBegin" + // ProtectionStateInitialReplicationStatesEnd - End marker for initial replication states. + ProtectionStateInitialReplicationStatesEnd ProtectionState = "InitialReplicationStatesEnd" + // ProtectionStateMarkedForDeletion - Disabling protection succeeded. This is a transient state before the protected item + // is deleted. + ProtectionStateMarkedForDeletion ProtectionState = "MarkedForDeletion" + // ProtectionStatePlannedFailoverCompleted - Planned failover has been completed successfully. + ProtectionStatePlannedFailoverCompleted ProtectionState = "PlannedFailoverCompleted" + // ProtectionStatePlannedFailoverCompleting - Planned failover preparing protected entities is in progress. + ProtectionStatePlannedFailoverCompleting ProtectionState = "PlannedFailoverCompleting" + // ProtectionStatePlannedFailoverCompletionFailed - Planned failover preparing protected entities failed. + ProtectionStatePlannedFailoverCompletionFailed ProtectionState = "PlannedFailoverCompletionFailed" + // ProtectionStatePlannedFailoverFailed - Planned failover initiation failed. + ProtectionStatePlannedFailoverFailed ProtectionState = "PlannedFailoverFailed" + // ProtectionStatePlannedFailoverInitiated - Planned failover has been initiated. + ProtectionStatePlannedFailoverInitiated ProtectionState = "PlannedFailoverInitiated" + // ProtectionStatePlannedFailoverTransitionStatesBegin - Begin marker for planned failover transition states. + ProtectionStatePlannedFailoverTransitionStatesBegin ProtectionState = "PlannedFailoverTransitionStatesBegin" + // ProtectionStatePlannedFailoverTransitionStatesEnd - End marker for planned failover transition states. + ProtectionStatePlannedFailoverTransitionStatesEnd ProtectionState = "PlannedFailoverTransitionStatesEnd" + // ProtectionStateProtected - Protected item is protected and replication is on-going. Any issues with replication will be + // surfaced separately via the health property and will not affect the state. + ProtectionStateProtected ProtectionState = "Protected" + // ProtectionStateProtectedStatesBegin - Begin marker for protected steady-state states. + ProtectionStateProtectedStatesBegin ProtectionState = "ProtectedStatesBegin" + // ProtectionStateProtectedStatesEnd - End marker for protected steady-state states. + ProtectionStateProtectedStatesEnd ProtectionState = "ProtectedStatesEnd" + // ProtectionStateReprotectFailed - Reprotect has failed. + ProtectionStateReprotectFailed ProtectionState = "ReprotectFailed" + // ProtectionStateReprotectInitiated - Reprotect has been initiated. + ProtectionStateReprotectInitiated ProtectionState = "ReprotectInitiated" + // ProtectionStateReprotectStatesBegin - Begin marker for reprotect states. + ProtectionStateReprotectStatesBegin ProtectionState = "ReprotectStatesBegin" + // ProtectionStateReprotectStatesEnd - End marker for reprotect states. + ProtectionStateReprotectStatesEnd ProtectionState = "ReprotectStatesEnd" + // ProtectionStateUnplannedFailoverCompleted - Unplanned failover preparing protected entities is in progress. + ProtectionStateUnplannedFailoverCompleted ProtectionState = "UnplannedFailoverCompleted" + // ProtectionStateUnplannedFailoverCompleting - Unplanned failover preparing protected entities is in progress. + ProtectionStateUnplannedFailoverCompleting ProtectionState = "UnplannedFailoverCompleting" + // ProtectionStateUnplannedFailoverCompletionFailed - Unplanned failover preparing protected entities failed. + ProtectionStateUnplannedFailoverCompletionFailed ProtectionState = "UnplannedFailoverCompletionFailed" + // ProtectionStateUnplannedFailoverFailed - Unplanned failover initiation failed. + ProtectionStateUnplannedFailoverFailed ProtectionState = "UnplannedFailoverFailed" + // ProtectionStateUnplannedFailoverInitiated - Unplanned failover has been initiated. + ProtectionStateUnplannedFailoverInitiated ProtectionState = "UnplannedFailoverInitiated" + // ProtectionStateUnplannedFailoverTransitionStatesBegin - Begin marker for unplanned failover transition states. ProtectionStateUnplannedFailoverTransitionStatesBegin ProtectionState = "UnplannedFailoverTransitionStatesBegin" - ProtectionStateUnplannedFailoverTransitionStatesEnd ProtectionState = "UnplannedFailoverTransitionStatesEnd" - ProtectionStateUnprotectedStatesBegin ProtectionState = "UnprotectedStatesBegin" - ProtectionStateUnprotectedStatesEnd ProtectionState = "UnprotectedStatesEnd" + // ProtectionStateUnplannedFailoverTransitionStatesEnd - End marker for unplanned failover transition states. + ProtectionStateUnplannedFailoverTransitionStatesEnd ProtectionState = "UnplannedFailoverTransitionStatesEnd" + // ProtectionStateUnprotectedStatesBegin - Begin marker for unprotected states. + ProtectionStateUnprotectedStatesBegin ProtectionState = "UnprotectedStatesBegin" + // ProtectionStateUnprotectedStatesEnd - End marker for unprotected states. + ProtectionStateUnprotectedStatesEnd ProtectionState = "UnprotectedStatesEnd" ) // PossibleProtectionStateValues returns the possible values for the ProtectionState const type. @@ -196,17 +402,24 @@ func PossibleProtectionStateValues() []ProtectionState { } } -// ProvisioningState - Gets or sets the provisioning state of the Dra. +// ProvisioningState - Gets or sets the provisioning state of the email configuration. type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleted ProvisioningState = "Deleted" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateCanceled - Resource creation has been canceled + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating - Resource is being created. + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleted - Resource has been deleted. + ProvisioningStateDeleted ProvisioningState = "Deleted" + // ProvisioningStateDeleting - Resource is being deleted. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded - Resource creation/update succeeded. ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" + // ProvisioningStateUpdating - Resource is being updated. + ProvisioningStateUpdating ProvisioningState = "Updating" ) // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. @@ -226,8 +439,10 @@ func PossibleProvisioningStateValues() []ProvisioningState { type RecoveryPointType string const ( + // RecoveryPointTypeApplicationConsistent - Application consistent recovery point. RecoveryPointTypeApplicationConsistent RecoveryPointType = "ApplicationConsistent" - RecoveryPointTypeCrashConsistent RecoveryPointType = "CrashConsistent" + // RecoveryPointTypeCrashConsistent - Crash consistent recovery point. + RecoveryPointTypeCrashConsistent RecoveryPointType = "CrashConsistent" ) // PossibleRecoveryPointTypeValues returns the possible values for the RecoveryPointType const type. @@ -242,8 +457,10 @@ func PossibleRecoveryPointTypeValues() []RecoveryPointType { type ReplicationVaultType string const ( + // ReplicationVaultTypeDisasterRecovery - Disaster recovery vault. ReplicationVaultTypeDisasterRecovery ReplicationVaultType = "DisasterRecovery" - ReplicationVaultTypeMigrate ReplicationVaultType = "Migrate" + // ReplicationVaultTypeMigrate - Migrate vault. + ReplicationVaultTypeMigrate ReplicationVaultType = "Migrate" ) // PossibleReplicationVaultTypeValues returns the possible values for the ReplicationVaultType const type. @@ -258,9 +475,13 @@ func PossibleReplicationVaultTypeValues() []ReplicationVaultType { type ResynchronizationState string const ( - ResynchronizationStateNone ResynchronizationState = "None" + // ResynchronizationStateNone - Resynchronization is not active. + ResynchronizationStateNone ResynchronizationState = "None" + // ResynchronizationStateResynchronizationCompleted - Resynchronization has been completed successfully. ResynchronizationStateResynchronizationCompleted ResynchronizationState = "ResynchronizationCompleted" - ResynchronizationStateResynchronizationFailed ResynchronizationState = "ResynchronizationFailed" + // ResynchronizationStateResynchronizationFailed - Resynchronization has failed and would need to be started again. + ResynchronizationStateResynchronizationFailed ResynchronizationState = "ResynchronizationFailed" + // ResynchronizationStateResynchronizationInitiated - Resynchronization has been initiated. ResynchronizationStateResynchronizationInitiated ResynchronizationState = "ResynchronizationInitiated" ) @@ -278,11 +499,17 @@ func PossibleResynchronizationStateValues() []ResynchronizationState { type TaskState string const ( + // TaskStateCancelled - Task has been cancelled. TaskStateCancelled TaskState = "Cancelled" - TaskStateFailed TaskState = "Failed" - TaskStatePending TaskState = "Pending" - TaskStateSkipped TaskState = "Skipped" - TaskStateStarted TaskState = "Started" + // TaskStateFailed - Task failed. + TaskStateFailed TaskState = "Failed" + // TaskStatePending - Task has not been started. + TaskStatePending TaskState = "Pending" + // TaskStateSkipped - Task has been skipped. + TaskStateSkipped TaskState = "Skipped" + // TaskStateStarted - Task is in progress. + TaskStateStarted TaskState = "Started" + // TaskStateSucceeded - Task has completed successfully. TaskStateSucceeded TaskState = "Succeeded" ) @@ -302,15 +529,25 @@ func PossibleTaskStateValues() []TaskState { type TestFailoverState string const ( - TestFailoverStateMarkedForDeletion TestFailoverState = "MarkedForDeletion" - TestFailoverStateNone TestFailoverState = "None" + // TestFailoverStateMarkedForDeletion - Test failover cleanup has completed/failed. This is a transient state before the state + // is moved back to None. + TestFailoverStateMarkedForDeletion TestFailoverState = "MarkedForDeletion" + // TestFailoverStateNone - Test failover is not active. + TestFailoverStateNone TestFailoverState = "None" + // TestFailoverStateTestFailoverCleanupCompleting - Cleaning up test protected entities is in progress. TestFailoverStateTestFailoverCleanupCompleting TestFailoverState = "TestFailoverCleanupCompleting" - TestFailoverStateTestFailoverCleanupInitiated TestFailoverState = "TestFailoverCleanupInitiated" - TestFailoverStateTestFailoverCompleted TestFailoverState = "TestFailoverCompleted" - TestFailoverStateTestFailoverCompleting TestFailoverState = "TestFailoverCompleting" - TestFailoverStateTestFailoverCompletionFailed TestFailoverState = "TestFailoverCompletionFailed" - TestFailoverStateTestFailoverFailed TestFailoverState = "TestFailoverFailed" - TestFailoverStateTestFailoverInitiated TestFailoverState = "TestFailoverInitiated" + // TestFailoverStateTestFailoverCleanupInitiated - Test failover cleanup has been initiated. + TestFailoverStateTestFailoverCleanupInitiated TestFailoverState = "TestFailoverCleanupInitiated" + // TestFailoverStateTestFailoverCompleted - Test failover has been completed successfully. + TestFailoverStateTestFailoverCompleted TestFailoverState = "TestFailoverCompleted" + // TestFailoverStateTestFailoverCompleting - Preparing test protected entities is in progress. + TestFailoverStateTestFailoverCompleting TestFailoverState = "TestFailoverCompleting" + // TestFailoverStateTestFailoverCompletionFailed - Preparing test protected entities failed. + TestFailoverStateTestFailoverCompletionFailed TestFailoverState = "TestFailoverCompletionFailed" + // TestFailoverStateTestFailoverFailed - Test failover initiation failed.. + TestFailoverStateTestFailoverFailed TestFailoverState = "TestFailoverFailed" + // TestFailoverStateTestFailoverInitiated - Test failover has been initiated. + TestFailoverStateTestFailoverInitiated TestFailoverState = "TestFailoverInitiated" ) // PossibleTestFailoverStateValues returns the possible values for the TestFailoverState const type. @@ -332,9 +569,15 @@ func PossibleTestFailoverStateValues() []TestFailoverState { type VMNicSelection string const ( - VMNicSelectionNotSelected VMNicSelection = "NotSelected" - VMNicSelectionSelectedByDefault VMNicSelection = "SelectedByDefault" - VMNicSelectionSelectedByUser VMNicSelection = "SelectedByUser" + // VMNicSelectionNotSelected - Not Selected. + VMNicSelectionNotSelected VMNicSelection = "NotSelected" + // VMNicSelectionSelectedByDefault - Default selection by ASR. + VMNicSelectionSelectedByDefault VMNicSelection = "SelectedByDefault" + // VMNicSelectionSelectedByUser - Selected by user. + VMNicSelectionSelectedByUser VMNicSelection = "SelectedByUser" + // VMNicSelectionSelectedByUserOverride - NIC configuration overridden by user. Differs from SelectedByUser in the sense that + // the legacy SelectedByUser is used both for explicit modification by user and implicit approval of user if the settings + // are used for TFO/FO. SelectedByUserOverride implies user overriding at least one of the configurations. VMNicSelectionSelectedByUserOverride VMNicSelection = "SelectedByUserOverride" ) @@ -352,9 +595,12 @@ func PossibleVMNicSelectionValues() []VMNicSelection { type VMwareToAzureMigrateResyncState string const ( - VMwareToAzureMigrateResyncStateNone VMwareToAzureMigrateResyncState = "None" + // VMwareToAzureMigrateResyncStateNone - None state. + VMwareToAzureMigrateResyncStateNone VMwareToAzureMigrateResyncState = "None" + // VMwareToAzureMigrateResyncStatePreparedForResynchronization - Prepared for resynchronization state. VMwareToAzureMigrateResyncStatePreparedForResynchronization VMwareToAzureMigrateResyncState = "PreparedForResynchronization" - VMwareToAzureMigrateResyncStateStartedResynchronization VMwareToAzureMigrateResyncState = "StartedResynchronization" + // VMwareToAzureMigrateResyncStateStartedResynchronization - Started resynchronization state. + VMwareToAzureMigrateResyncStateStartedResynchronization VMwareToAzureMigrateResyncState = "StartedResynchronization" ) // PossibleVMwareToAzureMigrateResyncStateValues returns the possible values for the VMwareToAzureMigrateResyncState const type. @@ -366,60 +612,23 @@ func PossibleVMwareToAzureMigrateResyncStateValues() []VMwareToAzureMigrateResyn } } -// WorkflowObjectType - Gets or sets the object type. -type WorkflowObjectType string - -const ( - WorkflowObjectTypeAvsDiskPool WorkflowObjectType = "AvsDiskPool" - WorkflowObjectTypeDra WorkflowObjectType = "Dra" - WorkflowObjectTypeFabric WorkflowObjectType = "Fabric" - WorkflowObjectTypePolicy WorkflowObjectType = "Policy" - WorkflowObjectTypeProtectedItem WorkflowObjectType = "ProtectedItem" - WorkflowObjectTypeRecoveryPlan WorkflowObjectType = "RecoveryPlan" - WorkflowObjectTypeReplicationExtension WorkflowObjectType = "ReplicationExtension" - WorkflowObjectTypeVault WorkflowObjectType = "Vault" -) - -// PossibleWorkflowObjectTypeValues returns the possible values for the WorkflowObjectType const type. -func PossibleWorkflowObjectTypeValues() []WorkflowObjectType { - return []WorkflowObjectType{ - WorkflowObjectTypeAvsDiskPool, - WorkflowObjectTypeDra, - WorkflowObjectTypeFabric, - WorkflowObjectTypePolicy, - WorkflowObjectTypeProtectedItem, - WorkflowObjectTypeRecoveryPlan, - WorkflowObjectTypeReplicationExtension, - WorkflowObjectTypeVault, - } -} - -// WorkflowState - Gets or sets the workflow state. -type WorkflowState string +// VaultIdentityType - Gets or sets the identityType which can be either SystemAssigned or None. +type VaultIdentityType string const ( - WorkflowStateCancelled WorkflowState = "Cancelled" - WorkflowStateCancelling WorkflowState = "Cancelling" - WorkflowStateCompletedWithErrors WorkflowState = "CompletedWithErrors" - WorkflowStateCompletedWithInformation WorkflowState = "CompletedWithInformation" - WorkflowStateCompletedWithWarnings WorkflowState = "CompletedWithWarnings" - WorkflowStateFailed WorkflowState = "Failed" - WorkflowStatePending WorkflowState = "Pending" - WorkflowStateStarted WorkflowState = "Started" - WorkflowStateSucceeded WorkflowState = "Succeeded" + // VaultIdentityTypeNone - No identity. + VaultIdentityTypeNone VaultIdentityType = "None" + // VaultIdentityTypeSystemAssigned - System assigned identity. + VaultIdentityTypeSystemAssigned VaultIdentityType = "SystemAssigned" + // VaultIdentityTypeUserAssigned - User assigned identity. + VaultIdentityTypeUserAssigned VaultIdentityType = "UserAssigned" ) -// PossibleWorkflowStateValues returns the possible values for the WorkflowState const type. -func PossibleWorkflowStateValues() []WorkflowState { - return []WorkflowState{ - WorkflowStateCancelled, - WorkflowStateCancelling, - WorkflowStateCompletedWithErrors, - WorkflowStateCompletedWithInformation, - WorkflowStateCompletedWithWarnings, - WorkflowStateFailed, - WorkflowStatePending, - WorkflowStateStarted, - WorkflowStateSucceeded, +// PossibleVaultIdentityTypeValues returns the possible values for the VaultIdentityType const type. +func PossibleVaultIdentityTypeValues() []VaultIdentityType { + return []VaultIdentityType{ + VaultIdentityTypeNone, + VaultIdentityTypeSystemAssigned, + VaultIdentityTypeUserAssigned, } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client.go new file mode 100644 index 000000000000..f6c80f1b24fd --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client.go @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft 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 armrecoveryservicesdatareplication + +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" +) + +// DeploymentPreflightClient contains the methods for the DeploymentPreflight group. +// Don't use this type directly, use NewDeploymentPreflightClient() instead. +type DeploymentPreflightClient struct { + internal *arm.Client + subscriptionID string +} + +// NewDeploymentPreflightClient creates a new instance of DeploymentPreflightClient 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 NewDeploymentPreflightClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DeploymentPreflightClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &DeploymentPreflightClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Post - Performs resource deployment validation. +// +// Performs resource deployment preflight validation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - deploymentID - Deployment Id. +// - options - DeploymentPreflightClientPostOptions contains the optional parameters for the DeploymentPreflightClient.Post +// method. +func (client *DeploymentPreflightClient) Post(ctx context.Context, resourceGroupName string, deploymentID string, options *DeploymentPreflightClientPostOptions) (DeploymentPreflightClientPostResponse, error) { + var err error + const operationName = "DeploymentPreflightClient.Post" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.postCreateRequest(ctx, resourceGroupName, deploymentID, options) + if err != nil { + return DeploymentPreflightClientPostResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeploymentPreflightClientPostResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DeploymentPreflightClientPostResponse{}, err + } + resp, err := client.postHandleResponse(httpResp) + return resp, err +} + +// postCreateRequest creates the Post request. +func (client *DeploymentPreflightClient) postCreateRequest(ctx context.Context, resourceGroupName string, deploymentID string, options *DeploymentPreflightClientPostOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/deployments/{deploymentId}/preflight" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if deploymentID == "" { + return nil, errors.New("parameter deploymentID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentId}", url.PathEscape(deploymentID)) + 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"} + 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 + } + return req, nil + } + return req, nil +} + +// postHandleResponse handles the Post response. +func (client *DeploymentPreflightClient) postHandleResponse(resp *http.Response) (DeploymentPreflightClientPostResponse, error) { + result := DeploymentPreflightClientPostResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentPreflightModel); err != nil { + return DeploymentPreflightClientPostResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client_example_test.go new file mode 100644 index 000000000000..57a7be470294 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/deploymentpreflight_client_example_test.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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" +) + +// Generated from example definition: 2024-09-01/DeploymentPreflight_Post.json +func ExampleDeploymentPreflightClient_Post() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewDeploymentPreflightClient().Post(ctx, "rgswagger_2024-09-01", "lnfcwsmlowbwkndkztzvaj", &DeploymentPreflightClientPostOptions{ + body: &armrecoveryservicesdatareplication.DeploymentPreflightModel{ + Resources: []*armrecoveryservicesdatareplication.DeploymentPreflightResource{ + { + Name: to.Ptr("xtgugoflfc"), + Type: to.Ptr("nsnaptduolqcxsikrewvgjbxqpt"), + Location: to.Ptr("cbsgtxkjdzwbyp"), + APIVersion: to.Ptr("otihymhvzblycdoxo"), + }, + }, + }}) + 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 = armrecoveryservicesdatareplication.DeploymentPreflightClientPostResponse{ + // DeploymentPreflightModel: &armrecoveryservicesdatareplication.DeploymentPreflightModel{ + // Resources: []*armrecoveryservicesdatareplication.DeploymentPreflightResource{ + // { + // Name: to.Ptr("xtgugoflfc"), + // Type: to.Ptr("nsnaptduolqcxsikrewvgjbxqpt"), + // Location: to.Ptr("cbsgtxkjdzwbyp"), + // APIVersion: to.Ptr("otihymhvzblycdoxo"), + // }, + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client.go deleted file mode 100644 index 781754ee35fa..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client.go +++ /dev/null @@ -1,118 +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 armrecoveryservicesdatareplication - -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" -) - -// DraOperationStatusClient contains the methods for the DraOperationStatus group. -// Don't use this type directly, use NewDraOperationStatusClient() instead. -type DraOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewDraOperationStatusClient creates a new instance of DraOperationStatusClient 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 NewDraOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DraOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &DraOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the fabric agent. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - fabricName - The fabric name. -// - fabricAgentName - The fabric agent (Dra) name. -// - operationID - The ID of an ongoing async operation. -// - options - DraOperationStatusClientGetOptions contains the optional parameters for the DraOperationStatusClient.Get method. -func (client *DraOperationStatusClient) Get(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, operationID string, options *DraOperationStatusClientGetOptions) (DraOperationStatusClientGetResponse, error) { - var err error - const operationName = "DraOperationStatusClient.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, fabricName, fabricAgentName, operationID, options) - if err != nil { - return DraOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return DraOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return DraOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *DraOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, operationID string, options *DraOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}/operations/{operationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if fabricAgentName == "" { - return nil, errors.New("parameter fabricAgentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricAgentName}", url.PathEscape(fabricAgentName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - 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-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *DraOperationStatusClient) getHandleResponse(resp *http.Response) (DraOperationStatusClientGetResponse, error) { - result := DraOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return DraOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client.go index 29623e9817c0..9ab3ce4e4563 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_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 armrecoveryservicesdatareplication @@ -46,20 +42,20 @@ func NewEmailConfigurationClient(subscriptionID string, credential azcore.TokenC // Create - Creates an alert configuration setting for the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - emailConfigurationName - The email configuration name. -// - body - EmailConfiguration model. +// - resource - EmailConfiguration model. // - options - EmailConfigurationClientCreateOptions contains the optional parameters for the EmailConfigurationClient.Create // method. -func (client *EmailConfigurationClient) Create(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, body EmailConfigurationModel, options *EmailConfigurationClientCreateOptions) (EmailConfigurationClientCreateResponse, error) { +func (client *EmailConfigurationClient) Create(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, resource EmailConfigurationModel, options *EmailConfigurationClientCreateOptions) (EmailConfigurationClientCreateResponse, error) { var err error const operationName = "EmailConfigurationClient.Create" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, vaultName, emailConfigurationName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, vaultName, emailConfigurationName, resource, options) if err != nil { return EmailConfigurationClientCreateResponse{}, err } @@ -76,7 +72,7 @@ func (client *EmailConfigurationClient) Create(ctx context.Context, resourceGrou } // createCreateRequest creates the Create request. -func (client *EmailConfigurationClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, body EmailConfigurationModel, options *EmailConfigurationClientCreateOptions) (*policy.Request, error) { +func (client *EmailConfigurationClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, resource EmailConfigurationModel, _ *EmailConfigurationClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -99,10 +95,11 @@ func (client *EmailConfigurationClient) createCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 @@ -120,7 +117,7 @@ func (client *EmailConfigurationClient) createHandleResponse(resp *http.Response // Get - Gets the details of the alert configuration setting. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - emailConfigurationName - The email configuration name. @@ -148,7 +145,7 @@ func (client *EmailConfigurationClient) Get(ctx context.Context, resourceGroupNa } // getCreateRequest creates the Get request. -func (client *EmailConfigurationClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, options *EmailConfigurationClientGetOptions) (*policy.Request, error) { +func (client *EmailConfigurationClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, _ *EmailConfigurationClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings/{emailConfigurationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -171,7 +168,7 @@ func (client *EmailConfigurationClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,7 +185,7 @@ func (client *EmailConfigurationClient) getHandleResponse(resp *http.Response) ( // NewListPager - Gets the list of alert configuration settings for the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - EmailConfigurationClientListOptions contains the optional parameters for the EmailConfigurationClient.NewListPager @@ -217,7 +214,7 @@ func (client *EmailConfigurationClient) NewListPager(resourceGroupName string, v } // listCreateRequest creates the List request. -func (client *EmailConfigurationClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *EmailConfigurationClientListOptions) (*policy.Request, error) { +func (client *EmailConfigurationClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *EmailConfigurationClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/alertSettings" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -236,7 +233,7 @@ func (client *EmailConfigurationClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -245,7 +242,7 @@ func (client *EmailConfigurationClient) listCreateRequest(ctx context.Context, r // listHandleResponse handles the List response. func (client *EmailConfigurationClient) listHandleResponse(resp *http.Response) (EmailConfigurationClientListResponse, error) { result := EmailConfigurationClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EmailConfigurationModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.EmailConfigurationModelListResult); err != nil { return EmailConfigurationClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client_example_test.go index 5b8a05f0d56a..2debde5f9d1c 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/emailconfiguration_client_example_test.go @@ -1,120 +1,119 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// 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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Get.json -func ExampleEmailConfigurationClient_Get() { +// Generated from example definition: 2024-09-01/EmailConfiguration_Create.json +func ExampleEmailConfigurationClient_Create() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEmailConfigurationClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "0", nil) + res, err := clientFactory.NewEmailConfigurationClient().Create(ctx, "rgswagger_2024-09-01", "4", "0", armrecoveryservicesdatareplication.EmailConfigurationModel{ + Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ + SendToOwners: to.Ptr(true), + CustomEmailAddresses: []*string{ + to.Ptr("ketvbducyailcny"), + }, + Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + }, + }, 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.EmailConfigurationModel = armrecoveryservicesdatareplication.EmailConfigurationModel{ - // Name: to.Ptr("ywjplnjzaeu"), - // Type: to.Ptr("bkaq"), - // ID: to.Ptr("bvbfy"), - // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ - // CustomEmailAddresses: []*string{ - // to.Ptr("ketvbducyailcny")}, - // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + // res = armrecoveryservicesdatareplication.EmailConfigurationClientCreateResponse{ + // EmailConfigurationModel: &armrecoveryservicesdatareplication.EmailConfigurationModel{ + // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ // SendToOwners: to.Ptr(true), + // CustomEmailAddresses: []*string{ + // to.Ptr("ketvbducyailcny"), + // }, + // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), // }, - // SystemData: &armrecoveryservicesdatareplication.EmailConfigurationModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/alertSettings/emailConfiguration1"), + // Name: to.Ptr("ywjplnjzaeu"), + // Type: to.Ptr("bkaq"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), - // CreatedByType: to.Ptr("zioqm"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // LastModifiedBy: to.Ptr("rx"), - // LastModifiedByType: to.Ptr("tqbvuqoakaaqij"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_Create.json -func ExampleEmailConfigurationClient_Create() { +// Generated from example definition: 2024-09-01/EmailConfiguration_Get.json +func ExampleEmailConfigurationClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEmailConfigurationClient().Create(ctx, "rgrecoveryservicesdatareplication", "4", "0", armrecoveryservicesdatareplication.EmailConfigurationModel{ - Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ - CustomEmailAddresses: []*string{ - to.Ptr("ketvbducyailcny")}, - Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), - SendToOwners: to.Ptr(true), - }, - }, nil) + res, err := clientFactory.NewEmailConfigurationClient().Get(ctx, "rgswagger_2024-09-01", "4", "0", 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.EmailConfigurationModel = armrecoveryservicesdatareplication.EmailConfigurationModel{ - // Name: to.Ptr("ywjplnjzaeu"), - // Type: to.Ptr("bkaq"), - // ID: to.Ptr("bvbfy"), - // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ - // CustomEmailAddresses: []*string{ - // to.Ptr("ketvbducyailcny")}, - // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + // res = armrecoveryservicesdatareplication.EmailConfigurationClientGetResponse{ + // EmailConfigurationModel: &armrecoveryservicesdatareplication.EmailConfigurationModel{ + // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ // SendToOwners: to.Ptr(true), + // CustomEmailAddresses: []*string{ + // to.Ptr("ketvbducyailcny"), + // }, + // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), // }, - // SystemData: &armrecoveryservicesdatareplication.EmailConfigurationModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/alertSettings/emailConfiguration1"), + // Name: to.Ptr("ywjplnjzaeu"), + // Type: to.Ptr("bkaq"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), - // CreatedByType: to.Ptr("zioqm"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // LastModifiedBy: to.Ptr("rx"), - // LastModifiedByType: to.Ptr("tqbvuqoakaaqij"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/EmailConfiguration_List.json +// Generated from example definition: 2024-09-01/EmailConfiguration_List.json func ExampleEmailConfigurationClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewEmailConfigurationClient().NewListPager("rgrecoveryservicesdatareplication", "4", nil) + pager := clientFactory.NewEmailConfigurationClient().NewListPager("rgswagger_2024-09-01", "4", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -125,27 +124,30 @@ func ExampleEmailConfigurationClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EmailConfigurationModelCollection = armrecoveryservicesdatareplication.EmailConfigurationModelCollection{ - // Value: []*armrecoveryservicesdatareplication.EmailConfigurationModel{ - // { - // Name: to.Ptr("ywjplnjzaeu"), - // Type: to.Ptr("bkaq"), - // ID: to.Ptr("bvbfy"), - // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ - // CustomEmailAddresses: []*string{ - // to.Ptr("ketvbducyailcny")}, - // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + // page = armrecoveryservicesdatareplication.EmailConfigurationClientListResponse{ + // EmailConfigurationModelListResult: armrecoveryservicesdatareplication.EmailConfigurationModelListResult{ + // Value: []*armrecoveryservicesdatareplication.EmailConfigurationModel{ + // { + // Properties: &armrecoveryservicesdatareplication.EmailConfigurationModelProperties{ // SendToOwners: to.Ptr(true), + // CustomEmailAddresses: []*string{ + // to.Ptr("ketvbducyailcny"), + // }, + // Locale: to.Ptr("vpnjxjvdqtebnucyxiyrjiko"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), // }, - // SystemData: &armrecoveryservicesdatareplication.EmailConfigurationModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/alertSettings/emailConfiguration1"), + // Name: to.Ptr("ywjplnjzaeu"), + // Type: to.Ptr("bkaq"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), - // CreatedByType: to.Ptr("zioqm"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // LastModifiedBy: to.Ptr("rx"), - // LastModifiedByType: to.Ptr("tqbvuqoakaaqij"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // }, - // }}, - // } + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client.go index 2e4d0ede5400..b2ddcfdd3684 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_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 armrecoveryservicesdatareplication @@ -17,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) @@ -46,7 +43,7 @@ func NewEventClient(subscriptionID string, credential azcore.TokenCredential, op // Get - Gets the details of the event. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - eventName - The event name. @@ -74,7 +71,7 @@ func (client *EventClient) Get(ctx context.Context, resourceGroupName string, va } // getCreateRequest creates the Get request. -func (client *EventClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, eventName string, options *EventClientGetOptions) (*policy.Request, error) { +func (client *EventClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, eventName string, _ *EventClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/events/{eventName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -97,7 +94,7 @@ func (client *EventClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +111,7 @@ func (client *EventClient) getHandleResponse(resp *http.Response) (EventClientGe // NewListPager - Gets the list of events in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - EventClientListOptions contains the optional parameters for the EventClient.NewListPager method. @@ -161,13 +158,16 @@ func (client *EventClient) listCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } - reqQP.Set("api-version", "2021-02-16-preview") + if options != nil && options.OdataOptions != nil { + reqQP.Set("odataOptions", *options.OdataOptions) + } + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -176,7 +176,7 @@ func (client *EventClient) listCreateRequest(ctx context.Context, resourceGroupN // listHandleResponse handles the List response. func (client *EventClient) listHandleResponse(resp *http.Response) (EventClientListResponse, error) { result := EventClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.EventModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.EventModelListResult); err != nil { return EventClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client_example_test.go index 27712dbc1d58..888dc53b9fa1 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/event_client_example_test.go @@ -1,114 +1,108 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// 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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Event_Get.json +// Generated from example definition: 2024-09-01/Event_Get.json func ExampleEventClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEventClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "231CIG", nil) + res, err := clientFactory.NewEventClient().Get(ctx, "rgswagger_2024-09-01", "4", "231CIG", 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.EventModel = armrecoveryservicesdatareplication.EventModel{ - // Name: to.Ptr("j"), - // Type: to.Ptr("lgk"), - // ID: to.Ptr("fgbppsytxctsrsxlfugyohhu"), - // Properties: &armrecoveryservicesdatareplication.EventModelProperties{ - // Description: to.Ptr("hkeiogebluvfpdgxogwesjmtbbok"), - // CorrelationID: to.Ptr("lwfsxforxnhvpmheujutjicflmxv"), - // CustomProperties: &armrecoveryservicesdatareplication.EventModelCustomProperties{ - // InstanceType: to.Ptr("EventModelCustomProperties"), - // }, - // EventName: to.Ptr("s"), - // EventType: to.Ptr("npumqmvspm"), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // res = armrecoveryservicesdatareplication.EventClientGetResponse{ + // EventModel: &armrecoveryservicesdatareplication.EventModel{ + // Properties: &armrecoveryservicesdatareplication.EventModelProperties{ + // ResourceType: to.Ptr("surgdzezskgregozynvlinfutyh"), + // ResourceName: to.Ptr("yhpkowkbvtqnbiklnjzc"), + // EventType: to.Ptr("npumqmvspm"), + // EventName: to.Ptr("s"), + // TimeOfOccurrence: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // Severity: to.Ptr("sjous"), + // CorrelationID: to.Ptr("lwfsxforxnhvpmheujutjicflmxv"), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ResourceName: to.Ptr("yhpkowkbvtqnbiklnjzc"), - // ResourceType: to.Ptr("surgdzezskgregozynvlinfutyh"), - // Severity: to.Ptr("sjous"), - // TimeOfOccurrence: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, + // Description: to.Ptr("kwjzliiqagudb"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), // }, - // SystemData: &armrecoveryservicesdatareplication.EventModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/events/event1"), + // Name: to.Ptr("j"), + // Type: to.Ptr("lgk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("uske"), - // CreatedByType: to.Ptr("luzowppyxjalugkef"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), // LastModifiedBy: to.Ptr("ufrixpmhben"), - // LastModifiedByType: to.Ptr("aubgraubkuaeipwzvbcgnlpseobx"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Event_List.json +// Generated from example definition: 2024-09-01/Event_List.json func ExampleEventClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewEventClient().NewListPager("rgrecoveryservicesdatareplication", "4", &armrecoveryservicesdatareplication.EventClientListOptions{Filter: to.Ptr("wbglupjzvkirtgnnyasxom"), - ContinuationToken: to.Ptr("cxtufi"), - }) + pager := clientFactory.NewEventClient().NewListPager("rgswagger_2024-09-01", "4", &EventClientListOptions{ + continuationToken: to.Ptr("gabpzsxrifposvleqqcjnvofz")}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -119,65 +113,67 @@ func ExampleEventClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.EventModelCollection = armrecoveryservicesdatareplication.EventModelCollection{ - // Value: []*armrecoveryservicesdatareplication.EventModel{ - // { - // Name: to.Ptr("j"), - // Type: to.Ptr("lgk"), - // ID: to.Ptr("fgbppsytxctsrsxlfugyohhu"), - // Properties: &armrecoveryservicesdatareplication.EventModelProperties{ - // Description: to.Ptr("hkeiogebluvfpdgxogwesjmtbbok"), - // CorrelationID: to.Ptr("lwfsxforxnhvpmheujutjicflmxv"), - // CustomProperties: &armrecoveryservicesdatareplication.EventModelCustomProperties{ - // InstanceType: to.Ptr("EventModelCustomProperties"), - // }, - // EventName: to.Ptr("s"), - // EventType: to.Ptr("npumqmvspm"), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // page = armrecoveryservicesdatareplication.EventClientListResponse{ + // EventModelListResult: armrecoveryservicesdatareplication.EventModelListResult{ + // Value: []*armrecoveryservicesdatareplication.EventModel{ + // { + // Properties: &armrecoveryservicesdatareplication.EventModelProperties{ + // ResourceType: to.Ptr("surgdzezskgregozynvlinfutyh"), + // ResourceName: to.Ptr("yhpkowkbvtqnbiklnjzc"), + // EventType: to.Ptr("npumqmvspm"), + // EventName: to.Ptr("s"), + // TimeOfOccurrence: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // Severity: to.Ptr("sjous"), + // CorrelationID: to.Ptr("lwfsxforxnhvpmheujutjicflmxv"), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ResourceName: to.Ptr("yhpkowkbvtqnbiklnjzc"), - // ResourceType: to.Ptr("surgdzezskgregozynvlinfutyh"), - // Severity: to.Ptr("sjous"), - // TimeOfOccurrence: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, + // Description: to.Ptr("dk"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), // }, - // SystemData: &armrecoveryservicesdatareplication.EventModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/events/event1"), + // Name: to.Ptr("j"), + // Type: to.Ptr("lgk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("uske"), - // CreatedByType: to.Ptr("luzowppyxjalugkef"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), // LastModifiedBy: to.Ptr("ufrixpmhben"), - // LastModifiedByType: to.Ptr("aubgraubkuaeipwzvbcgnlpseobx"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.432Z"); return t}()), // }, - // }}, - // } + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client.go index 26f1dd118309..9141c891f1d5 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_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 armrecoveryservicesdatareplication @@ -46,20 +42,19 @@ func NewFabricClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreate - Creates the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - body - Fabric properties. +// - resource - Fabric properties. // - options - FabricClientBeginCreateOptions contains the optional parameters for the FabricClient.BeginCreate method. -func (client *FabricClient) BeginCreate(ctx context.Context, resourceGroupName string, fabricName string, body FabricModel, options *FabricClientBeginCreateOptions) (*runtime.Poller[FabricClientCreateResponse], error) { +func (client *FabricClient) BeginCreate(ctx context.Context, resourceGroupName string, fabricName string, resource FabricModel, options *FabricClientBeginCreateOptions) (*runtime.Poller[FabricClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, fabricName, body, options) + resp, err := client.create(ctx, resourceGroupName, fabricName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FabricClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -72,14 +67,14 @@ func (client *FabricClient) BeginCreate(ctx context.Context, resourceGroupName s // Create - Creates the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *FabricClient) create(ctx context.Context, resourceGroupName string, fabricName string, body FabricModel, options *FabricClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *FabricClient) create(ctx context.Context, resourceGroupName string, fabricName string, resource FabricModel, options *FabricClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "FabricClient.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, fabricName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, fabricName, resource, options) if err != nil { return nil, err } @@ -95,7 +90,7 @@ func (client *FabricClient) create(ctx context.Context, resourceGroupName string } // createCreateRequest creates the Create request. -func (client *FabricClient) createCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, body FabricModel, options *FabricClientBeginCreateOptions) (*policy.Request, error) { +func (client *FabricClient) createCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, resource FabricModel, _ *FabricClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -114,10 +109,11 @@ func (client *FabricClient) createCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 @@ -126,7 +122,7 @@ func (client *FabricClient) createCreateRequest(ctx context.Context, resourceGro // BeginDelete - Removes the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. // - options - FabricClientBeginDeleteOptions contains the optional parameters for the FabricClient.BeginDelete method. @@ -137,8 +133,7 @@ func (client *FabricClient) BeginDelete(ctx context.Context, resourceGroupName s return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FabricClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -151,7 +146,7 @@ func (client *FabricClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Removes the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *FabricClient) deleteOperation(ctx context.Context, resourceGroupName string, fabricName string, options *FabricClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "FabricClient.BeginDelete" @@ -174,7 +169,7 @@ func (client *FabricClient) deleteOperation(ctx context.Context, resourceGroupNa } // deleteCreateRequest creates the Delete request. -func (client *FabricClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, options *FabricClientBeginDeleteOptions) (*policy.Request, error) { +func (client *FabricClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, _ *FabricClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -193,7 +188,7 @@ func (client *FabricClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +197,7 @@ func (client *FabricClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets the details of the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. // - options - FabricClientGetOptions contains the optional parameters for the FabricClient.Get method. @@ -229,7 +224,7 @@ func (client *FabricClient) Get(ctx context.Context, resourceGroupName string, f } // getCreateRequest creates the Get request. -func (client *FabricClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, options *FabricClientGetOptions) (*policy.Request, error) { +func (client *FabricClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, _ *FabricClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -248,7 +243,7 @@ func (client *FabricClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +260,7 @@ func (client *FabricClient) getHandleResponse(resp *http.Response) (FabricClient // NewListPager - Gets the list of fabrics in the given subscription and resource group. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - FabricClientListOptions contains the optional parameters for the FabricClient.NewListPager method. func (client *FabricClient) NewListPager(resourceGroupName string, options *FabricClientListOptions) *runtime.Pager[FabricClientListResponse] { @@ -307,10 +302,10 @@ func (client *FabricClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } - reqQP.Set("api-version", "2021-02-16-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -319,7 +314,7 @@ func (client *FabricClient) listCreateRequest(ctx context.Context, resourceGroup // listHandleResponse handles the List response. func (client *FabricClient) listHandleResponse(resp *http.Response) (FabricClientListResponse, error) { result := FabricClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.FabricModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.FabricModelListResult); err != nil { return FabricClientListResponse{}, err } return result, nil @@ -327,7 +322,7 @@ func (client *FabricClient) listHandleResponse(resp *http.Response) (FabricClien // NewListBySubscriptionPager - Gets the list of fabrics in the given subscription. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - options - FabricClientListBySubscriptionOptions contains the optional parameters for the FabricClient.NewListBySubscriptionPager // method. func (client *FabricClient) NewListBySubscriptionPager(options *FabricClientListBySubscriptionOptions) *runtime.Pager[FabricClientListBySubscriptionResponse] { @@ -354,7 +349,7 @@ func (client *FabricClient) NewListBySubscriptionPager(options *FabricClientList } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *FabricClient) listBySubscriptionCreateRequest(ctx context.Context, options *FabricClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *FabricClient) listBySubscriptionCreateRequest(ctx context.Context, _ *FabricClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationFabrics" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -365,10 +360,7 @@ func (client *FabricClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.ContinuationToken != nil { - reqQP.Set("continuationToken", *options.ContinuationToken) - } - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -377,7 +369,7 @@ func (client *FabricClient) listBySubscriptionCreateRequest(ctx context.Context, // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *FabricClient) listBySubscriptionHandleResponse(resp *http.Response) (FabricClientListBySubscriptionResponse, error) { result := FabricClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.FabricModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.FabricModelListResult); err != nil { return FabricClientListBySubscriptionResponse{}, err } return result, nil @@ -386,20 +378,19 @@ func (client *FabricClient) listBySubscriptionHandleResponse(resp *http.Response // BeginUpdate - Performs update on the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - body - Fabric properties. +// - properties - Fabric properties. // - options - FabricClientBeginUpdateOptions contains the optional parameters for the FabricClient.BeginUpdate method. -func (client *FabricClient) BeginUpdate(ctx context.Context, resourceGroupName string, fabricName string, body FabricModelUpdate, options *FabricClientBeginUpdateOptions) (*runtime.Poller[FabricClientUpdateResponse], error) { +func (client *FabricClient) BeginUpdate(ctx context.Context, resourceGroupName string, fabricName string, properties FabricModelUpdate, options *FabricClientBeginUpdateOptions) (*runtime.Poller[FabricClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, fabricName, body, options) + resp, err := client.update(ctx, resourceGroupName, fabricName, properties, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FabricClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -412,14 +403,14 @@ func (client *FabricClient) BeginUpdate(ctx context.Context, resourceGroupName s // Update - Performs update on the fabric. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *FabricClient) update(ctx context.Context, resourceGroupName string, fabricName string, body FabricModelUpdate, options *FabricClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *FabricClient) update(ctx context.Context, resourceGroupName string, fabricName string, properties FabricModelUpdate, options *FabricClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "FabricClient.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, fabricName, body, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, fabricName, properties, options) if err != nil { return nil, err } @@ -435,7 +426,7 @@ func (client *FabricClient) update(ctx context.Context, resourceGroupName string } // updateCreateRequest creates the Update request. -func (client *FabricClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, body FabricModelUpdate, options *FabricClientBeginUpdateOptions) (*policy.Request, error) { +func (client *FabricClient) updateCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, properties FabricModelUpdate, _ *FabricClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -454,10 +445,11 @@ func (client *FabricClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client_example_test.go index def3033daaf4..c2fdac552c9d 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabric_client_example_test.go @@ -1,314 +1,211 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Get.json -func ExampleFabricClient_Get() { +// Generated from example definition: 2024-09-01/Fabric_Create.json +func ExampleFabricClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewFabricClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", nil) + poller, err := clientFactory.NewFabricClient().BeginCreate(ctx, "rgswagger_2024-09-01", "wPR", armrecoveryservicesdatareplication.FabricModel{ + Location: to.Ptr("tqygutlpob"), + Properties: &armrecoveryservicesdatareplication.FabricModelProperties{}, + }, 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.FabricModel = armrecoveryservicesdatareplication.FabricModel{ - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // res = armrecoveryservicesdatareplication.FabricClientCreateResponse{ + // FabricModel: &armrecoveryservicesdatareplication.FabricModel{ + // Location: to.Ptr("tqygutlpob"), + // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceEndpoint: to.Ptr("ilrfl"), + // ServiceResourceID: to.Ptr("xukigpdrbyyy"), + // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), - // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, // }, // Tags: map[string]*string{ - // "key3917": to.Ptr("vgralu"), // }, - // } + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), + // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // LastModifiedBy: to.Ptr("rx"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Create.json -func ExampleFabricClient_BeginCreate() { +// Generated from example definition: 2024-09-01/Fabric_Delete.json +func ExampleFabricClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewFabricClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "wPR", armrecoveryservicesdatareplication.FabricModel{ - Location: to.Ptr("tqygutlpob"), - Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - InstanceType: to.Ptr("FabricModelCustomProperties"), - }, - }, - Tags: map[string]*string{ - "key3917": to.Ptr("vgralu"), - }, - }, nil) + poller, err := clientFactory.NewFabricClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "wPR", 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) } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.FabricModel = armrecoveryservicesdatareplication.FabricModel{ - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), - // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), - // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), - // }, - // Tags: map[string]*string{ - // "key3917": to.Ptr("vgralu"), - // }, - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Update.json -func ExampleFabricClient_BeginUpdate() { +// Generated from example definition: 2024-09-01/Fabric_Get.json +func ExampleFabricClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewFabricClient().BeginUpdate(ctx, "rgrecoveryservicesdatareplication", "wPR", armrecoveryservicesdatareplication.FabricModelUpdate{ - Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - InstanceType: to.Ptr("FabricModelCustomProperties"), - }, - }, - Tags: map[string]*string{ - "key6664": to.Ptr("def"), - }, - }, nil) + res, err := clientFactory.NewFabricClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", 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.FabricModel = armrecoveryservicesdatareplication.FabricModel{ - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // res = armrecoveryservicesdatareplication.FabricClientGetResponse{ + // FabricModel: &armrecoveryservicesdatareplication.FabricModel{ + // Location: to.Ptr("tqygutlpob"), + // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceEndpoint: to.Ptr("ilrfl"), + // ServiceResourceID: to.Ptr("xukigpdrbyyy"), + // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), + // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // }, // Tags: map[string]*string{ // "key3917": to.Ptr("vgralu"), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_Delete.json -func ExampleFabricClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewFabricClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "wPR", 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/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_ListBySubscription.json -func ExampleFabricClient_NewListBySubscriptionPager() { +// Generated from example definition: 2024-09-01/Fabric_List.json +func ExampleFabricClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewFabricClient().NewListBySubscriptionPager(&armrecoveryservicesdatareplication.FabricClientListBySubscriptionOptions{ContinuationToken: to.Ptr("rmgqrpzucsizbyjscxzockbiyg")}) + pager := clientFactory.NewFabricClient().NewListPager("rgswagger_2024-09-01", &FabricClientListOptions{ + continuationToken: to.Ptr("jw")}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -319,81 +216,81 @@ func ExampleFabricClient_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.FabricModelCollection = armrecoveryservicesdatareplication.FabricModelCollection{ - // Value: []*armrecoveryservicesdatareplication.FabricModel{ - // { - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // page = armrecoveryservicesdatareplication.FabricClientListResponse{ + // FabricModelListResult: armrecoveryservicesdatareplication.FabricModelListResult{ + // Value: []*armrecoveryservicesdatareplication.FabricModel{ + // { + // Location: to.Ptr("tqygutlpob"), + // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceEndpoint: to.Ptr("ilrfl"), + // ServiceResourceID: to.Ptr("xukigpdrbyyy"), + // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), + // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // }, // Tags: map[string]*string{ - // "key3917": to.Ptr("vgralu"), // }, - // }}, - // } + // }, + // }, + // }, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Fabric_List.json -func ExampleFabricClient_NewListPager() { +// Generated from example definition: 2024-09-01/Fabric_ListBySubscription.json +func ExampleFabricClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewFabricClient().NewListPager("rgrecoveryservicesdatareplication", &armrecoveryservicesdatareplication.FabricClientListOptions{ContinuationToken: to.Ptr("mjzsxwwmtvd")}) + pager := clientFactory.NewFabricClient().NewListBySubscriptionPager(nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -404,65 +301,148 @@ func ExampleFabricClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.FabricModelCollection = armrecoveryservicesdatareplication.FabricModelCollection{ - // Value: []*armrecoveryservicesdatareplication.FabricModel{ - // { - // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), - // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), - // ID: to.Ptr("ycaxtshcmldt"), - // Location: to.Ptr("tqygutlpob"), - // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.FabricModelCustomProperties{ - // InstanceType: to.Ptr("FabricModelCustomProperties"), - // }, - // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // page = armrecoveryservicesdatareplication.FabricClientListBySubscriptionResponse{ + // FabricModelListResult: armrecoveryservicesdatareplication.FabricModelListResult{ + // Value: []*armrecoveryservicesdatareplication.FabricModel{ + // { + // Location: to.Ptr("tqygutlpob"), + // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceEndpoint: to.Ptr("ilrfl"), + // ServiceResourceID: to.Ptr("xukigpdrbyyy"), + // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceEndpoint: to.Ptr("ilrfl"), - // ServiceResourceID: to.Ptr("xukigpdrbyyy"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, // }, - // SystemData: &armrecoveryservicesdatareplication.FabricModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), + // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), - // CreatedByType: to.Ptr("brnojz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // LastModifiedBy: to.Ptr("balecqnwu"), - // LastModifiedByType: to.Ptr("ukvqlncihf"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // }, // Tags: map[string]*string{ - // "key3917": to.Ptr("vgralu"), // }, - // }}, - // } + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-09-01/Fabric_Update.json +func ExampleFabricClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewFabricClient().BeginUpdate(ctx, "rgswagger_2024-09-01", "wPR", armrecoveryservicesdatareplication.FabricModelUpdate{ + Properties: &armrecoveryservicesdatareplication.FabricModelProperties{}, + 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 = armrecoveryservicesdatareplication.FabricClientUpdateResponse{ + // FabricModel: &armrecoveryservicesdatareplication.FabricModel{ + // Location: to.Ptr("tqygutlpob"), + // Properties: &armrecoveryservicesdatareplication.FabricModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceEndpoint: to.Ptr("ilrfl"), + // ServiceResourceID: to.Ptr("xukigpdrbyyy"), + // Health: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { + // AffectedResourceType: to.Ptr("scfniv"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, + // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ + // { + // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), + // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), + // Category: to.Ptr("lcsdxrqxquke"), + // Severity: to.Ptr("wqxxiuaqjyagq"), + // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("djsmgrltruljo"), + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, + // Code: to.Ptr("dgxkefzmeukd"), + // HealthCategory: to.Ptr("itc"), + // Category: to.Ptr("leigw"), + // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), + // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, + // }, + // Tags: map[string]*string{ + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1"), + // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), + // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // LastModifiedBy: to.Ptr("rx"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_client.go similarity index 66% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_client.go index 72dc6e811e53..4e8a18a97512 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_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 armrecoveryservicesdatareplication @@ -20,23 +16,23 @@ import ( "strings" ) -// DraClient contains the methods for the Dra group. -// Don't use this type directly, use NewDraClient() instead. -type DraClient struct { +// FabricAgentClient contains the methods for the FabricAgent group. +// Don't use this type directly, use NewFabricAgentClient() instead. +type FabricAgentClient struct { internal *arm.Client subscriptionID string } -// NewDraClient creates a new instance of DraClient with the specified values. +// NewFabricAgentClient creates a new instance of FabricAgentClient 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 NewDraClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DraClient, error) { +func NewFabricAgentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FabricAgentClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &DraClient{ + client := &FabricAgentClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,25 +42,24 @@ func NewDraClient(subscriptionID string, credential azcore.TokenCredential, opti // BeginCreate - Creates the fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - fabricAgentName - The fabric agent (Dra) name. -// - body - Dra model. -// - options - DraClientBeginCreateOptions contains the optional parameters for the DraClient.BeginCreate method. -func (client *DraClient) BeginCreate(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body DraModel, options *DraClientBeginCreateOptions) (*runtime.Poller[DraClientCreateResponse], error) { +// - fabricAgentName - The fabric agent name. +// - resource - Fabric agent model. +// - options - FabricAgentClientBeginCreateOptions contains the optional parameters for the FabricAgentClient.BeginCreate method. +func (client *FabricAgentClient) BeginCreate(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, resource FabricAgentModel, options *FabricAgentClientBeginCreateOptions) (*runtime.Poller[FabricAgentClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, fabricName, fabricAgentName, body, options) + resp, err := client.create(ctx, resourceGroupName, fabricName, fabricAgentName, resource, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DraClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FabricAgentClientCreateResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DraClientCreateResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FabricAgentClientCreateResponse]{ Tracer: client.internal.Tracer(), }) } @@ -73,14 +68,14 @@ func (client *DraClient) BeginCreate(ctx context.Context, resourceGroupName stri // Create - Creates the fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *DraClient) create(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body DraModel, options *DraClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *FabricAgentClient) create(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, resource FabricAgentModel, options *FabricAgentClientBeginCreateOptions) (*http.Response, error) { var err error - const operationName = "DraClient.BeginCreate" + const operationName = "FabricAgentClient.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, fabricName, fabricAgentName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, fabricName, fabricAgentName, resource, options) if err != nil { return nil, err } @@ -96,7 +91,7 @@ func (client *DraClient) create(ctx context.Context, resourceGroupName string, f } // createCreateRequest creates the Create request. -func (client *DraClient) createCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body DraModel, options *DraClientBeginCreateOptions) (*policy.Request, error) { +func (client *FabricAgentClient) createCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, resource FabricAgentModel, _ *FabricAgentClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -119,48 +114,48 @@ func (client *DraClient) createCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 fabric agent. +// BeginDelete - Deletes fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - fabricAgentName - The fabric agent (Dra) name. -// - options - DraClientBeginDeleteOptions contains the optional parameters for the DraClient.BeginDelete method. -func (client *DraClient) BeginDelete(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientBeginDeleteOptions) (*runtime.Poller[DraClientDeleteResponse], error) { +// - fabricAgentName - The fabric agent name. +// - options - FabricAgentClientBeginDeleteOptions contains the optional parameters for the FabricAgentClient.BeginDelete method. +func (client *FabricAgentClient) BeginDelete(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *FabricAgentClientBeginDeleteOptions) (*runtime.Poller[FabricAgentClientDeleteResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.deleteOperation(ctx, resourceGroupName, fabricName, fabricAgentName, options) if err != nil { return nil, err } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DraClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[FabricAgentClientDeleteResponse]{ + Tracer: client.internal.Tracer(), }) return poller, err } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[DraClientDeleteResponse]{ + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[FabricAgentClientDeleteResponse]{ Tracer: client.internal.Tracer(), }) } } -// Delete - Deletes the fabric agent. +// Delete - Deletes fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *DraClient) deleteOperation(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientBeginDeleteOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *FabricAgentClient) deleteOperation(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *FabricAgentClientBeginDeleteOptions) (*http.Response, error) { var err error - const operationName = "DraClient.BeginDelete" + const operationName = "FabricAgentClient.BeginDelete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() @@ -180,7 +175,7 @@ func (client *DraClient) deleteOperation(ctx context.Context, resourceGroupName } // deleteCreateRequest creates the Delete request. -func (client *DraClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientBeginDeleteOptions) (*policy.Request, error) { +func (client *FabricAgentClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, _ *FabricAgentClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -203,7 +198,7 @@ func (client *DraClient) deleteCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,35 +207,35 @@ func (client *DraClient) deleteCreateRequest(ctx context.Context, resourceGroupN // Get - Gets the details of the fabric agent. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - fabricAgentName - The fabric agent (Dra) name. -// - options - DraClientGetOptions contains the optional parameters for the DraClient.Get method. -func (client *DraClient) Get(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientGetOptions) (DraClientGetResponse, error) { +// - fabricAgentName - The fabric agent name. +// - options - FabricAgentClientGetOptions contains the optional parameters for the FabricAgentClient.Get method. +func (client *FabricAgentClient) Get(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *FabricAgentClientGetOptions) (FabricAgentClientGetResponse, error) { var err error - const operationName = "DraClient.Get" + const operationName = "FabricAgentClient.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, fabricName, fabricAgentName, options) if err != nil { - return DraClientGetResponse{}, err + return FabricAgentClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return DraClientGetResponse{}, err + return FabricAgentClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return DraClientGetResponse{}, err + return FabricAgentClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *DraClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *DraClientGetOptions) (*policy.Request, error) { +func (client *FabricAgentClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, _ *FabricAgentClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents/{fabricAgentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -263,34 +258,34 @@ func (client *DraClient) getCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 *DraClient) getHandleResponse(resp *http.Response) (DraClientGetResponse, error) { - result := DraClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DraModel); err != nil { - return DraClientGetResponse{}, err +func (client *FabricAgentClient) getHandleResponse(resp *http.Response) (FabricAgentClientGetResponse, error) { + result := FabricAgentClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FabricAgentModel); err != nil { + return FabricAgentClientGetResponse{}, err } return result, nil } // NewListPager - Gets the list of fabric agents in the given fabric. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - fabricName - The fabric name. -// - options - DraClientListOptions contains the optional parameters for the DraClient.NewListPager method. -func (client *DraClient) NewListPager(resourceGroupName string, fabricName string, options *DraClientListOptions) *runtime.Pager[DraClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[DraClientListResponse]{ - More: func(page DraClientListResponse) bool { +// - options - FabricAgentClientListOptions contains the optional parameters for the FabricAgentClient.NewListPager method. +func (client *FabricAgentClient) NewListPager(resourceGroupName string, fabricName string, options *FabricAgentClientListOptions) *runtime.Pager[FabricAgentClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[FabricAgentClientListResponse]{ + More: func(page FabricAgentClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *DraClientListResponse) (DraClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DraClient.NewListPager") + Fetcher: func(ctx context.Context, page *FabricAgentClientListResponse) (FabricAgentClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FabricAgentClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -299,7 +294,7 @@ func (client *DraClient) NewListPager(resourceGroupName string, fabricName strin return client.listCreateRequest(ctx, resourceGroupName, fabricName, options) }, nil) if err != nil { - return DraClientListResponse{}, err + return FabricAgentClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -308,7 +303,7 @@ func (client *DraClient) NewListPager(resourceGroupName string, fabricName strin } // listCreateRequest creates the List request. -func (client *DraClient) listCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, options *DraClientListOptions) (*policy.Request, error) { +func (client *FabricAgentClient) listCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, _ *FabricAgentClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/fabricAgents" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -327,17 +322,17 @@ func (client *DraClient) listCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 *DraClient) listHandleResponse(resp *http.Response) (DraClientListResponse, error) { - result := DraClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.DraModelCollection); err != nil { - return DraClientListResponse{}, err +func (client *FabricAgentClient) listHandleResponse(resp *http.Response) (FabricAgentClientListResponse, error) { + result := FabricAgentClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FabricAgentModelListResult); err != nil { + return FabricAgentClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_client_example_test.go similarity index 61% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client_example_test.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_client_example_test.go index 2bdd8ac581b3..e750fb54a13a 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/dra_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricagent_client_example_test.go @@ -1,262 +1,253 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Get.json -func ExampleDraClient_Get() { +// Generated from example definition: 2024-09-01/FabricAgent_Create.json +func ExampleFabricAgentClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewDraClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", nil) + poller, err := clientFactory.NewFabricAgentClient().BeginCreate(ctx, "rgswagger_2024-09-01", "wPR", "M", armrecoveryservicesdatareplication.FabricAgentModel{ + Properties: &armrecoveryservicesdatareplication.FabricAgentModelProperties{ + MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), + MachineName: to.Ptr("y"), + AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + ObjectID: to.Ptr("khsiaqfbpuhp"), + Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + }, + ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + ObjectID: to.Ptr("khsiaqfbpuhp"), + Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + }, + }, + }, 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.DraModel = armrecoveryservicesdatareplication.DraModel{ - // Name: to.Ptr("ioxmwhzrzdilxivkvhpvzexl"), - // Type: to.Ptr("ptgmahzsyv"), - // ID: to.Ptr("anp"), - // Properties: &armrecoveryservicesdatareplication.DraModelProperties{ - // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - // }, - // CorrelationID: to.Ptr("t"), - // CustomProperties: &armrecoveryservicesdatareplication.DraModelCustomProperties{ - // InstanceType: to.Ptr("DraModelCustomProperties"), - // }, - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // res = armrecoveryservicesdatareplication.FabricAgentClientCreateResponse{ + // FabricAgentModel: &armrecoveryservicesdatareplication.FabricAgentModel{ + // Properties: &armrecoveryservicesdatareplication.FabricAgentModelProperties{ + // MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), + // MachineName: to.Ptr("y"), + // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + // ObjectID: to.Ptr("khsiaqfbpuhp"), + // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + // }, + // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + // ObjectID: to.Ptr("khsiaqfbpuhp"), + // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + // }, + // CorrelationID: to.Ptr("t"), + // IsResponsive: to.Ptr(true), + // LastHeartbeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.127Z"); return t}()), + // VersionNumber: to.Ptr("wnksfnisrhs"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // IsResponsive: to.Ptr(true), - // LastHeartbeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.127Z"); return t}()), - // MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), - // MachineName: to.Ptr("y"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, // }, - // VersionNumber: to.Ptr("wnksfnisrhs"), // }, - // SystemData: &armrecoveryservicesdatareplication.DraModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // CreatedBy: to.Ptr("fazidmklka"), - // CreatedByType: to.Ptr("obpndgkaeyklqzmpjh"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // LastModifiedBy: to.Ptr("cfoopkrisaroztncgss"), - // LastModifiedByType: to.Ptr("dysxbvohxhrpl"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1/fabricAgents/agent1"), + // Name: to.Ptr("ioxmwhzrzdilxivkvhpvzexl"), + // Type: to.Ptr("ptgmahzsyv"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // LastModifiedBy: to.Ptr("rx"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Create.json -func ExampleDraClient_BeginCreate() { +// Generated from example definition: 2024-09-01/FabricAgent_Delete.json +func ExampleFabricAgentClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewDraClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", armrecoveryservicesdatareplication.DraModel{ - Properties: &armrecoveryservicesdatareplication.DraModelProperties{ - AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - ObjectID: to.Ptr("khsiaqfbpuhp"), - TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - }, - CustomProperties: &armrecoveryservicesdatareplication.DraModelCustomProperties{ - InstanceType: to.Ptr("DraModelCustomProperties"), - }, - MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), - MachineName: to.Ptr("y"), - ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - ObjectID: to.Ptr("khsiaqfbpuhp"), - TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - }, - }, - }, nil) + poller, err := clientFactory.NewFabricAgentClient().BeginDelete(ctx, "rgswagger_2024-09-01", "wPR", "M", 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/FabricAgent_Get.json +func ExampleFabricAgentClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFabricAgentClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", 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.DraModel = armrecoveryservicesdatareplication.DraModel{ - // Name: to.Ptr("ioxmwhzrzdilxivkvhpvzexl"), - // Type: to.Ptr("ptgmahzsyv"), - // ID: to.Ptr("anp"), - // Properties: &armrecoveryservicesdatareplication.DraModelProperties{ - // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - // }, - // CorrelationID: to.Ptr("t"), - // CustomProperties: &armrecoveryservicesdatareplication.DraModelCustomProperties{ - // InstanceType: to.Ptr("DraModelCustomProperties"), - // }, - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // res = armrecoveryservicesdatareplication.FabricAgentClientGetResponse{ + // FabricAgentModel: &armrecoveryservicesdatareplication.FabricAgentModel{ + // Properties: &armrecoveryservicesdatareplication.FabricAgentModelProperties{ + // CorrelationID: to.Ptr("t"), + // MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), + // MachineName: to.Ptr("y"), + // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + // ObjectID: to.Ptr("khsiaqfbpuhp"), + // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + // }, + // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + // ObjectID: to.Ptr("khsiaqfbpuhp"), + // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + // }, + // IsResponsive: to.Ptr(true), + // LastHeartbeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.127Z"); return t}()), + // VersionNumber: to.Ptr("wnksfnisrhs"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // IsResponsive: to.Ptr(true), - // LastHeartbeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.127Z"); return t}()), - // MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), - // MachineName: to.Ptr("y"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, // }, - // VersionNumber: to.Ptr("wnksfnisrhs"), // }, - // SystemData: &armrecoveryservicesdatareplication.DraModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1/fabricAgents/agent1"), + // Name: to.Ptr("ioxmwhzrzdilxivkvhpvzexl"), + // Type: to.Ptr("ptgmahzsyv"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("fazidmklka"), - // CreatedByType: to.Ptr("obpndgkaeyklqzmpjh"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // LastModifiedBy: to.Ptr("cfoopkrisaroztncgss"), - // LastModifiedByType: to.Ptr("dysxbvohxhrpl"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_Delete.json -func ExampleDraClient_BeginDelete() { +// Generated from example definition: 2024-09-01/FabricAgent_List.json +func ExampleFabricAgentClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewDraClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", 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/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Dra_List.json -func ExampleDraClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDraClient().NewListPager("rgrecoveryservicesdatareplication", "wPR", nil) + pager := clientFactory.NewFabricAgentClient().NewListPager("rgswagger_2024-09-01", "wPR", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -267,78 +258,75 @@ func ExampleDraClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DraModelCollection = armrecoveryservicesdatareplication.DraModelCollection{ - // Value: []*armrecoveryservicesdatareplication.DraModel{ - // { - // Name: to.Ptr("ioxmwhzrzdilxivkvhpvzexl"), - // Type: to.Ptr("ptgmahzsyv"), - // ID: to.Ptr("anp"), - // Properties: &armrecoveryservicesdatareplication.DraModelProperties{ - // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), - // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), - // ObjectID: to.Ptr("khsiaqfbpuhp"), - // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), - // }, - // CorrelationID: to.Ptr("t"), - // CustomProperties: &armrecoveryservicesdatareplication.DraModelCustomProperties{ - // InstanceType: to.Ptr("DraModelCustomProperties"), - // }, - // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ - // { - // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, + // page = armrecoveryservicesdatareplication.FabricAgentClientListResponse{ + // FabricAgentModelListResult: armrecoveryservicesdatareplication.FabricAgentModelListResult{ + // Value: []*armrecoveryservicesdatareplication.FabricAgentModel{ + // { + // Properties: &armrecoveryservicesdatareplication.FabricAgentModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // Category: to.Ptr("lcsdxrqxquke"), // Severity: to.Ptr("wqxxiuaqjyagq"), // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("djsmgrltruljo"), - // }}, + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // Category: to.Ptr("leigw"), // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // IsResponsive: to.Ptr(true), - // LastHeartbeat: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.127Z"); return t}()), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, // MachineID: to.Ptr("envzcoijbqhtrpncbjbhk"), // MachineName: to.Ptr("y"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ - // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + // AuthenticationIdentity: &armrecoveryservicesdatareplication.IdentityModel{ + // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), - // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), // ObjectID: to.Ptr("khsiaqfbpuhp"), + // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), + // }, + // ResourceAccessIdentity: &armrecoveryservicesdatareplication.IdentityModel{ // TenantID: to.Ptr("joclkkdovixwapephhxaqtefubhhmq"), + // ApplicationID: to.Ptr("cwktzrwajuvfyyymfstpey"), + // ObjectID: to.Ptr("khsiaqfbpuhp"), + // Audience: to.Ptr("dkjobanyqgzenivyxhvavottpc"), + // AADAuthority: to.Ptr("bubwwbowfhdmujrt"), // }, - // VersionNumber: to.Ptr("wnksfnisrhs"), // }, - // SystemData: &armrecoveryservicesdatareplication.DraModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // CreatedBy: to.Ptr("fazidmklka"), - // CreatedByType: to.Ptr("obpndgkaeyklqzmpjh"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // LastModifiedBy: to.Ptr("cfoopkrisaroztncgss"), - // LastModifiedByType: to.Ptr("dysxbvohxhrpl"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationFabrics/fabric1/fabricAgents/agent1"), + // Name: to.Ptr("rhojydcwjgvgexpdwswjib"), + // Type: to.Ptr("toipsryjyqchikyakeiuatshiu"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("yhdmbqrsgimuucexvpas"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), + // LastModifiedBy: to.Ptr("balecqnwu"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.716Z"); return t}()), // }, - // }}, - // } + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client.go deleted file mode 100644 index 5040d6ee8038..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client.go +++ /dev/null @@ -1,114 +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 armrecoveryservicesdatareplication - -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" -) - -// FabricOperationsStatusClient contains the methods for the FabricOperationsStatus group. -// Don't use this type directly, use NewFabricOperationsStatusClient() instead. -type FabricOperationsStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewFabricOperationsStatusClient creates a new instance of FabricOperationsStatusClient 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 NewFabricOperationsStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FabricOperationsStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &FabricOperationsStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the fabric. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - fabricName - The fabric name. -// - operationID - The ID of an ongoing async operation. -// - options - FabricOperationsStatusClientGetOptions contains the optional parameters for the FabricOperationsStatusClient.Get -// method. -func (client *FabricOperationsStatusClient) Get(ctx context.Context, resourceGroupName string, fabricName string, operationID string, options *FabricOperationsStatusClientGetOptions) (FabricOperationsStatusClientGetResponse, error) { - var err error - const operationName = "FabricOperationsStatusClient.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, fabricName, operationID, options) - if err != nil { - return FabricOperationsStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return FabricOperationsStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return FabricOperationsStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *FabricOperationsStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, fabricName string, operationID string, options *FabricOperationsStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationFabrics/{fabricName}/operations/{operationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if fabricName == "" { - return nil, errors.New("parameter fabricName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{fabricName}", url.PathEscape(fabricName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - 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-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *FabricOperationsStatusClient) getHandleResponse(resp *http.Response) (FabricOperationsStatusClientGetResponse, error) { - result := FabricOperationsStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return FabricOperationsStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client_example_test.go deleted file mode 100644 index aa16c991ae06..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fabricoperationsstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/FabricOperationsStatus_Get.json -func ExampleFabricOperationsStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewFabricOperationsStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", "dvfwerv", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/azuresiterecoverymanagementserviceapi_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/azuresiterecoverymanagementserviceapi_server.go deleted file mode 100644 index 0ee5620aab6e..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/azuresiterecoverymanagementserviceapi_server.go +++ /dev/null @@ -1,156 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "reflect" - "regexp" -) - -// AzureSiteRecoveryManagementServiceAPIServer is a fake server for instances of the armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClient type. -type AzureSiteRecoveryManagementServiceAPIServer struct { - // CheckNameAvailability is the fake for method AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability - // HTTP status codes to indicate success: http.StatusOK - CheckNameAvailability func(ctx context.Context, location string, options *armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse], errResp azfake.ErrorResponder) - - // DeploymentPreflight is the fake for method AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight - // HTTP status codes to indicate success: http.StatusOK - DeploymentPreflight func(ctx context.Context, resourceGroupName string, deploymentID string, options *armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse], errResp azfake.ErrorResponder) -} - -// NewAzureSiteRecoveryManagementServiceAPIServerTransport creates a new instance of AzureSiteRecoveryManagementServiceAPIServerTransport with the provided implementation. -// The returned AzureSiteRecoveryManagementServiceAPIServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAzureSiteRecoveryManagementServiceAPIServerTransport(srv *AzureSiteRecoveryManagementServiceAPIServer) *AzureSiteRecoveryManagementServiceAPIServerTransport { - return &AzureSiteRecoveryManagementServiceAPIServerTransport{srv: srv} -} - -// AzureSiteRecoveryManagementServiceAPIServerTransport connects instances of armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClient to instances of AzureSiteRecoveryManagementServiceAPIServer. -// Don't use this type directly, use NewAzureSiteRecoveryManagementServiceAPIServerTransport instead. -type AzureSiteRecoveryManagementServiceAPIServerTransport struct { - srv *AzureSiteRecoveryManagementServiceAPIServer -} - -// Do implements the policy.Transporter interface for AzureSiteRecoveryManagementServiceAPIServerTransport. -func (a *AzureSiteRecoveryManagementServiceAPIServerTransport) 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 "AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability": - resp, err = a.dispatchCheckNameAvailability(req) - case "AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight": - resp, err = a.dispatchDeploymentPreflight(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AzureSiteRecoveryManagementServiceAPIServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { - if a.srv.CheckNameAvailability == nil { - return nil, &nonRetriableError{errors.New("fake for method CheckNameAvailability not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkNameAvailability` - 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[armrecoveryservicesdatareplication.CheckNameAvailabilityModel](req) - if err != nil { - return nil, err - } - locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) - if err != nil { - return nil, err - } - var options *armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions - if !reflect.ValueOf(body).IsZero() { - options = &armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions{ - Body: &body, - } - } - respr, errRespr := a.srv.CheckNameAvailability(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).CheckNameAvailabilityResponseModel, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AzureSiteRecoveryManagementServiceAPIServerTransport) dispatchDeploymentPreflight(req *http.Request) (*http.Response, error) { - if a.srv.DeploymentPreflight == nil { - return nil, &nonRetriableError{errors.New("fake for method DeploymentPreflight not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/deployments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/preflight` - 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[armrecoveryservicesdatareplication.DeploymentPreflightModel](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - deploymentIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentId")]) - if err != nil { - return nil, err - } - var options *armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions - if !reflect.ValueOf(body).IsZero() { - options = &armrecoveryservicesdatareplication.AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions{ - Body: &body, - } - } - respr, errRespr := a.srv.DeploymentPreflight(req.Context(), resourceGroupNameParam, deploymentIDParam, 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).DeploymentPreflightModel, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/checknameavailability_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/checknameavailability_server.go new file mode 100644 index 000000000000..8845f402769e --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/checknameavailability_server.go @@ -0,0 +1,128 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "reflect" + "regexp" +) + +// CheckNameAvailabilityServer is a fake server for instances of the armrecoveryservicesdatareplication.CheckNameAvailabilityClient type. +type CheckNameAvailabilityServer struct { + // Post is the fake for method CheckNameAvailabilityClient.Post + // HTTP status codes to indicate success: http.StatusOK + Post func(ctx context.Context, location string, options *armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostResponse], errResp azfake.ErrorResponder) +} + +// NewCheckNameAvailabilityServerTransport creates a new instance of CheckNameAvailabilityServerTransport with the provided implementation. +// The returned CheckNameAvailabilityServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.CheckNameAvailabilityClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCheckNameAvailabilityServerTransport(srv *CheckNameAvailabilityServer) *CheckNameAvailabilityServerTransport { + return &CheckNameAvailabilityServerTransport{srv: srv} +} + +// CheckNameAvailabilityServerTransport connects instances of armrecoveryservicesdatareplication.CheckNameAvailabilityClient to instances of CheckNameAvailabilityServer. +// Don't use this type directly, use NewCheckNameAvailabilityServerTransport instead. +type CheckNameAvailabilityServerTransport struct { + srv *CheckNameAvailabilityServer +} + +// Do implements the policy.Transporter interface for CheckNameAvailabilityServerTransport. +func (c *CheckNameAvailabilityServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return c.dispatchToMethodFake(req, method) +} + +func (c *CheckNameAvailabilityServerTransport) 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 checkNameAvailabilityServerTransportInterceptor != nil { + res.resp, res.err, intercepted = checkNameAvailabilityServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CheckNameAvailabilityClient.Post": + res.resp, res.err = c.dispatchPost(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (c *CheckNameAvailabilityServerTransport) dispatchPost(req *http.Request) (*http.Response, error) { + if c.srv.Post == nil { + return nil, &nonRetriableError{errors.New("fake for method Post not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkNameAvailability` + 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[armrecoveryservicesdatareplication.CheckNameAvailabilityModel](req) + if err != nil { + return nil, err + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + var options *armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostOptions + if !reflect.ValueOf(body).IsZero() { + options = &armrecoveryservicesdatareplication.CheckNameAvailabilityClientPostOptions{ + Body: &body, + } + } + respr, errRespr := c.srv.Post(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).CheckNameAvailabilityResponseModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to CheckNameAvailabilityServerTransport +var checkNameAvailabilityServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/deploymentpreflight_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/deploymentpreflight_server.go new file mode 100644 index 000000000000..3d4d025bdc5f --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/deploymentpreflight_server.go @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "reflect" + "regexp" +) + +// DeploymentPreflightServer is a fake server for instances of the armrecoveryservicesdatareplication.DeploymentPreflightClient type. +type DeploymentPreflightServer struct { + // Post is the fake for method DeploymentPreflightClient.Post + // HTTP status codes to indicate success: http.StatusOK + Post func(ctx context.Context, resourceGroupName string, deploymentID string, options *armrecoveryservicesdatareplication.DeploymentPreflightClientPostOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.DeploymentPreflightClientPostResponse], errResp azfake.ErrorResponder) +} + +// NewDeploymentPreflightServerTransport creates a new instance of DeploymentPreflightServerTransport with the provided implementation. +// The returned DeploymentPreflightServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.DeploymentPreflightClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewDeploymentPreflightServerTransport(srv *DeploymentPreflightServer) *DeploymentPreflightServerTransport { + return &DeploymentPreflightServerTransport{srv: srv} +} + +// DeploymentPreflightServerTransport connects instances of armrecoveryservicesdatareplication.DeploymentPreflightClient to instances of DeploymentPreflightServer. +// Don't use this type directly, use NewDeploymentPreflightServerTransport instead. +type DeploymentPreflightServerTransport struct { + srv *DeploymentPreflightServer +} + +// Do implements the policy.Transporter interface for DeploymentPreflightServerTransport. +func (d *DeploymentPreflightServerTransport) 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 d.dispatchToMethodFake(req, method) +} + +func (d *DeploymentPreflightServerTransport) 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 deploymentPreflightServerTransportInterceptor != nil { + res.resp, res.err, intercepted = deploymentPreflightServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DeploymentPreflightClient.Post": + res.resp, res.err = d.dispatchPost(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (d *DeploymentPreflightServerTransport) dispatchPost(req *http.Request) (*http.Response, error) { + if d.srv.Post == nil { + return nil, &nonRetriableError{errors.New("fake for method Post not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/deployments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/preflight` + 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[armrecoveryservicesdatareplication.DeploymentPreflightModel](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + deploymentIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("deploymentId")]) + if err != nil { + return nil, err + } + var options *armrecoveryservicesdatareplication.DeploymentPreflightClientPostOptions + if !reflect.ValueOf(body).IsZero() { + options = &armrecoveryservicesdatareplication.DeploymentPreflightClientPostOptions{ + Body: &body, + } + } + respr, errRespr := d.srv.Post(req.Context(), resourceGroupNameParam, deploymentIDParam, 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).DeploymentPreflightModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to DeploymentPreflightServerTransport +var deploymentPreflightServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/draoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/draoperationstatus_server.go deleted file mode 100644 index a75730929104..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/draoperationstatus_server.go +++ /dev/null @@ -1,108 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// DraOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.DraOperationStatusClient type. -type DraOperationStatusServer struct { - // Get is the fake for method DraOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, operationID string, options *armrecoveryservicesdatareplication.DraOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.DraOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewDraOperationStatusServerTransport creates a new instance of DraOperationStatusServerTransport with the provided implementation. -// The returned DraOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.DraOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDraOperationStatusServerTransport(srv *DraOperationStatusServer) *DraOperationStatusServerTransport { - return &DraOperationStatusServerTransport{srv: srv} -} - -// DraOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.DraOperationStatusClient to instances of DraOperationStatusServer. -// Don't use this type directly, use NewDraOperationStatusServerTransport instead. -type DraOperationStatusServerTransport struct { - srv *DraOperationStatusServer -} - -// Do implements the policy.Transporter interface for DraOperationStatusServerTransport. -func (d *DraOperationStatusServerTransport) 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 "DraOperationStatusClient.Get": - resp, err = d.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (d *DraOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.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\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - fabricAgentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricAgentName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/emailconfiguration_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/emailconfiguration_server.go index f83de718be7b..7a4f832ff46e 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/emailconfiguration_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/emailconfiguration_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 @@ -26,7 +22,7 @@ import ( type EmailConfigurationServer struct { // Create is the fake for method EmailConfigurationClient.Create // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, body armrecoveryservicesdatareplication.EmailConfigurationModel, options *armrecoveryservicesdatareplication.EmailConfigurationClientCreateOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.EmailConfigurationClientCreateResponse], errResp azfake.ErrorResponder) + Create func(ctx context.Context, resourceGroupName string, vaultName string, emailConfigurationName string, resource armrecoveryservicesdatareplication.EmailConfigurationModel, options *armrecoveryservicesdatareplication.EmailConfigurationClientCreateOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.EmailConfigurationClientCreateResponse], errResp azfake.ErrorResponder) // Get is the fake for method EmailConfigurationClient.Get // HTTP status codes to indicate success: http.StatusOK @@ -62,25 +58,44 @@ func (e *EmailConfigurationServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return e.dispatchToMethodFake(req, method) +} - switch method { - case "EmailConfigurationClient.Create": - resp, err = e.dispatchCreate(req) - case "EmailConfigurationClient.Get": - resp, err = e.dispatchGet(req) - case "EmailConfigurationClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (e *EmailConfigurationServerTransport) 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 emailConfigurationServerTransportInterceptor != nil { + res.resp, res.err, intercepted = emailConfigurationServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EmailConfigurationClient.Create": + res.resp, res.err = e.dispatchCreate(req) + case "EmailConfigurationClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EmailConfigurationClient.NewListPager": + res.resp, res.err = e.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 (e *EmailConfigurationServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { @@ -201,3 +216,9 @@ func (e *EmailConfigurationServerTransport) dispatchNewListPager(req *http.Reque } return resp, nil } + +// set this to conditionally intercept incoming requests to EmailConfigurationServerTransport +var emailConfigurationServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/event_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/event_server.go index d90d1ea812b1..26fd8cd22092 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/event_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/event_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 @@ -20,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "strconv" ) // EventServer is a fake server for instances of the armrecoveryservicesdatareplication.EventClient type. @@ -58,23 +55,42 @@ func (e *EventServerTransport) 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 e.dispatchToMethodFake(req, method) +} - switch method { - case "EventClient.Get": - resp, err = e.dispatchGet(req) - case "EventClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (e *EventServerTransport) 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 eventServerTransportInterceptor != nil { + res.resp, res.err, intercepted = eventServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EventClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EventClient.NewListPager": + res.resp, res.err = e.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 (e *EventServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -131,25 +147,40 @@ func (e *EventServerTransport) dispatchNewListPager(req *http.Request) (*http.Re if err != nil { return nil, err } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + odataOptionsUnescaped, err := url.QueryUnescape(qp.Get("odataOptions")) if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + odataOptionsParam := getOptional(odataOptionsUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) if err != nil { return nil, err } - filterParam := getOptional(filterUnescaped) - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + continuationTokenParam := getOptional(continuationTokenUnescaped) + pageSizeUnescaped, err := url.QueryUnescape(qp.Get("pageSize")) + if err != nil { + return nil, err + } + pageSizeParam, err := parseOptional(pageSizeUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) if err != nil { return nil, err } - continuationTokenParam := getOptional(continuationTokenUnescaped) var options *armrecoveryservicesdatareplication.EventClientListOptions - if filterParam != nil || continuationTokenParam != nil { + if odataOptionsParam != nil || continuationTokenParam != nil || pageSizeParam != nil { options = &armrecoveryservicesdatareplication.EventClientListOptions{ - Filter: filterParam, + OdataOptions: odataOptionsParam, ContinuationToken: continuationTokenParam, + PageSize: pageSizeParam, } } resp := e.srv.NewListPager(resourceGroupNameParam, vaultNameParam, options) @@ -172,3 +203,9 @@ func (e *EventServerTransport) dispatchNewListPager(req *http.Request) (*http.Re } return resp, nil } + +// set this to conditionally intercept incoming requests to EventServerTransport +var eventServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabric_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabric_server.go index 5796316ad798..9d1a381b2774 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabric_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabric_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 @@ -26,10 +22,10 @@ import ( type FabricServer struct { // BeginCreate is the fake for method FabricClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, fabricName string, body armrecoveryservicesdatareplication.FabricModel, options *armrecoveryservicesdatareplication.FabricClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, fabricName string, resource armrecoveryservicesdatareplication.FabricModel, options *armrecoveryservicesdatareplication.FabricClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method FabricClient.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, fabricName string, options *armrecoveryservicesdatareplication.FabricClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method FabricClient.Get @@ -46,7 +42,7 @@ type FabricServer struct { // BeginUpdate is the fake for method FabricClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, fabricName string, body armrecoveryservicesdatareplication.FabricModelUpdate, options *armrecoveryservicesdatareplication.FabricClientBeginUpdateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, fabricName string, properties armrecoveryservicesdatareplication.FabricModelUpdate, options *armrecoveryservicesdatareplication.FabricClientBeginUpdateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricClientUpdateResponse], errResp azfake.ErrorResponder) } // NewFabricServerTransport creates a new instance of FabricServerTransport with the provided implementation. @@ -82,31 +78,50 @@ func (f *FabricServerTransport) 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 f.dispatchToMethodFake(req, method) +} - switch method { - case "FabricClient.BeginCreate": - resp, err = f.dispatchBeginCreate(req) - case "FabricClient.BeginDelete": - resp, err = f.dispatchBeginDelete(req) - case "FabricClient.Get": - resp, err = f.dispatchGet(req) - case "FabricClient.NewListPager": - resp, err = f.dispatchNewListPager(req) - case "FabricClient.NewListBySubscriptionPager": - resp, err = f.dispatchNewListBySubscriptionPager(req) - case "FabricClient.BeginUpdate": - resp, err = f.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (f *FabricServerTransport) 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 fabricServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fabricServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FabricClient.BeginCreate": + res.resp, res.err = f.dispatchBeginCreate(req) + case "FabricClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FabricClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FabricClient.NewListPager": + res.resp, res.err = f.dispatchNewListPager(req) + case "FabricClient.NewListBySubscriptionPager": + res.resp, res.err = f.dispatchNewListBySubscriptionPager(req) + case "FabricClient.BeginUpdate": + res.resp, res.err = f.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (f *FabricServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -190,9 +205,9 @@ func (f *FabricServerTransport) 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) @@ -295,19 +310,7 @@ func (f *FabricServerTransport) dispatchNewListBySubscriptionPager(req *http.Req if matches == nil || len(matches) < 1 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - qp := req.URL.Query() - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) - if err != nil { - return nil, err - } - continuationTokenParam := getOptional(continuationTokenUnescaped) - var options *armrecoveryservicesdatareplication.FabricClientListBySubscriptionOptions - if continuationTokenParam != nil { - options = &armrecoveryservicesdatareplication.FabricClientListBySubscriptionOptions{ - ContinuationToken: continuationTokenParam, - } - } - resp := f.srv.NewListBySubscriptionPager(options) + resp := f.srv.NewListBySubscriptionPager(nil) newListBySubscriptionPager = &resp f.newListBySubscriptionPager.add(req, newListBySubscriptionPager) server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armrecoveryservicesdatareplication.FabricClientListBySubscriptionResponse, createLink func() string) { @@ -375,3 +378,9 @@ func (f *FabricServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Re return resp, nil } + +// set this to conditionally intercept incoming requests to FabricServerTransport +var fabricServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/dra_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricagent_server.go similarity index 59% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/dra_server.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricagent_server.go index a143f61daa2e..4e5c15ee9294 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/dra_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricagent_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 @@ -22,82 +18,101 @@ import ( "regexp" ) -// DraServer is a fake server for instances of the armrecoveryservicesdatareplication.DraClient type. -type DraServer struct { - // BeginCreate is the fake for method DraClient.BeginCreate +// FabricAgentServer is a fake server for instances of the armrecoveryservicesdatareplication.FabricAgentClient type. +type FabricAgentServer struct { + // BeginCreate is the fake for method FabricAgentClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, body armrecoveryservicesdatareplication.DraModel, options *armrecoveryservicesdatareplication.DraClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, resource armrecoveryservicesdatareplication.FabricAgentModel, options *armrecoveryservicesdatareplication.FabricAgentClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientCreateResponse], errResp azfake.ErrorResponder) - // BeginDelete is the fake for method DraClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent - BeginDelete func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *armrecoveryservicesdatareplication.DraClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientDeleteResponse], errResp azfake.ErrorResponder) + // BeginDelete is the fake for method FabricAgentClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *armrecoveryservicesdatareplication.FabricAgentClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientDeleteResponse], errResp azfake.ErrorResponder) - // Get is the fake for method DraClient.Get + // Get is the fake for method FabricAgentClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *armrecoveryservicesdatareplication.DraClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.DraClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, fabricName string, fabricAgentName string, options *armrecoveryservicesdatareplication.FabricAgentClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.FabricAgentClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method DraClient.NewListPager + // NewListPager is the fake for method FabricAgentClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, fabricName string, options *armrecoveryservicesdatareplication.DraClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.DraClientListResponse]) + NewListPager func(resourceGroupName string, fabricName string, options *armrecoveryservicesdatareplication.FabricAgentClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.FabricAgentClientListResponse]) } -// NewDraServerTransport creates a new instance of DraServerTransport with the provided implementation. -// The returned DraServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.DraClient via the +// NewFabricAgentServerTransport creates a new instance of FabricAgentServerTransport with the provided implementation. +// The returned FabricAgentServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.FabricAgentClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewDraServerTransport(srv *DraServer) *DraServerTransport { - return &DraServerTransport{ +func NewFabricAgentServerTransport(srv *FabricAgentServer) *FabricAgentServerTransport { + return &FabricAgentServerTransport{ srv: srv, - beginCreate: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientCreateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.DraClientListResponse]](), + beginCreate: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.FabricAgentClientListResponse]](), } } -// DraServerTransport connects instances of armrecoveryservicesdatareplication.DraClient to instances of DraServer. -// Don't use this type directly, use NewDraServerTransport instead. -type DraServerTransport struct { - srv *DraServer - beginCreate *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientCreateResponse]] - beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.DraClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.DraClientListResponse]] +// FabricAgentServerTransport connects instances of armrecoveryservicesdatareplication.FabricAgentClient to instances of FabricAgentServer. +// Don't use this type directly, use NewFabricAgentServerTransport instead. +type FabricAgentServerTransport struct { + srv *FabricAgentServer + beginCreate *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.FabricAgentClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.FabricAgentClientListResponse]] } -// Do implements the policy.Transporter interface for DraServerTransport. -func (d *DraServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for FabricAgentServerTransport. +func (f *FabricAgentServerTransport) 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 + return f.dispatchToMethodFake(req, method) +} - switch method { - case "DraClient.BeginCreate": - resp, err = d.dispatchBeginCreate(req) - case "DraClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DraClient.Get": - resp, err = d.dispatchGet(req) - case "DraClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (f *FabricAgentServerTransport) 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 fabricAgentServerTransportInterceptor != nil { + res.resp, res.err, intercepted = fabricAgentServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FabricAgentClient.BeginCreate": + res.resp, res.err = f.dispatchBeginCreate(req) + case "FabricAgentClient.BeginDelete": + res.resp, res.err = f.dispatchBeginDelete(req) + case "FabricAgentClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FabricAgentClient.NewListPager": + res.resp, res.err = f.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 (d *DraServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { - if d.srv.BeginCreate == nil { +func (f *FabricAgentServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if f.srv.BeginCreate == nil { return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} } - beginCreate := d.beginCreate.get(req) + beginCreate := f.beginCreate.get(req) if beginCreate == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) @@ -105,7 +120,7 @@ func (d *DraServerTransport) dispatchBeginCreate(req *http.Request) (*http.Respo if matches == nil || len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.DraModel](req) + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.FabricAgentModel](req) if err != nil { return nil, err } @@ -121,12 +136,12 @@ func (d *DraServerTransport) dispatchBeginCreate(req *http.Request) (*http.Respo if err != nil { return nil, err } - respr, errRespr := d.srv.BeginCreate(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, body, nil) + respr, errRespr := f.srv.BeginCreate(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } beginCreate = &respr - d.beginCreate.add(req, beginCreate) + f.beginCreate.add(req, beginCreate) } resp, err := server.PollerResponderNext(beginCreate, req) @@ -135,21 +150,21 @@ func (d *DraServerTransport) dispatchBeginCreate(req *http.Request) (*http.Respo } if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - d.beginCreate.remove(req) + f.beginCreate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } if !server.PollerResponderMore(beginCreate) { - d.beginCreate.remove(req) + f.beginCreate.remove(req) } return resp, nil } -func (d *DraServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { - if d.srv.BeginDelete == nil { +func (f *FabricAgentServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if f.srv.BeginDelete == nil { return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} } - beginDelete := d.beginDelete.get(req) + beginDelete := f.beginDelete.get(req) if beginDelete == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) @@ -169,12 +184,12 @@ func (d *DraServerTransport) dispatchBeginDelete(req *http.Request) (*http.Respo if err != nil { return nil, err } - respr, errRespr := d.srv.BeginDelete(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, nil) + respr, errRespr := f.srv.BeginDelete(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } beginDelete = &respr - d.beginDelete.add(req, beginDelete) + f.beginDelete.add(req, beginDelete) } resp, err := server.PollerResponderNext(beginDelete, req) @@ -182,19 +197,19 @@ func (d *DraServerTransport) dispatchBeginDelete(req *http.Request) (*http.Respo return nil, err } - if !contains([]int{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)} + 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.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { - d.beginDelete.remove(req) + f.beginDelete.remove(req) } return resp, nil } -func (d *DraServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if d.srv.Get == nil { +func (f *FabricAgentServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if f.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\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` @@ -215,7 +230,7 @@ func (d *DraServerTransport) dispatchGet(req *http.Request) (*http.Response, err if err != nil { return nil, err } - respr, errRespr := d.srv.Get(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, nil) + respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fabricNameParam, fabricAgentNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -223,18 +238,18 @@ func (d *DraServerTransport) dispatchGet(req *http.Request) (*http.Response, err 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).DraModel, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).FabricAgentModel, req) if err != nil { return nil, err } return resp, nil } -func (d *DraServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListPager == nil { +func (f *FabricAgentServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } - newListPager := d.newListPager.get(req) + newListPager := f.newListPager.get(req) if newListPager == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/fabricAgents` regex := regexp.MustCompile(regexStr) @@ -250,10 +265,10 @@ func (d *DraServerTransport) dispatchNewListPager(req *http.Request) (*http.Resp if err != nil { return nil, err } - resp := d.srv.NewListPager(resourceGroupNameParam, fabricNameParam, nil) + resp := f.srv.NewListPager(resourceGroupNameParam, fabricNameParam, nil) newListPager = &resp - d.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.DraClientListResponse, createLink func() string) { + f.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.FabricAgentClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -262,11 +277,17 @@ func (d *DraServerTransport) dispatchNewListPager(req *http.Request) (*http.Resp return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListPager.remove(req) + f.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } if !server.PagerResponderMore(newListPager) { - d.newListPager.remove(req) + f.newListPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to FabricAgentServerTransport +var fabricAgentServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricoperationsstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricoperationsstatus_server.go deleted file mode 100644 index 0dfc5a817303..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/fabricoperationsstatus_server.go +++ /dev/null @@ -1,104 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// FabricOperationsStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.FabricOperationsStatusClient type. -type FabricOperationsStatusServer struct { - // Get is the fake for method FabricOperationsStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, fabricName string, operationID string, options *armrecoveryservicesdatareplication.FabricOperationsStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.FabricOperationsStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewFabricOperationsStatusServerTransport creates a new instance of FabricOperationsStatusServerTransport with the provided implementation. -// The returned FabricOperationsStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.FabricOperationsStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewFabricOperationsStatusServerTransport(srv *FabricOperationsStatusServer) *FabricOperationsStatusServerTransport { - return &FabricOperationsStatusServerTransport{srv: srv} -} - -// FabricOperationsStatusServerTransport connects instances of armrecoveryservicesdatareplication.FabricOperationsStatusClient to instances of FabricOperationsStatusServer. -// Don't use this type directly, use NewFabricOperationsStatusServerTransport instead. -type FabricOperationsStatusServerTransport struct { - srv *FabricOperationsStatusServer -} - -// Do implements the policy.Transporter interface for FabricOperationsStatusServerTransport. -func (f *FabricOperationsStatusServerTransport) 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 "FabricOperationsStatusClient.Get": - resp, err = f.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (f *FabricOperationsStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if f.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\.DataReplication/replicationFabrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?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 - } - fabricNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("fabricName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := f.srv.Get(req.Context(), resourceGroupNameParam, fabricNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/internal.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/internal.go index 7d2f89ba4bb2..41e62ec29233 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/internal.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 @@ -15,6 +11,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflow_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/job_server.go similarity index 53% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflow_server.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/job_server.go index 5231a3fc89a7..5631be3f2bd0 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflow_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/job_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 @@ -20,65 +16,85 @@ import ( "net/http" "net/url" "regexp" + "strconv" ) -// WorkflowServer is a fake server for instances of the armrecoveryservicesdatareplication.WorkflowClient type. -type WorkflowServer struct { - // Get is the fake for method WorkflowClient.Get +// JobServer is a fake server for instances of the armrecoveryservicesdatareplication.JobClient type. +type JobServer struct { + // Get is the fake for method JobClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *armrecoveryservicesdatareplication.WorkflowClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.WorkflowClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *armrecoveryservicesdatareplication.JobClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.JobClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method WorkflowClient.NewListPager + // NewListPager is the fake for method JobClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.WorkflowClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.WorkflowClientListResponse]) + NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.JobClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.JobClientListResponse]) } -// NewWorkflowServerTransport creates a new instance of WorkflowServerTransport with the provided implementation. -// The returned WorkflowServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.WorkflowClient via the +// NewJobServerTransport creates a new instance of JobServerTransport with the provided implementation. +// The returned JobServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.JobClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewWorkflowServerTransport(srv *WorkflowServer) *WorkflowServerTransport { - return &WorkflowServerTransport{ +func NewJobServerTransport(srv *JobServer) *JobServerTransport { + return &JobServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.WorkflowClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.JobClientListResponse]](), } } -// WorkflowServerTransport connects instances of armrecoveryservicesdatareplication.WorkflowClient to instances of WorkflowServer. -// Don't use this type directly, use NewWorkflowServerTransport instead. -type WorkflowServerTransport struct { - srv *WorkflowServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.WorkflowClientListResponse]] +// JobServerTransport connects instances of armrecoveryservicesdatareplication.JobClient to instances of JobServer. +// Don't use this type directly, use NewJobServerTransport instead. +type JobServerTransport struct { + srv *JobServer + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.JobClientListResponse]] } -// Do implements the policy.Transporter interface for WorkflowServerTransport. -func (w *WorkflowServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for JobServerTransport. +func (j *JobServerTransport) 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 + return j.dispatchToMethodFake(req, method) +} - switch method { - case "WorkflowClient.Get": - resp, err = w.dispatchGet(req) - case "WorkflowClient.NewListPager": - resp, err = w.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (j *JobServerTransport) 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 jobServerTransportInterceptor != nil { + res.resp, res.err, intercepted = jobServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "JobClient.Get": + res.resp, res.err = j.dispatchGet(req) + case "JobClient.NewListPager": + res.resp, res.err = j.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 (w *WorkflowServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if w.srv.Get == nil { +func (j *JobServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if j.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\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` @@ -99,7 +115,7 @@ func (w *WorkflowServerTransport) dispatchGet(req *http.Request) (*http.Response if err != nil { return nil, err } - respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, jobNameParam, nil) + respr, errRespr := j.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, jobNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -107,18 +123,18 @@ func (w *WorkflowServerTransport) dispatchGet(req *http.Request) (*http.Response 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).WorkflowModel, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).JobModel, req) if err != nil { return nil, err } return resp, nil } -func (w *WorkflowServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if w.srv.NewListPager == nil { +func (j *JobServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if j.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } - newListPager := w.newListPager.get(req) + newListPager := j.newListPager.get(req) if newListPager == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs` regex := regexp.MustCompile(regexStr) @@ -131,31 +147,46 @@ func (w *WorkflowServerTransport) dispatchNewListPager(req *http.Request) (*http if err != nil { return nil, err } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + odataOptionsUnescaped, err := url.QueryUnescape(qp.Get("odataOptions")) if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + odataOptionsParam := getOptional(odataOptionsUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) if err != nil { return nil, err } - filterParam := getOptional(filterUnescaped) - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + continuationTokenParam := getOptional(continuationTokenUnescaped) + pageSizeUnescaped, err := url.QueryUnescape(qp.Get("pageSize")) if err != nil { return nil, err } - continuationTokenParam := getOptional(continuationTokenUnescaped) - var options *armrecoveryservicesdatareplication.WorkflowClientListOptions - if filterParam != nil || continuationTokenParam != nil { - options = &armrecoveryservicesdatareplication.WorkflowClientListOptions{ - Filter: filterParam, + pageSizeParam, err := parseOptional(pageSizeUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + var options *armrecoveryservicesdatareplication.JobClientListOptions + if odataOptionsParam != nil || continuationTokenParam != nil || pageSizeParam != nil { + options = &armrecoveryservicesdatareplication.JobClientListOptions{ + OdataOptions: odataOptionsParam, ContinuationToken: continuationTokenParam, + PageSize: pageSizeParam, } } - resp := w.srv.NewListPager(resourceGroupNameParam, vaultNameParam, options) + resp := j.srv.NewListPager(resourceGroupNameParam, vaultNameParam, options) newListPager = &resp - w.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.WorkflowClientListResponse, createLink func() string) { + j.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.JobClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -164,11 +195,17 @@ func (w *WorkflowServerTransport) dispatchNewListPager(req *http.Request) (*http return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - w.newListPager.remove(req) + j.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } if !server.PagerResponderMore(newListPager) { - w.newListPager.remove(req) + j.newListPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to JobServerTransport +var jobServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operationresults_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operationresults_server.go new file mode 100644 index 000000000000..fcc85c2bcea8 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operationresults_server.go @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// OperationResultsServer is a fake server for instances of the armrecoveryservicesdatareplication.OperationResultsClient type. +type OperationResultsServer struct { + // Get is the fake for method OperationResultsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, operationID string, options *armrecoveryservicesdatareplication.OperationResultsClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.OperationResultsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewOperationResultsServerTransport creates a new instance of OperationResultsServerTransport with the provided implementation. +// The returned OperationResultsServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.OperationResultsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationResultsServerTransport(srv *OperationResultsServer) *OperationResultsServerTransport { + return &OperationResultsServerTransport{srv: srv} +} + +// OperationResultsServerTransport connects instances of armrecoveryservicesdatareplication.OperationResultsClient to instances of OperationResultsServer. +// Don't use this type directly, use NewOperationResultsServerTransport instead. +type OperationResultsServerTransport struct { + srv *OperationResultsServer +} + +// Do implements the policy.Transporter interface for OperationResultsServerTransport. +func (o *OperationResultsServerTransport) 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 *OperationResultsServerTransport) 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 operationResultsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationResultsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationResultsClient.Get": + res.resp, res.err = o.dispatchGet(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 *OperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if o.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/{operationId}` + 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 + } + operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.Get(req.Context(), resourceGroupNameParam, operationIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationResultsServerTransport +var operationResultsServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operations_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operations_server.go index 920f9da41db7..bacd7046a40e 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/operations_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 @@ -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) { @@ -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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policy_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policy_server.go index fed6a22b77d5..fe84dcb1ed57 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policy_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policy_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 @@ -26,10 +22,10 @@ import ( type PolicyServer struct { // BeginCreate is the fake for method PolicyClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, policyName string, body armrecoveryservicesdatareplication.PolicyModel, options *armrecoveryservicesdatareplication.PolicyClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PolicyClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, policyName string, resource armrecoveryservicesdatareplication.PolicyModel, options *armrecoveryservicesdatareplication.PolicyClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PolicyClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method PolicyClient.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, vaultName string, policyName string, options *armrecoveryservicesdatareplication.PolicyClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PolicyClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method PolicyClient.Get @@ -70,27 +66,46 @@ func (p *PolicyServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PolicyClient.BeginCreate": - resp, err = p.dispatchBeginCreate(req) - case "PolicyClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "PolicyClient.Get": - resp, err = p.dispatchGet(req) - case "PolicyClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PolicyServerTransport) 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 policyServerTransportInterceptor != nil { + res.resp, res.err, intercepted = policyServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PolicyClient.BeginCreate": + res.resp, res.err = p.dispatchBeginCreate(req) + case "PolicyClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PolicyClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PolicyClient.NewListPager": + res.resp, res.err = p.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 (p *PolicyServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -182,9 +197,9 @@ func (p *PolicyServerTransport) 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) { 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) @@ -270,3 +285,9 @@ func (p *PolicyServerTransport) dispatchNewListPager(req *http.Request) (*http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to PolicyServerTransport +var policyServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policyoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policyoperationstatus_server.go deleted file mode 100644 index 6f4cd781837c..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/policyoperationstatus_server.go +++ /dev/null @@ -1,108 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// PolicyOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.PolicyOperationStatusClient type. -type PolicyOperationStatusServer struct { - // Get is the fake for method PolicyOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, policyName string, operationID string, options *armrecoveryservicesdatareplication.PolicyOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PolicyOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewPolicyOperationStatusServerTransport creates a new instance of PolicyOperationStatusServerTransport with the provided implementation. -// The returned PolicyOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.PolicyOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewPolicyOperationStatusServerTransport(srv *PolicyOperationStatusServer) *PolicyOperationStatusServerTransport { - return &PolicyOperationStatusServerTransport{srv: srv} -} - -// PolicyOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.PolicyOperationStatusClient to instances of PolicyOperationStatusServer. -// Don't use this type directly, use NewPolicyOperationStatusServerTransport instead. -type PolicyOperationStatusServerTransport struct { - srv *PolicyOperationStatusServer -} - -// Do implements the policy.Transporter interface for PolicyOperationStatusServerTransport. -func (p *PolicyOperationStatusServerTransport) 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 "PolicyOperationStatusClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *PolicyOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - policyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("policyName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, policyNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnectionproxies_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnectionproxies_server.go new file mode 100644 index 000000000000..938abb7b5804 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnectionproxies_server.go @@ -0,0 +1,327 @@ +// Copyright (c) Microsoft 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// PrivateEndpointConnectionProxiesServer is a fake server for instances of the armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClient type. +type PrivateEndpointConnectionProxiesServer struct { + // Create is the fake for method PrivateEndpointConnectionProxiesClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, resource armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientCreateOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PrivateEndpointConnectionProxiesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PrivateEndpointConnectionProxiesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method PrivateEndpointConnectionProxiesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse]) + + // Validate is the fake for method PrivateEndpointConnectionProxiesClient.Validate + // HTTP status codes to indicate success: http.StatusOK + Validate func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, body armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientValidateOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientValidateResponse], errResp azfake.ErrorResponder) +} + +// NewPrivateEndpointConnectionProxiesServerTransport creates a new instance of PrivateEndpointConnectionProxiesServerTransport with the provided implementation. +// The returned PrivateEndpointConnectionProxiesServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateEndpointConnectionProxiesServerTransport(srv *PrivateEndpointConnectionProxiesServer) *PrivateEndpointConnectionProxiesServerTransport { + return &PrivateEndpointConnectionProxiesServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse]](), + } +} + +// PrivateEndpointConnectionProxiesServerTransport connects instances of armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClient to instances of PrivateEndpointConnectionProxiesServer. +// Don't use this type directly, use NewPrivateEndpointConnectionProxiesServerTransport instead. +type PrivateEndpointConnectionProxiesServerTransport struct { + srv *PrivateEndpointConnectionProxiesServer + beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse]] +} + +// Do implements the policy.Transporter interface for PrivateEndpointConnectionProxiesServerTransport. +func (p *PrivateEndpointConnectionProxiesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) 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 privateEndpointConnectionProxiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionProxiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionProxiesClient.Create": + res.resp, res.err = p.dispatchCreate(req) + case "PrivateEndpointConnectionProxiesClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionProxiesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionProxiesClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "PrivateEndpointConnectionProxiesClient.Validate": + res.resp, res.err = p.dispatchValidate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if p.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies/(?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[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionProxyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Create(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionProxyNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnectionProxy, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies/(?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 + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionProxyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionProxyNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.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) { + p.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) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies/(?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 + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionProxyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionProxyNameParam, 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).PrivateEndpointConnectionProxy, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies` + 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 + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} + +func (p *PrivateEndpointConnectionProxiesServerTransport) dispatchValidate(req *http.Request) (*http.Response, error) { + if p.srv.Validate == nil { + return nil, &nonRetriableError{errors.New("fake for method Validate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnectionProxies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validate` + 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[armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionProxyNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionProxyName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Validate(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionProxyNameParam, 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).PrivateEndpointConnectionProxy, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionProxiesServerTransport +var privateEndpointConnectionProxiesServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnections_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnections_server.go new file mode 100644 index 000000000000..92d6b67ab05d --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privateendpointconnections_server.go @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// PrivateEndpointConnectionsServer is a fake server for instances of the armrecoveryservicesdatareplication.PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsServer struct { + // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PrivateEndpointConnectionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method PrivateEndpointConnectionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse]) + + // Update is the fake for method PrivateEndpointConnectionsClient.Update + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Update func(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, resource armrecoveryservicesdatareplication.PrivateEndpointConnection, options *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientUpdateOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. +// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.PrivateEndpointConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport { + return &PrivateEndpointConnectionsServerTransport{ + srv: srv, + beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse]](), + } +} + +// PrivateEndpointConnectionsServerTransport connects instances of armrecoveryservicesdatareplication.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer. +// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead. +type PrivateEndpointConnectionsServerTransport struct { + srv *PrivateEndpointConnectionsServer + beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse]] +} + +// Do implements the policy.Transporter interface for PrivateEndpointConnectionsServerTransport. +func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *PrivateEndpointConnectionsServerTransport) 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 privateEndpointConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "PrivateEndpointConnectionsClient.Update": + res.resp, res.err = p.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.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) { + p.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) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if p.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armrecoveryservicesdatareplication.PrivateEndpointConnection](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameParam, vaultNameParam, privateEndpointConnectionNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privatelinkresources_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privatelinkresources_server.go new file mode 100644 index 000000000000..c7a1da66500b --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/privatelinkresources_server.go @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "net/http" + "net/url" + "regexp" +) + +// PrivateLinkResourcesServer is a fake server for instances of the armrecoveryservicesdatareplication.PrivateLinkResourcesClient type. +type PrivateLinkResourcesServer struct { + // Get is the fake for method PrivateLinkResourcesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, vaultName string, privateLinkResourceName string, options *armrecoveryservicesdatareplication.PrivateLinkResourcesClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.PrivateLinkResourcesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method PrivateLinkResourcesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, vaultName string, options *armrecoveryservicesdatareplication.PrivateLinkResourcesClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse]) +} + +// NewPrivateLinkResourcesServerTransport creates a new instance of PrivateLinkResourcesServerTransport with the provided implementation. +// The returned PrivateLinkResourcesServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.PrivateLinkResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateLinkResourcesServerTransport(srv *PrivateLinkResourcesServer) *PrivateLinkResourcesServerTransport { + return &PrivateLinkResourcesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse]](), + } +} + +// PrivateLinkResourcesServerTransport connects instances of armrecoveryservicesdatareplication.PrivateLinkResourcesClient to instances of PrivateLinkResourcesServer. +// Don't use this type directly, use NewPrivateLinkResourcesServerTransport instead. +type PrivateLinkResourcesServerTransport struct { + srv *PrivateLinkResourcesServer + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse]] +} + +// Do implements the policy.Transporter interface for PrivateLinkResourcesServerTransport. +func (p *PrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *PrivateLinkResourcesServerTransport) 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 privateLinkResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinkResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinkResourcesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateLinkResourcesClient.NewListPager": + res.resp, res.err = p.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 (p *PrivateLinkResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + privateLinkResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, privateLinkResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateLinkResourcesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to PrivateLinkResourcesServerTransport +var privateLinkResourcesServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditem_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditem_server.go index b68a8e66bd14..a315d946f561 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditem_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditem_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 @@ -19,7 +15,6 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" "net/http" "net/url" - "reflect" "regexp" "strconv" ) @@ -28,10 +23,10 @@ import ( type ProtectedItemServer struct { // BeginCreate is the fake for method ProtectedItemClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body armrecoveryservicesdatareplication.ProtectedItemModel, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, resource armrecoveryservicesdatareplication.ProtectedItemModel, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ProtectedItemClient.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, vaultName string, protectedItemName string, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method ProtectedItemClient.Get @@ -44,7 +39,11 @@ type ProtectedItemServer struct { // BeginPlannedFailover is the fake for method ProtectedItemClient.BeginPlannedFailover // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginPlannedFailover func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse], errResp azfake.ErrorResponder) + BeginPlannedFailover func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body armrecoveryservicesdatareplication.PlannedFailoverModel, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method ProtectedItemClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, properties armrecoveryservicesdatareplication.ProtectedItemModelUpdate, options *armrecoveryservicesdatareplication.ProtectedItemClientBeginUpdateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientUpdateResponse], errResp azfake.ErrorResponder) } // NewProtectedItemServerTransport creates a new instance of ProtectedItemServerTransport with the provided implementation. @@ -57,6 +56,7 @@ func NewProtectedItemServerTransport(srv *ProtectedItemServer) *ProtectedItemSer beginDelete: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientDeleteResponse]](), newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.ProtectedItemClientListResponse]](), beginPlannedFailover: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientUpdateResponse]](), } } @@ -68,6 +68,7 @@ type ProtectedItemServerTransport struct { beginDelete *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientDeleteResponse]] newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.ProtectedItemClientListResponse]] beginPlannedFailover *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse]] + beginUpdate *tracker[azfake.PollerResponder[armrecoveryservicesdatareplication.ProtectedItemClientUpdateResponse]] } // Do implements the policy.Transporter interface for ProtectedItemServerTransport. @@ -78,29 +79,50 @@ func (p *ProtectedItemServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "ProtectedItemClient.BeginCreate": - resp, err = p.dispatchBeginCreate(req) - case "ProtectedItemClient.BeginDelete": - resp, err = p.dispatchBeginDelete(req) - case "ProtectedItemClient.Get": - resp, err = p.dispatchGet(req) - case "ProtectedItemClient.NewListPager": - resp, err = p.dispatchNewListPager(req) - case "ProtectedItemClient.BeginPlannedFailover": - resp, err = p.dispatchBeginPlannedFailover(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *ProtectedItemServerTransport) 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 protectedItemServerTransportInterceptor != nil { + res.resp, res.err, intercepted = protectedItemServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ProtectedItemClient.BeginCreate": + res.resp, res.err = p.dispatchBeginCreate(req) + case "ProtectedItemClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "ProtectedItemClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "ProtectedItemClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "ProtectedItemClient.BeginPlannedFailover": + res.resp, res.err = p.dispatchBeginPlannedFailover(req) + case "ProtectedItemClient.BeginUpdate": + res.resp, res.err = p.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *ProtectedItemServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -172,19 +194,19 @@ func (p *ProtectedItemServerTransport) dispatchBeginDelete(req *http.Request) (* if err != nil { return nil, err } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + forceDeleteUnescaped, err := url.QueryUnescape(qp.Get("forceDelete")) if err != nil { return nil, err } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) + forceDeleteParam, err := parseOptional(forceDeleteUnescaped, strconv.ParseBool) if err != nil { return nil, err } - forceDeleteUnescaped, err := url.QueryUnescape(qp.Get("forceDelete")) + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) if err != nil { return nil, err } - forceDeleteParam, err := parseOptional(forceDeleteUnescaped, strconv.ParseBool) + protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) if err != nil { return nil, err } @@ -207,9 +229,9 @@ func (p *ProtectedItemServerTransport) 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) { 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) @@ -267,15 +289,48 @@ func (p *ProtectedItemServerTransport) dispatchNewListPager(req *http.Request) ( if matches == nil || len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } + qp := req.URL.Query() resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) if err != nil { return nil, err } + odataOptionsUnescaped, err := url.QueryUnescape(qp.Get("odataOptions")) + if err != nil { + return nil, err + } + odataOptionsParam := getOptional(odataOptionsUnescaped) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + if err != nil { + return nil, err + } + continuationTokenParam := getOptional(continuationTokenUnescaped) + pageSizeUnescaped, err := url.QueryUnescape(qp.Get("pageSize")) + if err != nil { + return nil, err + } + pageSizeParam, err := parseOptional(pageSizeUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) if err != nil { return nil, err } - resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, nil) + var options *armrecoveryservicesdatareplication.ProtectedItemClientListOptions + if odataOptionsParam != nil || continuationTokenParam != nil || pageSizeParam != nil { + options = &armrecoveryservicesdatareplication.ProtectedItemClientListOptions{ + OdataOptions: odataOptionsParam, + ContinuationToken: continuationTokenParam, + PageSize: pageSizeParam, + } + } + resp := p.srv.NewListPager(resourceGroupNameParam, vaultNameParam, options) newListPager = &resp p.newListPager.add(req, newListPager) server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.ProtectedItemClientListResponse, createLink func() string) { @@ -324,13 +379,7 @@ func (p *ProtectedItemServerTransport) dispatchBeginPlannedFailover(req *http.Re if err != nil { return nil, err } - var options *armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions - if !reflect.ValueOf(body).IsZero() { - options = &armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions{ - Body: &body, - } - } - respr, errRespr := p.srv.BeginPlannedFailover(req.Context(), resourceGroupNameParam, vaultNameParam, protectedItemNameParam, options) + respr, errRespr := p.srv.BeginPlannedFailover(req.Context(), resourceGroupNameParam, vaultNameParam, protectedItemNameParam, body, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -353,3 +402,61 @@ func (p *ProtectedItemServerTransport) dispatchBeginPlannedFailover(req *http.Re return resp, nil } + +func (p *ProtectedItemServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := p.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?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[armrecoveryservicesdatareplication.ProtectedItemModelUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) + if err != nil { + return nil, err + } + protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, vaultNameParam, protectedItemNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + p.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) { + p.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) { + p.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to ProtectedItemServerTransport +var protectedItemServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditemoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditemoperationstatus_server.go deleted file mode 100644 index 3065e3dcc190..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/protecteditemoperationstatus_server.go +++ /dev/null @@ -1,108 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// ProtectedItemOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.ProtectedItemOperationStatusClient type. -type ProtectedItemOperationStatusServer struct { - // Get is the fake for method ProtectedItemOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, operationID string, options *armrecoveryservicesdatareplication.ProtectedItemOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.ProtectedItemOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewProtectedItemOperationStatusServerTransport creates a new instance of ProtectedItemOperationStatusServerTransport with the provided implementation. -// The returned ProtectedItemOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.ProtectedItemOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewProtectedItemOperationStatusServerTransport(srv *ProtectedItemOperationStatusServer) *ProtectedItemOperationStatusServerTransport { - return &ProtectedItemOperationStatusServerTransport{srv: srv} -} - -// ProtectedItemOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.ProtectedItemOperationStatusClient to instances of ProtectedItemOperationStatusServer. -// Don't use this type directly, use NewProtectedItemOperationStatusServerTransport instead. -type ProtectedItemOperationStatusServerTransport struct { - srv *ProtectedItemOperationStatusServer -} - -// Do implements the policy.Transporter interface for ProtectedItemOperationStatusServerTransport. -func (p *ProtectedItemOperationStatusServerTransport) 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 "ProtectedItemOperationStatusClient.Get": - resp, err = p.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (p *ProtectedItemOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if p.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/protectedItems/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - protectedItemNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("protectedItemName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, protectedItemNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoints_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoint_server.go similarity index 62% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoints_server.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoint_server.go index ec18f4d60e6d..200ab0f762f1 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoints_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/recoverypoint_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 @@ -22,62 +18,81 @@ import ( "regexp" ) -// RecoveryPointsServer is a fake server for instances of the armrecoveryservicesdatareplication.RecoveryPointsClient type. -type RecoveryPointsServer struct { - // Get is the fake for method RecoveryPointsClient.Get +// RecoveryPointServer is a fake server for instances of the armrecoveryservicesdatareplication.RecoveryPointClient type. +type RecoveryPointServer struct { + // Get is the fake for method RecoveryPointClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *armrecoveryservicesdatareplication.RecoveryPointsClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.RecoveryPointsClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *armrecoveryservicesdatareplication.RecoveryPointClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.RecoveryPointClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method RecoveryPointsClient.NewListPager + // NewListPager is the fake for method RecoveryPointClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(resourceGroupName string, vaultName string, protectedItemName string, options *armrecoveryservicesdatareplication.RecoveryPointsClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointsClientListResponse]) + NewListPager func(resourceGroupName string, vaultName string, protectedItemName string, options *armrecoveryservicesdatareplication.RecoveryPointClientListOptions) (resp azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointClientListResponse]) } -// NewRecoveryPointsServerTransport creates a new instance of RecoveryPointsServerTransport with the provided implementation. -// The returned RecoveryPointsServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.RecoveryPointsClient via the +// NewRecoveryPointServerTransport creates a new instance of RecoveryPointServerTransport with the provided implementation. +// The returned RecoveryPointServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.RecoveryPointClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewRecoveryPointsServerTransport(srv *RecoveryPointsServer) *RecoveryPointsServerTransport { - return &RecoveryPointsServerTransport{ +func NewRecoveryPointServerTransport(srv *RecoveryPointServer) *RecoveryPointServerTransport { + return &RecoveryPointServerTransport{ srv: srv, - newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointsClientListResponse]](), + newListPager: newTracker[azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointClientListResponse]](), } } -// RecoveryPointsServerTransport connects instances of armrecoveryservicesdatareplication.RecoveryPointsClient to instances of RecoveryPointsServer. -// Don't use this type directly, use NewRecoveryPointsServerTransport instead. -type RecoveryPointsServerTransport struct { - srv *RecoveryPointsServer - newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointsClientListResponse]] +// RecoveryPointServerTransport connects instances of armrecoveryservicesdatareplication.RecoveryPointClient to instances of RecoveryPointServer. +// Don't use this type directly, use NewRecoveryPointServerTransport instead. +type RecoveryPointServerTransport struct { + srv *RecoveryPointServer + newListPager *tracker[azfake.PagerResponder[armrecoveryservicesdatareplication.RecoveryPointClientListResponse]] } -// Do implements the policy.Transporter interface for RecoveryPointsServerTransport. -func (r *RecoveryPointsServerTransport) Do(req *http.Request) (*http.Response, error) { +// Do implements the policy.Transporter interface for RecoveryPointServerTransport. +func (r *RecoveryPointServerTransport) 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 + return r.dispatchToMethodFake(req, method) +} - switch method { - case "RecoveryPointsClient.Get": - resp, err = r.dispatchGet(req) - case "RecoveryPointsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *RecoveryPointServerTransport) 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 recoveryPointServerTransportInterceptor != nil { + res.resp, res.err, intercepted = recoveryPointServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RecoveryPointClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RecoveryPointClient.NewListPager": + res.resp, res.err = r.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 (r *RecoveryPointsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { +func (r *RecoveryPointServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if r.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } @@ -118,7 +133,7 @@ func (r *RecoveryPointsServerTransport) dispatchGet(req *http.Request) (*http.Re return resp, nil } -func (r *RecoveryPointsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { +func (r *RecoveryPointServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if r.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} } @@ -145,7 +160,7 @@ func (r *RecoveryPointsServerTransport) dispatchNewListPager(req *http.Request) resp := r.srv.NewListPager(resourceGroupNameParam, vaultNameParam, protectedItemNameParam, nil) newListPager = &resp r.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.RecoveryPointsClientListResponse, createLink func() string) { + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armrecoveryservicesdatareplication.RecoveryPointClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } @@ -162,3 +177,9 @@ func (r *RecoveryPointsServerTransport) dispatchNewListPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to RecoveryPointServerTransport +var recoveryPointServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextension_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextension_server.go index ef034f78cc16..cd2713140f7a 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextension_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextension_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 @@ -26,10 +22,10 @@ import ( type ReplicationExtensionServer struct { // BeginCreate is the fake for method ReplicationExtensionClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, body armrecoveryservicesdatareplication.ReplicationExtensionModel, options *armrecoveryservicesdatareplication.ReplicationExtensionClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ReplicationExtensionClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, resource armrecoveryservicesdatareplication.ReplicationExtensionModel, options *armrecoveryservicesdatareplication.ReplicationExtensionClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ReplicationExtensionClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ReplicationExtensionClient.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, vaultName string, replicationExtensionName string, options *armrecoveryservicesdatareplication.ReplicationExtensionClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.ReplicationExtensionClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method ReplicationExtensionClient.Get @@ -70,27 +66,46 @@ func (r *ReplicationExtensionServerTransport) 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 + return r.dispatchToMethodFake(req, method) +} - switch method { - case "ReplicationExtensionClient.BeginCreate": - resp, err = r.dispatchBeginCreate(req) - case "ReplicationExtensionClient.BeginDelete": - resp, err = r.dispatchBeginDelete(req) - case "ReplicationExtensionClient.Get": - resp, err = r.dispatchGet(req) - case "ReplicationExtensionClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *ReplicationExtensionServerTransport) 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 replicationExtensionServerTransportInterceptor != nil { + res.resp, res.err, intercepted = replicationExtensionServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ReplicationExtensionClient.BeginCreate": + res.resp, res.err = r.dispatchBeginCreate(req) + case "ReplicationExtensionClient.BeginDelete": + res.resp, res.err = r.dispatchBeginDelete(req) + case "ReplicationExtensionClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "ReplicationExtensionClient.NewListPager": + res.resp, res.err = r.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 (r *ReplicationExtensionServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -182,9 +197,9 @@ func (r *ReplicationExtensionServerTransport) 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) { r.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) { r.beginDelete.remove(req) @@ -270,3 +285,9 @@ func (r *ReplicationExtensionServerTransport) dispatchNewListPager(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to ReplicationExtensionServerTransport +var replicationExtensionServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextensionoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextensionoperationstatus_server.go deleted file mode 100644 index 7c20722dafe9..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/replicationextensionoperationstatus_server.go +++ /dev/null @@ -1,108 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// ReplicationExtensionOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClient type. -type ReplicationExtensionOperationStatusServer struct { - // Get is the fake for method ReplicationExtensionOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, operationID string, options *armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewReplicationExtensionOperationStatusServerTransport creates a new instance of ReplicationExtensionOperationStatusServerTransport with the provided implementation. -// The returned ReplicationExtensionOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewReplicationExtensionOperationStatusServerTransport(srv *ReplicationExtensionOperationStatusServer) *ReplicationExtensionOperationStatusServerTransport { - return &ReplicationExtensionOperationStatusServerTransport{srv: srv} -} - -// ReplicationExtensionOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.ReplicationExtensionOperationStatusClient to instances of ReplicationExtensionOperationStatusServer. -// Don't use this type directly, use NewReplicationExtensionOperationStatusServerTransport instead. -type ReplicationExtensionOperationStatusServerTransport struct { - srv *ReplicationExtensionOperationStatusServer -} - -// Do implements the policy.Transporter interface for ReplicationExtensionOperationStatusServerTransport. -func (r *ReplicationExtensionOperationStatusServerTransport) 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 "ReplicationExtensionOperationStatusClient.Get": - resp, err = r.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (r *ReplicationExtensionOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if r.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicationExtensions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - replicationExtensionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("replicationExtensionName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := r.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, replicationExtensionNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/server_factory.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/server_factory.go index 0f5380690e21..18595b10999a 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/server_factory.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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,25 +15,56 @@ import ( // ServerFactory is a fake server for instances of the armrecoveryservicesdatareplication.ClientFactory type. type ServerFactory struct { - AzureSiteRecoveryManagementServiceAPIServer AzureSiteRecoveryManagementServiceAPIServer - DraServer DraServer - DraOperationStatusServer DraOperationStatusServer - EmailConfigurationServer EmailConfigurationServer - EventServer EventServer - FabricServer FabricServer - FabricOperationsStatusServer FabricOperationsStatusServer - OperationsServer OperationsServer - PolicyServer PolicyServer - PolicyOperationStatusServer PolicyOperationStatusServer - ProtectedItemServer ProtectedItemServer - ProtectedItemOperationStatusServer ProtectedItemOperationStatusServer - RecoveryPointsServer RecoveryPointsServer - ReplicationExtensionServer ReplicationExtensionServer - ReplicationExtensionOperationStatusServer ReplicationExtensionOperationStatusServer - VaultServer VaultServer - VaultOperationStatusServer VaultOperationStatusServer - WorkflowServer WorkflowServer - WorkflowOperationStatusServer WorkflowOperationStatusServer + // CheckNameAvailabilityServer contains the fakes for client CheckNameAvailabilityClient + CheckNameAvailabilityServer CheckNameAvailabilityServer + + // DeploymentPreflightServer contains the fakes for client DeploymentPreflightClient + DeploymentPreflightServer DeploymentPreflightServer + + // EmailConfigurationServer contains the fakes for client EmailConfigurationClient + EmailConfigurationServer EmailConfigurationServer + + // EventServer contains the fakes for client EventClient + EventServer EventServer + + // FabricAgentServer contains the fakes for client FabricAgentClient + FabricAgentServer FabricAgentServer + + // FabricServer contains the fakes for client FabricClient + FabricServer FabricServer + + // JobServer contains the fakes for client JobClient + JobServer JobServer + + // OperationResultsServer contains the fakes for client OperationResultsClient + OperationResultsServer OperationResultsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // PolicyServer contains the fakes for client PolicyClient + PolicyServer PolicyServer + + // PrivateEndpointConnectionProxiesServer contains the fakes for client PrivateEndpointConnectionProxiesClient + PrivateEndpointConnectionProxiesServer PrivateEndpointConnectionProxiesServer + + // PrivateEndpointConnectionsServer contains the fakes for client PrivateEndpointConnectionsClient + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer + + // PrivateLinkResourcesServer contains the fakes for client PrivateLinkResourcesClient + PrivateLinkResourcesServer PrivateLinkResourcesServer + + // ProtectedItemServer contains the fakes for client ProtectedItemClient + ProtectedItemServer ProtectedItemServer + + // RecoveryPointServer contains the fakes for client RecoveryPointClient + RecoveryPointServer RecoveryPointServer + + // ReplicationExtensionServer contains the fakes for client ReplicationExtensionClient + ReplicationExtensionServer ReplicationExtensionServer + + // VaultServer contains the fakes for client VaultClient + VaultServer VaultServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -52,27 +79,25 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armrecoveryservicesdatareplication.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trAzureSiteRecoveryManagementServiceAPIServer *AzureSiteRecoveryManagementServiceAPIServerTransport - trDraServer *DraServerTransport - trDraOperationStatusServer *DraOperationStatusServerTransport - trEmailConfigurationServer *EmailConfigurationServerTransport - trEventServer *EventServerTransport - trFabricServer *FabricServerTransport - trFabricOperationsStatusServer *FabricOperationsStatusServerTransport - trOperationsServer *OperationsServerTransport - trPolicyServer *PolicyServerTransport - trPolicyOperationStatusServer *PolicyOperationStatusServerTransport - trProtectedItemServer *ProtectedItemServerTransport - trProtectedItemOperationStatusServer *ProtectedItemOperationStatusServerTransport - trRecoveryPointsServer *RecoveryPointsServerTransport - trReplicationExtensionServer *ReplicationExtensionServerTransport - trReplicationExtensionOperationStatusServer *ReplicationExtensionOperationStatusServerTransport - trVaultServer *VaultServerTransport - trVaultOperationStatusServer *VaultOperationStatusServerTransport - trWorkflowServer *WorkflowServerTransport - trWorkflowOperationStatusServer *WorkflowOperationStatusServerTransport + srv *ServerFactory + trMu sync.Mutex + trCheckNameAvailabilityServer *CheckNameAvailabilityServerTransport + trDeploymentPreflightServer *DeploymentPreflightServerTransport + trEmailConfigurationServer *EmailConfigurationServerTransport + trEventServer *EventServerTransport + trFabricAgentServer *FabricAgentServerTransport + trFabricServer *FabricServerTransport + trJobServer *JobServerTransport + trOperationResultsServer *OperationResultsServerTransport + trOperationsServer *OperationsServerTransport + trPolicyServer *PolicyServerTransport + trPrivateEndpointConnectionProxiesServer *PrivateEndpointConnectionProxiesServerTransport + trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport + trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + trProtectedItemServer *ProtectedItemServerTransport + trRecoveryPointServer *RecoveryPointServerTransport + trReplicationExtensionServer *ReplicationExtensionServerTransport + trVaultServer *VaultServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -88,19 +113,16 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { var err error switch client { - case "AzureSiteRecoveryManagementServiceAPIClient": - initServer(s, &s.trAzureSiteRecoveryManagementServiceAPIServer, func() *AzureSiteRecoveryManagementServiceAPIServerTransport { - return NewAzureSiteRecoveryManagementServiceAPIServerTransport(&s.srv.AzureSiteRecoveryManagementServiceAPIServer) + case "CheckNameAvailabilityClient": + initServer(s, &s.trCheckNameAvailabilityServer, func() *CheckNameAvailabilityServerTransport { + return NewCheckNameAvailabilityServerTransport(&s.srv.CheckNameAvailabilityServer) }) - resp, err = s.trAzureSiteRecoveryManagementServiceAPIServer.Do(req) - case "DraClient": - initServer(s, &s.trDraServer, func() *DraServerTransport { return NewDraServerTransport(&s.srv.DraServer) }) - resp, err = s.trDraServer.Do(req) - case "DraOperationStatusClient": - initServer(s, &s.trDraOperationStatusServer, func() *DraOperationStatusServerTransport { - return NewDraOperationStatusServerTransport(&s.srv.DraOperationStatusServer) + resp, err = s.trCheckNameAvailabilityServer.Do(req) + case "DeploymentPreflightClient": + initServer(s, &s.trDeploymentPreflightServer, func() *DeploymentPreflightServerTransport { + return NewDeploymentPreflightServerTransport(&s.srv.DeploymentPreflightServer) }) - resp, err = s.trDraOperationStatusServer.Do(req) + resp, err = s.trDeploymentPreflightServer.Do(req) case "EmailConfigurationClient": initServer(s, &s.trEmailConfigurationServer, func() *EmailConfigurationServerTransport { return NewEmailConfigurationServerTransport(&s.srv.EmailConfigurationServer) @@ -109,66 +131,59 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "EventClient": initServer(s, &s.trEventServer, func() *EventServerTransport { return NewEventServerTransport(&s.srv.EventServer) }) resp, err = s.trEventServer.Do(req) + case "FabricAgentClient": + initServer(s, &s.trFabricAgentServer, func() *FabricAgentServerTransport { return NewFabricAgentServerTransport(&s.srv.FabricAgentServer) }) + resp, err = s.trFabricAgentServer.Do(req) case "FabricClient": initServer(s, &s.trFabricServer, func() *FabricServerTransport { return NewFabricServerTransport(&s.srv.FabricServer) }) resp, err = s.trFabricServer.Do(req) - case "FabricOperationsStatusClient": - initServer(s, &s.trFabricOperationsStatusServer, func() *FabricOperationsStatusServerTransport { - return NewFabricOperationsStatusServerTransport(&s.srv.FabricOperationsStatusServer) + case "JobClient": + initServer(s, &s.trJobServer, func() *JobServerTransport { return NewJobServerTransport(&s.srv.JobServer) }) + resp, err = s.trJobServer.Do(req) + case "OperationResultsClient": + initServer(s, &s.trOperationResultsServer, func() *OperationResultsServerTransport { + return NewOperationResultsServerTransport(&s.srv.OperationResultsServer) }) - resp, err = s.trFabricOperationsStatusServer.Do(req) + resp, err = s.trOperationResultsServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) case "PolicyClient": initServer(s, &s.trPolicyServer, func() *PolicyServerTransport { return NewPolicyServerTransport(&s.srv.PolicyServer) }) resp, err = s.trPolicyServer.Do(req) - case "PolicyOperationStatusClient": - initServer(s, &s.trPolicyOperationStatusServer, func() *PolicyOperationStatusServerTransport { - return NewPolicyOperationStatusServerTransport(&s.srv.PolicyOperationStatusServer) + case "PrivateEndpointConnectionProxiesClient": + initServer(s, &s.trPrivateEndpointConnectionProxiesServer, func() *PrivateEndpointConnectionProxiesServerTransport { + return NewPrivateEndpointConnectionProxiesServerTransport(&s.srv.PrivateEndpointConnectionProxiesServer) + }) + resp, err = s.trPrivateEndpointConnectionProxiesServer.Do(req) + case "PrivateEndpointConnectionsClient": + initServer(s, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { + return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) }) - resp, err = s.trPolicyOperationStatusServer.Do(req) + resp, err = s.trPrivateEndpointConnectionsServer.Do(req) + case "PrivateLinkResourcesClient": + initServer(s, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { + return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) + }) + resp, err = s.trPrivateLinkResourcesServer.Do(req) case "ProtectedItemClient": initServer(s, &s.trProtectedItemServer, func() *ProtectedItemServerTransport { return NewProtectedItemServerTransport(&s.srv.ProtectedItemServer) }) resp, err = s.trProtectedItemServer.Do(req) - case "ProtectedItemOperationStatusClient": - initServer(s, &s.trProtectedItemOperationStatusServer, func() *ProtectedItemOperationStatusServerTransport { - return NewProtectedItemOperationStatusServerTransport(&s.srv.ProtectedItemOperationStatusServer) - }) - resp, err = s.trProtectedItemOperationStatusServer.Do(req) - case "RecoveryPointsClient": - initServer(s, &s.trRecoveryPointsServer, func() *RecoveryPointsServerTransport { - return NewRecoveryPointsServerTransport(&s.srv.RecoveryPointsServer) + case "RecoveryPointClient": + initServer(s, &s.trRecoveryPointServer, func() *RecoveryPointServerTransport { + return NewRecoveryPointServerTransport(&s.srv.RecoveryPointServer) }) - resp, err = s.trRecoveryPointsServer.Do(req) + resp, err = s.trRecoveryPointServer.Do(req) case "ReplicationExtensionClient": initServer(s, &s.trReplicationExtensionServer, func() *ReplicationExtensionServerTransport { return NewReplicationExtensionServerTransport(&s.srv.ReplicationExtensionServer) }) resp, err = s.trReplicationExtensionServer.Do(req) - case "ReplicationExtensionOperationStatusClient": - initServer(s, &s.trReplicationExtensionOperationStatusServer, func() *ReplicationExtensionOperationStatusServerTransport { - return NewReplicationExtensionOperationStatusServerTransport(&s.srv.ReplicationExtensionOperationStatusServer) - }) - resp, err = s.trReplicationExtensionOperationStatusServer.Do(req) case "VaultClient": initServer(s, &s.trVaultServer, func() *VaultServerTransport { return NewVaultServerTransport(&s.srv.VaultServer) }) resp, err = s.trVaultServer.Do(req) - case "VaultOperationStatusClient": - initServer(s, &s.trVaultOperationStatusServer, func() *VaultOperationStatusServerTransport { - return NewVaultOperationStatusServerTransport(&s.srv.VaultOperationStatusServer) - }) - resp, err = s.trVaultOperationStatusServer.Do(req) - case "WorkflowClient": - initServer(s, &s.trWorkflowServer, func() *WorkflowServerTransport { return NewWorkflowServerTransport(&s.srv.WorkflowServer) }) - resp, err = s.trWorkflowServer.Do(req) - case "WorkflowOperationStatusClient": - initServer(s, &s.trWorkflowOperationStatusServer, func() *WorkflowOperationStatusServerTransport { - return NewWorkflowOperationStatusServerTransport(&s.srv.WorkflowOperationStatusServer) - }) - resp, err = s.trWorkflowOperationStatusServer.Do(req) default: err = fmt.Errorf("unhandled client %s", client) } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/time_rfc3339.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/time_rfc3339.go index b0535a7b63e6..87ee11e83b32 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/time_rfc3339.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/time_rfc3339.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -19,12 +15,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +40,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +80,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +97,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vault_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vault_server.go index 632d5724589f..1fd2342e776a 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vault_server.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vault_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 @@ -26,10 +22,10 @@ import ( type VaultServer struct { // BeginCreate is the fake for method VaultClient.BeginCreate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, body armrecoveryservicesdatareplication.VaultModel, options *armrecoveryservicesdatareplication.VaultClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.VaultClientCreateResponse], errResp azfake.ErrorResponder) + BeginCreate func(ctx context.Context, resourceGroupName string, vaultName string, resource armrecoveryservicesdatareplication.VaultModel, options *armrecoveryservicesdatareplication.VaultClientBeginCreateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.VaultClientCreateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method VaultClient.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, vaultName string, options *armrecoveryservicesdatareplication.VaultClientBeginDeleteOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.VaultClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method VaultClient.Get @@ -46,7 +42,7 @@ type VaultServer struct { // BeginUpdate is the fake for method VaultClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, vaultName string, body armrecoveryservicesdatareplication.VaultModelUpdate, options *armrecoveryservicesdatareplication.VaultClientBeginUpdateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.VaultClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, vaultName string, properties armrecoveryservicesdatareplication.VaultModelUpdate, options *armrecoveryservicesdatareplication.VaultClientBeginUpdateOptions) (resp azfake.PollerResponder[armrecoveryservicesdatareplication.VaultClientUpdateResponse], errResp azfake.ErrorResponder) } // NewVaultServerTransport creates a new instance of VaultServerTransport with the provided implementation. @@ -82,31 +78,50 @@ func (v *VaultServerTransport) 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 v.dispatchToMethodFake(req, method) +} - switch method { - case "VaultClient.BeginCreate": - resp, err = v.dispatchBeginCreate(req) - case "VaultClient.BeginDelete": - resp, err = v.dispatchBeginDelete(req) - case "VaultClient.Get": - resp, err = v.dispatchGet(req) - case "VaultClient.NewListPager": - resp, err = v.dispatchNewListPager(req) - case "VaultClient.NewListBySubscriptionPager": - resp, err = v.dispatchNewListBySubscriptionPager(req) - case "VaultClient.BeginUpdate": - resp, err = v.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (v *VaultServerTransport) 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 vaultServerTransportInterceptor != nil { + res.resp, res.err, intercepted = vaultServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "VaultClient.BeginCreate": + res.resp, res.err = v.dispatchBeginCreate(req) + case "VaultClient.BeginDelete": + res.resp, res.err = v.dispatchBeginDelete(req) + case "VaultClient.Get": + res.resp, res.err = v.dispatchGet(req) + case "VaultClient.NewListPager": + res.resp, res.err = v.dispatchNewListPager(req) + case "VaultClient.NewListBySubscriptionPager": + res.resp, res.err = v.dispatchNewListBySubscriptionPager(req) + case "VaultClient.BeginUpdate": + res.resp, res.err = v.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (v *VaultServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { @@ -190,9 +205,9 @@ func (v *VaultServerTransport) dispatchBeginDelete(req *http.Request) (*http.Res return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { v.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) { v.beginDelete.remove(req) @@ -295,19 +310,7 @@ func (v *VaultServerTransport) dispatchNewListBySubscriptionPager(req *http.Requ if matches == nil || len(matches) < 1 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - qp := req.URL.Query() - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) - if err != nil { - return nil, err - } - continuationTokenParam := getOptional(continuationTokenUnescaped) - var options *armrecoveryservicesdatareplication.VaultClientListBySubscriptionOptions - if continuationTokenParam != nil { - options = &armrecoveryservicesdatareplication.VaultClientListBySubscriptionOptions{ - ContinuationToken: continuationTokenParam, - } - } - resp := v.srv.NewListBySubscriptionPager(options) + resp := v.srv.NewListBySubscriptionPager(nil) newListBySubscriptionPager = &resp v.newListBySubscriptionPager.add(req, newListBySubscriptionPager) server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armrecoveryservicesdatareplication.VaultClientListBySubscriptionResponse, createLink func() string) { @@ -375,3 +378,9 @@ func (v *VaultServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Res return resp, nil } + +// set this to conditionally intercept incoming requests to VaultServerTransport +var vaultServerTransportInterceptor 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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vaultoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vaultoperationstatus_server.go deleted file mode 100644 index 510518d046ea..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/vaultoperationstatus_server.go +++ /dev/null @@ -1,104 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// VaultOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.VaultOperationStatusClient type. -type VaultOperationStatusServer struct { - // Get is the fake for method VaultOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *armrecoveryservicesdatareplication.VaultOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.VaultOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewVaultOperationStatusServerTransport creates a new instance of VaultOperationStatusServerTransport with the provided implementation. -// The returned VaultOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.VaultOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewVaultOperationStatusServerTransport(srv *VaultOperationStatusServer) *VaultOperationStatusServerTransport { - return &VaultOperationStatusServerTransport{srv: srv} -} - -// VaultOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.VaultOperationStatusClient to instances of VaultOperationStatusServer. -// Don't use this type directly, use NewVaultOperationStatusServerTransport instead. -type VaultOperationStatusServerTransport struct { - srv *VaultOperationStatusServer -} - -// Do implements the policy.Transporter interface for VaultOperationStatusServerTransport. -func (v *VaultOperationStatusServerTransport) 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 "VaultOperationStatusClient.Get": - resp, err = v.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (v *VaultOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if v.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?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 - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := v.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflowoperationstatus_server.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflowoperationstatus_server.go deleted file mode 100644 index f5a3d46502dd..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/fake/workflowoperationstatus_server.go +++ /dev/null @@ -1,108 +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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" - "net/http" - "net/url" - "regexp" -) - -// WorkflowOperationStatusServer is a fake server for instances of the armrecoveryservicesdatareplication.WorkflowOperationStatusClient type. -type WorkflowOperationStatusServer struct { - // Get is the fake for method WorkflowOperationStatusClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, vaultName string, jobName string, operationID string, options *armrecoveryservicesdatareplication.WorkflowOperationStatusClientGetOptions) (resp azfake.Responder[armrecoveryservicesdatareplication.WorkflowOperationStatusClientGetResponse], errResp azfake.ErrorResponder) -} - -// NewWorkflowOperationStatusServerTransport creates a new instance of WorkflowOperationStatusServerTransport with the provided implementation. -// The returned WorkflowOperationStatusServerTransport instance is connected to an instance of armrecoveryservicesdatareplication.WorkflowOperationStatusClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewWorkflowOperationStatusServerTransport(srv *WorkflowOperationStatusServer) *WorkflowOperationStatusServerTransport { - return &WorkflowOperationStatusServerTransport{srv: srv} -} - -// WorkflowOperationStatusServerTransport connects instances of armrecoveryservicesdatareplication.WorkflowOperationStatusClient to instances of WorkflowOperationStatusServer. -// Don't use this type directly, use NewWorkflowOperationStatusServerTransport instead. -type WorkflowOperationStatusServerTransport struct { - srv *WorkflowOperationStatusServer -} - -// Do implements the policy.Transporter interface for WorkflowOperationStatusServerTransport. -func (w *WorkflowOperationStatusServerTransport) 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 "WorkflowOperationStatusClient.Get": - resp, err = w.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (w *WorkflowOperationStatusServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if w.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DataReplication/replicationVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jobs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - vaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("vaultName")]) - if err != nil { - return nil, err - } - jobNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("jobName")]) - if err != nil { - return nil, err - } - operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) - if err != nil { - return nil, err - } - respr, errRespr := w.srv.Get(req.Context(), resourceGroupNameParam, vaultNameParam, jobNameParam, operationIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatus, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/interfaces.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/interfaces.go index 5cb38b340968..dbf598420a24 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/interfaces.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/interfaces.go @@ -1,31 +1,27 @@ -//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 armrecoveryservicesdatareplication -// DraModelCustomPropertiesClassification provides polymorphic access to related types. -// Call the interface's GetDraModelCustomProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *DraModelCustomProperties, *VMwareDraModelCustomProperties -type DraModelCustomPropertiesClassification interface { - // GetDraModelCustomProperties returns the DraModelCustomProperties content of the underlying type. - GetDraModelCustomProperties() *DraModelCustomProperties -} - // EventModelCustomPropertiesClassification provides polymorphic access to related types. // Call the interface's GetEventModelCustomProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *EventModelCustomProperties, *HyperVToAzStackHCIEventModelCustomProperties +// - *EventModelCustomProperties, *HyperVToAzStackHCIEventModelCustomProperties, *VMwareToAzStackHCIEventModelCustomProperties type EventModelCustomPropertiesClassification interface { // GetEventModelCustomProperties returns the EventModelCustomProperties content of the underlying type. GetEventModelCustomProperties() *EventModelCustomProperties } +// FabricAgentModelCustomPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetFabricAgentModelCustomProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *FabricAgentModelCustomProperties, *VMwareFabricAgentModelCustomProperties +type FabricAgentModelCustomPropertiesClassification interface { + // GetFabricAgentModelCustomProperties returns the FabricAgentModelCustomProperties content of the underlying type. + GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties +} + // FabricModelCustomPropertiesClassification provides polymorphic access to related types. // Call the interface's GetFabricModelCustomProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -35,6 +31,15 @@ type FabricModelCustomPropertiesClassification interface { GetFabricModelCustomProperties() *FabricModelCustomProperties } +// JobModelCustomPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetJobModelCustomProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *FailoverJobModelCustomProperties, *JobModelCustomProperties, *TestFailoverCleanupJobModelCustomProperties, *TestFailoverJobModelCustomProperties +type JobModelCustomPropertiesClassification interface { + // GetJobModelCustomProperties returns the JobModelCustomProperties content of the underlying type. + GetJobModelCustomProperties() *JobModelCustomProperties +} + // PlannedFailoverModelCustomPropertiesClassification provides polymorphic access to related types. // Call the interface's GetPlannedFailoverModelCustomProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -62,10 +67,19 @@ type ProtectedItemModelCustomPropertiesClassification interface { GetProtectedItemModelCustomProperties() *ProtectedItemModelCustomProperties } +// ProtectedItemModelCustomPropertiesUpdateClassification provides polymorphic access to related types. +// Call the interface's GetProtectedItemModelCustomPropertiesUpdate() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate, *ProtectedItemModelCustomPropertiesUpdate, *VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate +type ProtectedItemModelCustomPropertiesUpdateClassification interface { + // GetProtectedItemModelCustomPropertiesUpdate returns the ProtectedItemModelCustomPropertiesUpdate content of the underlying type. + GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate +} + // RecoveryPointModelCustomPropertiesClassification provides polymorphic access to related types. // Call the interface's GetRecoveryPointModelCustomProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *HyperVToAzStackHCIRecoveryPointModelCustomProperties, *RecoveryPointModelCustomProperties +// - *HyperVToAzStackHCIRecoveryPointModelCustomProperties, *RecoveryPointModelCustomProperties, *VMwareToAzStackHCIRecoveryPointModelCustomProperties type RecoveryPointModelCustomPropertiesClassification interface { // GetRecoveryPointModelCustomProperties returns the RecoveryPointModelCustomProperties content of the underlying type. GetRecoveryPointModelCustomProperties() *RecoveryPointModelCustomProperties @@ -79,13 +93,3 @@ type ReplicationExtensionModelCustomPropertiesClassification interface { // GetReplicationExtensionModelCustomProperties returns the ReplicationExtensionModelCustomProperties content of the underlying type. GetReplicationExtensionModelCustomProperties() *ReplicationExtensionModelCustomProperties } - -// WorkflowModelCustomPropertiesClassification provides polymorphic access to related types. -// Call the interface's GetWorkflowModelCustomProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *FailoverWorkflowModelCustomProperties, *TestFailoverCleanupWorkflowModelCustomProperties, *TestFailoverWorkflowModelCustomProperties, -// - *WorkflowModelCustomProperties -type WorkflowModelCustomPropertiesClassification interface { - // GetWorkflowModelCustomProperties returns the WorkflowModelCustomProperties content of the underlying type. - GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_client.go similarity index 62% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_client.go index 65bfc24d57d1..f2f87a0c8e9c 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_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 armrecoveryservicesdatareplication @@ -17,26 +13,27 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" + "strconv" "strings" ) -// WorkflowClient contains the methods for the Workflow group. -// Don't use this type directly, use NewWorkflowClient() instead. -type WorkflowClient struct { +// JobClient contains the methods for the Job group. +// Don't use this type directly, use NewJobClient() instead. +type JobClient struct { internal *arm.Client subscriptionID string } -// NewWorkflowClient creates a new instance of WorkflowClient with the specified values. +// NewJobClient creates a new instance of JobClient 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 NewWorkflowClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkflowClient, error) { +func NewJobClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JobClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &WorkflowClient{ + client := &JobClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,35 +43,35 @@ func NewWorkflowClient(subscriptionID string, credential azcore.TokenCredential, // Get - Gets the details of the job. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. -// - jobName - The job (workflow) name. -// - options - WorkflowClientGetOptions contains the optional parameters for the WorkflowClient.Get method. -func (client *WorkflowClient) Get(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *WorkflowClientGetOptions) (WorkflowClientGetResponse, error) { +// - jobName - The job name. +// - options - JobClientGetOptions contains the optional parameters for the JobClient.Get method. +func (client *JobClient) Get(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *JobClientGetOptions) (JobClientGetResponse, error) { var err error - const operationName = "WorkflowClient.Get" + const operationName = "JobClient.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, vaultName, jobName, options) if err != nil { - return WorkflowClientGetResponse{}, err + return JobClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return WorkflowClientGetResponse{}, err + return JobClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return WorkflowClientGetResponse{}, err + return JobClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *WorkflowClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, jobName string, options *WorkflowClientGetOptions) (*policy.Request, error) { +func (client *JobClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, jobName string, _ *JobClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -97,34 +94,34 @@ func (client *WorkflowClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 *WorkflowClient) getHandleResponse(resp *http.Response) (WorkflowClientGetResponse, error) { - result := WorkflowClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowModel); err != nil { - return WorkflowClientGetResponse{}, err +func (client *JobClient) getHandleResponse(resp *http.Response) (JobClientGetResponse, error) { + result := JobClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobModel); err != nil { + return JobClientGetResponse{}, err } return result, nil } // NewListPager - Gets the list of jobs in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. -// - options - WorkflowClientListOptions contains the optional parameters for the WorkflowClient.NewListPager method. -func (client *WorkflowClient) NewListPager(resourceGroupName string, vaultName string, options *WorkflowClientListOptions) *runtime.Pager[WorkflowClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[WorkflowClientListResponse]{ - More: func(page WorkflowClientListResponse) bool { +// - options - JobClientListOptions contains the optional parameters for the JobClient.NewListPager method. +func (client *JobClient) NewListPager(resourceGroupName string, vaultName string, options *JobClientListOptions) *runtime.Pager[JobClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[JobClientListResponse]{ + More: func(page JobClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *WorkflowClientListResponse) (WorkflowClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "WorkflowClient.NewListPager") + Fetcher: func(ctx context.Context, page *JobClientListResponse) (JobClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "JobClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -133,7 +130,7 @@ func (client *WorkflowClient) NewListPager(resourceGroupName string, vaultName s return client.listCreateRequest(ctx, resourceGroupName, vaultName, options) }, nil) if err != nil { - return WorkflowClientListResponse{}, err + return JobClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -142,7 +139,7 @@ func (client *WorkflowClient) NewListPager(resourceGroupName string, vaultName s } // listCreateRequest creates the List request. -func (client *WorkflowClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *WorkflowClientListOptions) (*policy.Request, error) { +func (client *JobClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *JobClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -161,23 +158,26 @@ func (client *WorkflowClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } - reqQP.Set("api-version", "2021-02-16-preview") + if options != nil && options.OdataOptions != nil { + reqQP.Set("odataOptions", *options.OdataOptions) + } + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // listHandleResponse handles the List response. -func (client *WorkflowClient) listHandleResponse(resp *http.Response) (WorkflowClientListResponse, error) { - result := WorkflowClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowModelCollection); err != nil { - return WorkflowClientListResponse{}, err +func (client *JobClient) listHandleResponse(resp *http.Response) (JobClientListResponse, error) { + result := JobClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.JobModelListResult); err != nil { + return JobClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_client_example_test.go similarity index 64% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client_example_test.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_client_example_test.go index 8d903c16530e..cd5d04d45361 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflow_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/job_client_example_test.go @@ -1,115 +1,103 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Workflow_Get.json -func ExampleWorkflowClient_Get() { +// Generated from example definition: 2024-09-01/Job_Get.json +func ExampleJobClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewWorkflowClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "ZGH4y", nil) + res, err := clientFactory.NewJobClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "ZGH4y", 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.WorkflowModel = armrecoveryservicesdatareplication.WorkflowModel{ - // Name: to.Ptr("ukii"), - // Type: to.Ptr("cswros"), - // ID: to.Ptr("zsyhbwznbkaia"), - // Properties: &armrecoveryservicesdatareplication.WorkflowModelProperties{ - // ActivityID: to.Ptr("esjvxsa"), - // AllowedActions: []*string{ - // to.Ptr("mfsyvxzgmcpgdzfbbhoxrzhya")}, - // CustomProperties: &armrecoveryservicesdatareplication.WorkflowModelCustomProperties{ - // AffectedObjectDetails: map[string]*string{ - // "key7245": to.Ptr("yllr"), - // }, - // InstanceType: to.Ptr("WorkflowModelCustomProperties"), - // }, + // res = armrecoveryservicesdatareplication.JobClientGetResponse{ + // JobModel: &armrecoveryservicesdatareplication.JobModel{ + // Properties: &armrecoveryservicesdatareplication.JobModelProperties{ // DisplayName: to.Ptr("dhopzytkd"), + // State: to.Ptr(armrecoveryservicesdatareplication.JobStatePending), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // Errors: []*armrecoveryservicesdatareplication.ErrorModel{ - // { - // Type: to.Ptr("iyktxohrtrkshbjdhboscsu"), - // Causes: to.Ptr("iffxig"), - // Code: to.Ptr("ndcxzieiuwoxoklilcvjmglml"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // Message: to.Ptr("ltuufmxomfecqeyvzrfjqlelytkdwr"), - // Recommendation: to.Ptr("brridkskflo"), - // Severity: to.Ptr("ldgmfmbzmjtqjg"), - // }}, // ObjectID: to.Ptr("wvtmwiyxqrpqvljzn"), + // ObjectName: to.Ptr("ieieqaw"), // ObjectInternalID: to.Ptr("ahbtlwmbeivmlbj"), // ObjectInternalName: to.Ptr("mxikyrinkeyj"), - // ObjectName: to.Ptr("ieieqaw"), - // ObjectType: to.Ptr(armrecoveryservicesdatareplication.WorkflowObjectTypeAvsDiskPool), + // ObjectType: to.Ptr(armrecoveryservicesdatareplication.JobObjectTypeAvsDiskPool), // ReplicationProviderID: to.Ptr("ghxsbnvdkx"), // SourceFabricProviderID: to.Ptr("yqlertkmzdsgsplzgkmwcttsiagsa"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // State: to.Ptr(armrecoveryservicesdatareplication.WorkflowStatePending), // TargetFabricProviderID: to.Ptr("stjlmqzpgnrug"), + // AllowedActions: []*string{ + // to.Ptr("mfsyvxzgmcpgdzfbbhoxrzhya"), + // }, + // ActivityID: to.Ptr("esjvxsa"), // Tasks: []*armrecoveryservicesdatareplication.TaskModel{ // { - // ChildrenWorkflows: []*armrecoveryservicesdatareplication.WorkflowModel{ - // }, + // TaskName: to.Ptr("flkzfbbpngqbbjsdqysqfon"), + // State: to.Ptr(armrecoveryservicesdatareplication.TaskStatePending), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), // CustomProperties: &armrecoveryservicesdatareplication.TaskModelCustomProperties{ // InstanceType: to.Ptr("aaqgqvnhskxpsbnrdekxaghweon"), // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // State: to.Ptr(armrecoveryservicesdatareplication.TaskStatePending), - // TaskName: to.Ptr("flkzfbbpngqbbjsdqysqfon"), - // }}, + // }, + // }, + // Errors: []*armrecoveryservicesdatareplication.ErrorModel{ + // { + // Code: to.Ptr("ndcxzieiuwoxoklilcvjmglml"), + // Type: to.Ptr("iyktxohrtrkshbjdhboscsu"), + // Severity: to.Ptr("ldgmfmbzmjtqjg"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), + // Message: to.Ptr("ltuufmxomfecqeyvzrfjqlelytkdwr"), + // Causes: to.Ptr("iffxig"), + // Recommendation: to.Ptr("brridkskflo"), + // }, + // }, // }, - // SystemData: &armrecoveryservicesdatareplication.WorkflowModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/jobs/job1"), + // Name: to.Ptr("ukii"), + // Type: to.Ptr("cswros"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("jurgsdagntjg"), - // CreatedByType: to.Ptr("zowfl"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), // LastModifiedBy: to.Ptr("vuw"), - // LastModifiedByType: to.Ptr("h"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Workflow_List.json -func ExampleWorkflowClient_NewListPager() { +// Generated from example definition: 2024-09-01/Job_List.json +func ExampleJobClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewWorkflowClient().NewListPager("rgrecoveryservicesdatareplication", "4", &armrecoveryservicesdatareplication.WorkflowClientListOptions{Filter: to.Ptr("mnebpgmjcitjleipnttx"), - ContinuationToken: to.Ptr("rdavrzbethhslmkqgajontnxsue"), - }) + pager := clientFactory.NewJobClient().NewListPager("rgrecoveryservicesdatareplication", "4", &JobClientListOptions{ + continuationToken: to.Ptr("rdavrzbethhslmkqgajontnxsue")}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -120,66 +108,62 @@ func ExampleWorkflowClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WorkflowModelCollection = armrecoveryservicesdatareplication.WorkflowModelCollection{ - // Value: []*armrecoveryservicesdatareplication.WorkflowModel{ - // { - // Name: to.Ptr("ukii"), - // Type: to.Ptr("cswros"), - // ID: to.Ptr("zsyhbwznbkaia"), - // Properties: &armrecoveryservicesdatareplication.WorkflowModelProperties{ - // ActivityID: to.Ptr("esjvxsa"), - // AllowedActions: []*string{ - // to.Ptr("mfsyvxzgmcpgdzfbbhoxrzhya")}, - // CustomProperties: &armrecoveryservicesdatareplication.WorkflowModelCustomProperties{ - // AffectedObjectDetails: map[string]*string{ - // "key7245": to.Ptr("yllr"), - // }, - // InstanceType: to.Ptr("WorkflowModelCustomProperties"), - // }, + // page = armrecoveryservicesdatareplication.JobClientListResponse{ + // JobModelListResult: armrecoveryservicesdatareplication.JobModelListResult{ + // Value: []*armrecoveryservicesdatareplication.JobModel{ + // { + // Properties: &armrecoveryservicesdatareplication.JobModelProperties{ // DisplayName: to.Ptr("dhopzytkd"), + // State: to.Ptr(armrecoveryservicesdatareplication.JobStatePending), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // Errors: []*armrecoveryservicesdatareplication.ErrorModel{ - // { - // Type: to.Ptr("iyktxohrtrkshbjdhboscsu"), - // Causes: to.Ptr("iffxig"), - // Code: to.Ptr("ndcxzieiuwoxoklilcvjmglml"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // Message: to.Ptr("ltuufmxomfecqeyvzrfjqlelytkdwr"), - // Recommendation: to.Ptr("brridkskflo"), - // Severity: to.Ptr("ldgmfmbzmjtqjg"), - // }}, // ObjectID: to.Ptr("wvtmwiyxqrpqvljzn"), + // ObjectName: to.Ptr("ieieqaw"), // ObjectInternalID: to.Ptr("ahbtlwmbeivmlbj"), // ObjectInternalName: to.Ptr("mxikyrinkeyj"), - // ObjectName: to.Ptr("ieieqaw"), - // ObjectType: to.Ptr(armrecoveryservicesdatareplication.WorkflowObjectTypeAvsDiskPool), + // ObjectType: to.Ptr(armrecoveryservicesdatareplication.JobObjectTypeAvsDiskPool), // ReplicationProviderID: to.Ptr("ghxsbnvdkx"), // SourceFabricProviderID: to.Ptr("yqlertkmzdsgsplzgkmwcttsiagsa"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // State: to.Ptr(armrecoveryservicesdatareplication.WorkflowStatePending), // TargetFabricProviderID: to.Ptr("stjlmqzpgnrug"), + // AllowedActions: []*string{ + // to.Ptr("mfsyvxzgmcpgdzfbbhoxrzhya"), + // }, + // ActivityID: to.Ptr("esjvxsa"), // Tasks: []*armrecoveryservicesdatareplication.TaskModel{ // { - // ChildrenWorkflows: []*armrecoveryservicesdatareplication.WorkflowModel{ - // }, + // TaskName: to.Ptr("flkzfbbpngqbbjsdqysqfon"), + // State: to.Ptr(armrecoveryservicesdatareplication.TaskStatePending), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), // CustomProperties: &armrecoveryservicesdatareplication.TaskModelCustomProperties{ // InstanceType: to.Ptr("aaqgqvnhskxpsbnrdekxaghweon"), // }, - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), - // State: to.Ptr(armrecoveryservicesdatareplication.TaskStatePending), - // TaskName: to.Ptr("flkzfbbpngqbbjsdqysqfon"), - // }}, + // }, + // }, + // Errors: []*armrecoveryservicesdatareplication.ErrorModel{ + // { + // Code: to.Ptr("ndcxzieiuwoxoklilcvjmglml"), + // Type: to.Ptr("iyktxohrtrkshbjdhboscsu"), + // Severity: to.Ptr("ldgmfmbzmjtqjg"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.269Z"); return t}()), + // Message: to.Ptr("ltuufmxomfecqeyvzrfjqlelytkdwr"), + // Causes: to.Ptr("iffxig"), + // Recommendation: to.Ptr("brridkskflo"), + // }, + // }, // }, - // SystemData: &armrecoveryservicesdatareplication.WorkflowModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/jobs/job1"), + // Name: to.Ptr("ukii"), + // Type: to.Ptr("cswros"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ // CreatedBy: to.Ptr("jurgsdagntjg"), - // CreatedByType: to.Ptr("zowfl"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), // LastModifiedBy: to.Ptr("vuw"), - // LastModifiedByType: to.Ptr("h"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:59.270Z"); return t}()), // }, - // }}, - // } + // }, + // }, + // }, + // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models.go index 0efe2449ce05..d71876a18811 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 armrecoveryservicesdatareplication @@ -33,7 +29,8 @@ type AzStackHCIFabricModelCustomProperties struct { // REQUIRED; AzStackHCI cluster properties. Cluster *AzStackHCIClusterProperties - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "AzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the Migration solution ARM Id. @@ -80,6 +77,24 @@ type CheckNameAvailabilityResponseModel struct { Reason *string } +// ConnectionDetails - Private endpoint connection details at member level. +type ConnectionDetails struct { + // Gets or sets group id. + GroupID *string + + // Gets or sets id. + ID *string + + // Gets or sets link identifier. + LinkIdentifier *string + + // Gets or sets member name. + MemberName *string + + // Gets or sets private IP address. + PrivateIPAddress *string +} + // DeploymentPreflightModel - Deployment preflight model. type DeploymentPreflightModel struct { // Gets or sets the list of resources. @@ -97,127 +112,50 @@ type DeploymentPreflightResource struct { // Gets or sets the resource name. Name *string - // Gets or sets the resource type. - Type *string -} - -// DraModel - Dra model. -type DraModel struct { - // REQUIRED; Dra model properties. - Properties *DraModelProperties - - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. - Name *string - - // READ-ONLY - SystemData *DraModelSystemData + // Gets or sets the properties of the resource. + Properties any - // READ-ONLY; Gets or sets the type of the resource. + // Gets or sets the resource type. Type *string } -// DraModelCollection - Dra model collection. -type DraModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of Dras. - Value []*DraModel -} - -// DraModelCustomProperties - Dra model custom properties. -type DraModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. - InstanceType *string -} - -// GetDraModelCustomProperties implements the DraModelCustomPropertiesClassification interface for type DraModelCustomProperties. -func (d *DraModelCustomProperties) GetDraModelCustomProperties() *DraModelCustomProperties { return d } - -// DraModelProperties - Dra model properties. -type DraModelProperties struct { - // REQUIRED; Identity model. - AuthenticationIdentity *IdentityModel - - // REQUIRED; Dra model custom properties. - CustomProperties DraModelCustomPropertiesClassification - - // REQUIRED; Gets or sets the machine Id where Dra is running. - MachineID *string - - // REQUIRED; Gets or sets the machine name where Dra is running. - MachineName *string - - // REQUIRED; Identity model. - ResourceAccessIdentity *IdentityModel - - // READ-ONLY; Gets or sets the Dra correlation Id. - CorrelationID *string - - // READ-ONLY; Gets or sets the list of health errors. - HealthErrors []*HealthErrorModel - - // READ-ONLY; Gets or sets a value indicating whether Dra is responsive. - IsResponsive *bool - - // READ-ONLY; Gets or sets the time when last heartbeat was sent by the Dra. - LastHeartbeat *time.Time - - // READ-ONLY; Gets or sets the provisioning state of the Dra. - ProvisioningState *ProvisioningState - - // READ-ONLY; Gets or sets the Dra version. - VersionNumber *string -} - -type DraModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string +// DiskControllerInputs - Disk controller. +type DiskControllerInputs struct { + // REQUIRED; Gets or sets the controller ID. + ControllerID *int32 - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // REQUIRED; Gets or sets the controller Location. + ControllerLocation *int32 - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // REQUIRED; Gets or sets the controller name (IDE,SCSI). + ControllerName *string } // EmailConfigurationModel - Email configuration model. type EmailConfigurationModel struct { - // REQUIRED; Email configuration model properties. + // The resource-specific properties for this resource. Properties *EmailConfigurationModelProperties - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The email configuration name. Name *string - // READ-ONLY - SystemData *EmailConfigurationModelSystemData + // 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; Gets or sets the type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// EmailConfigurationModelCollection - Email configuration model collection. -type EmailConfigurationModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of email configurations. +// EmailConfigurationModelListResult - The response of a EmailConfigurationModel list operation. +type EmailConfigurationModelListResult struct { + // REQUIRED; The EmailConfigurationModel items on this page Value []*EmailConfigurationModel + + // The link to the next page of items + NextLink *string } // EmailConfigurationModelProperties - Email configuration model properties. @@ -230,26 +168,9 @@ type EmailConfigurationModelProperties struct { // Gets or sets the locale for the email notification. Locale *string -} - -type EmailConfigurationModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // READ-ONLY; Gets or sets the provisioning state of the email configuration. + ProvisioningState *ProvisioningState } // ErrorModel - Error model. @@ -278,34 +199,25 @@ type ErrorModel struct { // EventModel - Event model. type EventModel struct { - // REQUIRED; Event model properties. + // The resource-specific properties for this resource. Properties *EventModelProperties - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The event name. Name *string - // READ-ONLY - SystemData *EventModelSystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string -// EventModelCollection - Event model collection. -type EventModelCollection struct { - // Gets or sets the value of next link. - NextLink *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Gets or sets the list of events. - Value []*EventModel + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // EventModelCustomProperties - Event model custom properties. type EventModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for EventModelCustomProperties. InstanceType *string } @@ -314,6 +226,15 @@ func (e *EventModelCustomProperties) GetEventModelCustomProperties() *EventModel return e } +// EventModelListResult - The response of a EventModel list operation. +type EventModelListResult struct { + // REQUIRED; The EventModel items on this page + Value []*EventModel + + // The link to the next page of items + NextLink *string +} + // EventModelProperties - Event model properties. type EventModelProperties struct { // REQUIRED; Event model custom properties. @@ -334,6 +255,9 @@ type EventModelProperties struct { // READ-ONLY; Gets or sets the errors associated with this event. HealthErrors []*HealthErrorModel + // READ-ONLY; Gets or sets the provisioning state of the event. + ProvisioningState *ProvisioningState + // READ-ONLY; Gets or sets the resource name. ResourceName *string @@ -347,62 +271,107 @@ type EventModelProperties struct { TimeOfOccurrence *time.Time } -type EventModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time +// FabricAgentModel - Fabric agent model. +type FabricAgentModel struct { + // The resource-specific properties for this resource. + Properties *FabricAgentModelProperties - // Gets or sets identity that created the resource. - CreatedBy *string + // READ-ONLY; The fabric agent name. + Name *string - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// FabricAgentModelCustomProperties - Fabric agent model custom properties. +type FabricAgentModelCustomProperties struct { + // REQUIRED; Discriminator property for FabricAgentModelCustomProperties. + InstanceType *string +} + +// GetFabricAgentModelCustomProperties implements the FabricAgentModelCustomPropertiesClassification interface for type FabricAgentModelCustomProperties. +func (f *FabricAgentModelCustomProperties) GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties { + return f +} + +// FabricAgentModelListResult - The response of a FabricAgentModel list operation. +type FabricAgentModelListResult struct { + // REQUIRED; The FabricAgentModel items on this page + Value []*FabricAgentModel + + // The link to the next page of items + NextLink *string +} + +// FabricAgentModelProperties - Fabric agent model properties. +type FabricAgentModelProperties struct { + // REQUIRED; Identity model. + AuthenticationIdentity *IdentityModel + + // REQUIRED; Fabric agent model custom properties. + CustomProperties FabricAgentModelCustomPropertiesClassification + + // REQUIRED; Gets or sets the machine Id where fabric agent is running. + MachineID *string + + // REQUIRED; Gets or sets the machine name where fabric agent is running. + MachineName *string + + // REQUIRED; Identity model. + ResourceAccessIdentity *IdentityModel + + // READ-ONLY; Gets or sets the fabric agent correlation Id. + CorrelationID *string + + // READ-ONLY; Gets or sets the list of health errors. + HealthErrors []*HealthErrorModel + + // READ-ONLY; Gets or sets a value indicating whether the fabric agent is responsive. + IsResponsive *bool + + // READ-ONLY; Gets or sets the time when last heartbeat was sent by the fabric agent. + LastHeartbeat *time.Time + + // READ-ONLY; Gets or sets the provisioning state of the fabric agent. + ProvisioningState *ProvisioningState - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // READ-ONLY; Gets or sets the fabric agent version. + VersionNumber *string } // FabricModel - Fabric model. type FabricModel struct { - // REQUIRED; Gets or sets the location of the fabric. + // REQUIRED; The geo-location where the resource lives Location *string - // REQUIRED; Fabric model properties. + // The resource-specific properties for this resource. Properties *FabricModelProperties - // Gets or sets the resource tags. + // Resource tags. Tags map[string]*string - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The fabric name. Name *string - // READ-ONLY - SystemData *FabricModelSystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string -// FabricModelCollection - Fabric model collection. -type FabricModelCollection struct { - // Gets or sets the value of next link. - NextLink *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Gets or sets the list of fabrics. - Value []*FabricModel + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // FabricModelCustomProperties - Fabric model custom properties. type FabricModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for FabricModelCustomProperties. InstanceType *string } @@ -411,6 +380,15 @@ func (f *FabricModelCustomProperties) GetFabricModelCustomProperties() *FabricMo return f } +// FabricModelListResult - The response of a FabricModel list operation. +type FabricModelListResult struct { + // REQUIRED; The FabricModel items on this page + Value []*FabricModel + + // The link to the next page of items + NextLink *string +} + // FabricModelProperties - Fabric model properties. type FabricModelProperties struct { // REQUIRED; Fabric model custom properties. @@ -432,27 +410,7 @@ type FabricModelProperties struct { ServiceResourceID *string } -type FabricModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} - -// FabricModelUpdate - Fabric model for update. +// FabricModelUpdate - Fabric model update. type FabricModelUpdate struct { // Fabric model properties. Properties *FabricModelProperties @@ -466,31 +424,31 @@ type FabricModelUpdate struct { // READ-ONLY; Gets or sets the name of the resource. Name *string - // READ-ONLY - SystemData *FabricModelUpdateSystemData + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData // READ-ONLY; Gets or sets the type of the resource. Type *string } -type FabricModelUpdateSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string +// FailoverJobModelCustomProperties - Failover job model custom properties. +type FailoverJobModelCustomProperties struct { + // REQUIRED; Gets or sets the instance type. + InstanceType *string - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time + // READ-ONLY; Gets or sets any custom properties of the affected object. + AffectedObjectDetails *JobModelCustomPropertiesAffectedObjectDetails - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // READ-ONLY; Gets or sets the failed over protected item details. + ProtectedItemDetails []*FailoverProtectedItemProperties +} - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string +// GetJobModelCustomProperties implements the JobModelCustomPropertiesClassification interface for type FailoverJobModelCustomProperties. +func (f *FailoverJobModelCustomProperties) GetJobModelCustomProperties() *JobModelCustomProperties { + return &JobModelCustomProperties{ + AffectedObjectDetails: f.AffectedObjectDetails, + InstanceType: f.InstanceType, + } } // FailoverProtectedItemProperties - Failover properties of the protected item. @@ -517,31 +475,31 @@ type FailoverProtectedItemProperties struct { VMName *string } -// FailoverWorkflowModelCustomProperties - Failover workflow model custom properties. -type FailoverWorkflowModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. - InstanceType *string +// GroupConnectivityInformation - Represents of a connection's group information. +type GroupConnectivityInformation struct { + // Gets or sets customer visible FQDNs. + CustomerVisibleFqdns []*string - // READ-ONLY; Gets or sets any custom properties of the affected object. - AffectedObjectDetails map[string]*string + // Gets or sets group id. + GroupID *string - // READ-ONLY; Gets or sets the failed over protected item details. - ProtectedItemDetails []*FailoverProtectedItemProperties -} + // Gets or sets Internal Fqdn. + InternalFqdn *string -// GetWorkflowModelCustomProperties implements the WorkflowModelCustomPropertiesClassification interface for type FailoverWorkflowModelCustomProperties. -func (f *FailoverWorkflowModelCustomProperties) GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties { - return &WorkflowModelCustomProperties{ - AffectedObjectDetails: f.AffectedObjectDetails, - InstanceType: f.InstanceType, - } + // Gets or sets member name. + MemberName *string + + // Gets or sets the private link service arm region. + PrivateLinkServiceArmRegion *string + + // Gets or sets the redirect map id. + RedirectMapID *string } // HealthErrorModel - Health error model. type HealthErrorModel struct { // Gets or sets the list of affected resource correlation Ids. This can be used to uniquely identify the count of items affected - // by a specific category and severity as well as count of item affected by - // an specific issue. + // by a specific category and severity as well as count of item affected by an specific issue. AffectedResourceCorrelationIDs []*string // Gets or sets the type of affected resource type. @@ -589,7 +547,8 @@ type HyperVMigrateFabricModelCustomProperties struct { // REQUIRED; Gets or sets the ARM Id of the HyperV site. HyperVSiteID *string - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "HyperVMigrate", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the migration solution ARM Id. @@ -626,6 +585,21 @@ type HyperVToAzStackHCIDiskInput struct { // REQUIRED; Gets or sets a value indicating whether disk is os disk. IsOsDisk *bool + // Gets or sets a value of disk block size. + DiskBlockSize *int64 + + // Disk controller. + DiskController *DiskControllerInputs + + // Gets or sets a value of disk identifier. + DiskIdentifier *string + + // Gets or sets a value of disk logical sector size. + DiskLogicalSectorSize *int64 + + // Gets or sets a value of disk physical sector size. + DiskPhysicalSectorSize *int64 + // Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard disk. IsDynamic *bool @@ -634,8 +608,7 @@ type HyperVToAzStackHCIDiskInput struct { } // HyperVToAzStackHCIEventModelCustomProperties - HyperV to AzStackHCI event model custom properties. This class provides -// provider specific details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and -// DataContract.HealthEvents.HealthEventType.AgentHealth. +// provider specific details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and DataContract.HealthEvents.HealthEventType.AgentHealth. type HyperVToAzStackHCIEventModelCustomProperties struct { // REQUIRED; Gets or sets the instance type. InstanceType *string @@ -671,10 +644,16 @@ type HyperVToAzStackHCINicInput struct { // REQUIRED; Gets or sets the selection type of the NIC. SelectionTypeForFailover *VMNicSelection - // REQUIRED; Gets or sets the target network Id within AzStackHCI Cluster. + // Gets or sets a value indicating whether mac address migration is enabled. + IsMacMigrationEnabled *bool + + // Gets or sets a value indicating whether static ip migration is enabled. + IsStaticIPMigrationEnabled *bool + + // Gets or sets the target network Id within AzStackHCI Cluster. TargetNetworkID *string - // REQUIRED; Gets or sets the target test network Id within AzStackHCI Cluster. + // Gets or sets the target test network Id within AzStackHCI Cluster. TestNetworkID *string // READ-ONLY; Gets or sets the network name. @@ -683,7 +662,8 @@ type HyperVToAzStackHCINicInput struct { // HyperVToAzStackHCIPlannedFailoverModelCustomProperties - HyperV to AzStackHCI planned failover model custom properties. type HyperVToAzStackHCIPlannedFailoverModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "HyperVToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets a value indicating whether VM needs to be shut down. @@ -706,7 +686,8 @@ type HyperVToAzStackHCIPolicyModelCustomProperties struct { // REQUIRED; Gets or sets the crash consistent snapshot frequency (in minutes). CrashConsistentFrequencyInMinutes *int32 - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "HyperVToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the duration in minutes until which the recovery points need to be stored. @@ -725,6 +706,15 @@ type HyperVToAzStackHCIProtectedDiskProperties struct { // READ-ONLY; Gets or sets the disk capacity in bytes. CapacityInBytes *int64 + // READ-ONLY; Gets or sets a value of disk block size. + DiskBlockSize *int64 + + // READ-ONLY; Gets or sets a value of disk logical sector size. + DiskLogicalSectorSize *int64 + + // READ-ONLY; Gets or sets a value of disk physical sector size. + DiskPhysicalSectorSize *int64 + // READ-ONLY; Gets or sets the disk type. DiskType *string @@ -770,7 +760,8 @@ type HyperVToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the hypervisor generation of the virtual machine. HyperVGeneration *string - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "HyperVToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the list of VM NIC to replicate. @@ -779,8 +770,8 @@ type HyperVToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the Run As account Id. RunAsAccountID *string - // REQUIRED; Gets or sets the source DRA name. - SourceDraName *string + // REQUIRED; Gets or sets the source fabric agent name. + SourceFabricAgentName *string // REQUIRED; Gets or sets the target storage container ARM Id. StorageContainerID *string @@ -788,8 +779,8 @@ type HyperVToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the Target Arc Cluster Custom Location ARM Id. TargetArcClusterCustomLocationID *string - // REQUIRED; Gets or sets the target DRA name. - TargetDraName *string + // REQUIRED; Gets or sets the target fabric agent name. + TargetFabricAgentName *string // REQUIRED; Gets or sets the Target HCI Cluster ARM Id. TargetHciClusterID *string @@ -889,6 +880,39 @@ func (h *HyperVToAzStackHCIProtectedItemModelCustomProperties) GetProtectedItemM } } +// HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate - HyperV to AzStackHCI Protected item model custom properties. +type HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate struct { + // CONSTANT; Gets or sets the instance type. + // Field has constant value "HyperVToAzStackHCI", any specified value is ignored. + InstanceType *string + + // Protected item dynamic memory config. + DynamicMemoryConfig *ProtectedItemDynamicMemoryConfig + + // Gets or sets a value indicating whether memory is dynamical. + IsDynamicRAM *bool + + // Gets or sets the list of VM NIC to replicate. + NicsToInclude []*HyperVToAzStackHCINicInput + + // Gets or sets the type of the OS. + OSType *string + + // Gets or sets the target CPU cores. + TargetCPUCores *int32 + + // Gets or sets the target memory in mega-bytes. + TargetMemoryInMegaBytes *int32 +} + +// GetProtectedItemModelCustomPropertiesUpdate implements the ProtectedItemModelCustomPropertiesUpdateClassification interface +// for type HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (h *HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate) GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate { + return &ProtectedItemModelCustomPropertiesUpdate{ + InstanceType: h.InstanceType, + } +} + // HyperVToAzStackHCIProtectedNicProperties - HyperVToAzStackHCI NIC properties. type HyperVToAzStackHCIProtectedNicProperties struct { // READ-ONLY; Gets or sets the NIC mac address. @@ -935,7 +959,8 @@ type HyperVToAzStackHCIReplicationExtensionModelCustomProperties struct { // REQUIRED; Gets or sets the ARM Id of the source HyperV fabric. HyperVFabricArmID *string - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "HyperVToAzStackHCI", any specified value is ignored. InstanceType *string // Gets or sets the storage account Id. @@ -991,19 +1016,19 @@ func (h *HyperVToAzStackHCIReplicationExtensionModelCustomProperties) GetReplica // IdentityModel - Identity model. type IdentityModel struct { - // REQUIRED; Gets or sets the authority of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the authority of the SPN with which fabric agent communicates to service. AADAuthority *string - // REQUIRED; Gets or sets the client/application Id of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the client/application Id of the SPN with which fabric agent communicates to service. ApplicationID *string - // REQUIRED; Gets or sets the audience of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the audience of the SPN with which fabric agent communicates to service. Audience *string - // REQUIRED; Gets or sets the object Id of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the object Id of the SPN with which fabric agent communicates to service. ObjectID *string - // REQUIRED; Gets or sets the tenant Id of the SPN with which Dra communicates to service. + // REQUIRED; Gets or sets the tenant Id of the SPN with which fabric agent communicates to service. TenantID *string } @@ -1043,28 +1068,147 @@ type InnerHealthErrorModel struct { Summary *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API -type Operation struct { - // Localized display information for this particular operation. - Display *OperationDisplay +// JobModel - Job model. +type JobModel struct { + // The resource-specific properties for this resource. + Properties *JobModelProperties - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - ActionType *ActionType + // READ-ONLY; The job name. + Name *string - // 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; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // 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; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // 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 + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// JobModelCustomProperties - Job model custom properties. +type JobModelCustomProperties struct { + // REQUIRED; Discriminator property for JobModelCustomProperties. + InstanceType *string + + // READ-ONLY; Gets or sets any custom properties of the affected object. + AffectedObjectDetails *JobModelCustomPropertiesAffectedObjectDetails } -// OperationDisplay - Localized display information for this particular operation. +// GetJobModelCustomProperties implements the JobModelCustomPropertiesClassification interface for type JobModelCustomProperties. +func (j *JobModelCustomProperties) GetJobModelCustomProperties() *JobModelCustomProperties { return j } + +type JobModelCustomPropertiesAffectedObjectDetails struct { + Description *string + + // FLAG; CONSTANT + Type *string +} + +// JobModelListResult - The response of a JobModel list operation. +type JobModelListResult struct { + // REQUIRED; The JobModel items on this page + Value []*JobModel + + // The link to the next page of items + NextLink *string +} + +// JobModelProperties - Job model properties. +type JobModelProperties struct { + // REQUIRED; Job model custom properties. + CustomProperties JobModelCustomPropertiesClassification + + // READ-ONLY; Gets or sets the job activity id. + ActivityID *string + + // READ-ONLY; Gets or sets the list of allowed actions on the job. + AllowedActions []*string + + // READ-ONLY; Gets or sets the friendly display name. + DisplayName *string + + // READ-ONLY; Gets or sets the end time. + EndTime *time.Time + + // READ-ONLY; Gets or sets the list of errors. + Errors []*ErrorModel + + // READ-ONLY; Gets or sets the affected object Id. + ObjectID *string + + // READ-ONLY; Gets or sets the affected object internal Id. + ObjectInternalID *string + + // READ-ONLY; Gets or sets the affected object internal name. + ObjectInternalName *string + + // READ-ONLY; Gets or sets the affected object name. + ObjectName *string + + // READ-ONLY; Gets or sets the object type. + ObjectType *JobObjectType + + // READ-ONLY; Gets or sets the provisioning state of the job. + ProvisioningState *ProvisioningState + + // READ-ONLY; Gets or sets the replication provider. + ReplicationProviderID *string + + // READ-ONLY; Gets or sets the source fabric provider. + SourceFabricProviderID *string + + // READ-ONLY; Gets or sets the start time. + StartTime *time.Time + + // READ-ONLY; Gets or sets the job state. + State *JobState + + // READ-ONLY; Gets or sets the target fabric provider. + TargetFabricProviderID *string + + // READ-ONLY; Gets or sets the list of tasks. + Tasks []*TaskModel +} + +// ManagedServiceIdentity - Managed service identity (system assigned and/or user assigned identities) +type ManagedServiceIdentity struct { + // REQUIRED; The type of managed identity assigned to this resource. + Type *ManagedServiceIdentityType + + // The identities assigned to this resource by the user. + UserAssignedIdentities map[string]*UserAssignedIdentity + + // READ-ONLY; The service principal ID of the system assigned identity. This property will only be provided for a system assigned + // identity. + PrincipalID *string + + // READ-ONLY; The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + TenantID *string +} + +// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +type Operation struct { + // Localized display information for this particular operation. + Display *OperationDisplay + + // READ-ONLY; Extensible 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 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 @@ -1085,11 +1229,11 @@ type OperationDisplay struct { // OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to // get the next set of results. type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string - - // READ-ONLY; List of operations supported by the resource provider + // REQUIRED; The Operation items on this page Value []*Operation + + // The link to the next page of items + NextLink *string } // OperationStatus - Defines the operation status. @@ -1119,7 +1263,7 @@ type PlannedFailoverModel struct { // PlannedFailoverModelCustomProperties - Planned failover model custom properties. type PlannedFailoverModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for PlannedFailoverModelCustomProperties. InstanceType *string } @@ -1137,34 +1281,25 @@ type PlannedFailoverModelProperties struct { // PolicyModel - Policy model. type PolicyModel struct { - // REQUIRED; Policy model properties. + // The resource-specific properties for this resource. Properties *PolicyModelProperties - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The policy name. Name *string - // READ-ONLY - SystemData *PolicyModelSystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string -// PolicyModelCollection - Policy model collection. -type PolicyModelCollection struct { - // Gets or sets the value of next link. - NextLink *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Gets or sets the list of policies. - Value []*PolicyModel + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // PolicyModelCustomProperties - Policy model custom properties. type PolicyModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for PolicyModelCustomProperties. InstanceType *string } @@ -1173,6 +1308,15 @@ func (p *PolicyModelCustomProperties) GetPolicyModelCustomProperties() *PolicyMo return p } +// PolicyModelListResult - The response of a PolicyModel list operation. +type PolicyModelListResult struct { + // REQUIRED; The PolicyModel items on this page + Value []*PolicyModel + + // The link to the next page of items + NextLink *string +} + // PolicyModelProperties - Policy model properties. type PolicyModelProperties struct { // REQUIRED; Policy model custom properties. @@ -1182,24 +1326,170 @@ type PolicyModelProperties struct { ProvisioningState *ProvisioningState } -type PolicyModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time +// PrivateEndpoint - Represent private Endpoint network resource that is linked to the Private Endpoint connection. +type PrivateEndpoint struct { + // Gets or sets the id. + ID *string +} - // Gets or sets identity that created the resource. - CreatedBy *string +// PrivateEndpointConnection - Represents private endpoint connection. +type PrivateEndpointConnection struct { + // The resource-specific properties for this resource. + Properties *PrivateEndpointConnectionResponseProperties - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string + // READ-ONLY; The private endpoint connection name. + Name *string - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateEndpointConnectionListResult - The response of a PrivateEndpointConnection list operation. +type PrivateEndpointConnectionListResult struct { + // REQUIRED; The PrivateEndpointConnection items on this page + Value []*PrivateEndpointConnection + + // The link to the next page of items + NextLink *string +} + +// PrivateEndpointConnectionProxy - Represents private endpoint connection proxy request. +type PrivateEndpointConnectionProxy struct { + // READ-ONLY; The private endpoint connection proxy name. + Name *string + + // Gets or sets ETag. + Etag *string + + // The resource-specific properties for this resource. + Properties *PrivateEndpointConnectionProxyProperties + + // 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 +} + +// PrivateEndpointConnectionProxyListResult - The response of a PrivateEndpointConnectionProxy list operation. +type PrivateEndpointConnectionProxyListResult struct { + // REQUIRED; The PrivateEndpointConnectionProxy items on this page + Value []*PrivateEndpointConnectionProxy + + // The link to the next page of items + NextLink *string +} + +// PrivateEndpointConnectionProxyProperties - Represents private endpoint connection proxy request. +type PrivateEndpointConnectionProxyProperties struct { + // Represent remote private endpoint information for the private endpoint connection proxy. + RemotePrivateEndpoint *RemotePrivateEndpoint + + // READ-ONLY; Gets or sets the provisioning state of the private endpoint connection proxy. + ProvisioningState *ProvisioningState +} + +// PrivateEndpointConnectionResponseProperties - Represents Private endpoint connection response properties. +type PrivateEndpointConnectionResponseProperties struct { + // Represent private Endpoint network resource that is linked to the Private Endpoint connection. + PrivateEndpoint *PrivateEndpoint + + // Represents Private link service connection state. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // READ-ONLY; Gets or sets provisioning state of the private endpoint connection. + ProvisioningState *ProvisioningState +} + +// PrivateLinkResource - Represents private link resource. +type PrivateLinkResource struct { + // The resource-specific properties for this resource. + Properties *PrivateLinkResourceProperties - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // READ-ONLY; The private link name. + 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 +} + +// PrivateLinkResourceListResult - The response of a PrivateLinkResource list operation. +type PrivateLinkResourceListResult struct { + // REQUIRED; The PrivateLinkResource items on this page + Value []*PrivateLinkResource + + // The link to the next page of items + NextLink *string +} + +// PrivateLinkResourceProperties - Represents private link resource properties. +type PrivateLinkResourceProperties struct { + // Gets or sets the group id. + GroupID *string + + // Gets or sets the required member. This translates to how many Private IPs should be created for each privately linkable + // resource. + RequiredMembers []*string + + // Gets or sets the private DNS zone names. + RequiredZoneNames []*string + + // READ-ONLY; Gets or sets the provisioning state of the private link resource. + ProvisioningState *ProvisioningState +} + +// PrivateLinkServiceConnection - Represents of an NRP private link service connection. +type PrivateLinkServiceConnection struct { + // Gets or sets group ids. + GroupIDs []*string + + // Gets or sets private link service connection name. + Name *string + + // Gets or sets the request message for the private link service connection. + RequestMessage *string +} + +// PrivateLinkServiceConnectionState - Represents Private link service connection state. +type PrivateLinkServiceConnectionState struct { + // Gets or sets actions required. + ActionsRequired *string + + // Gets or sets description. + Description *string + + // Gets or sets the status. + Status *PrivateEndpointConnectionStatus +} + +// PrivateLinkServiceProxy - Represents NRP private link service proxy. +type PrivateLinkServiceProxy struct { + // Gets or sets group connectivity information. + GroupConnectivityInformation []*GroupConnectivityInformation + + // Gets or sets private link service proxy id. + ID *string + + // Represent remote private endpoint connection. + RemotePrivateEndpointConnection *RemotePrivateEndpointConnection + + // Represents Private link service connection state. + RemotePrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState } // ProtectedItemDynamicMemoryConfig - Protected item dynamic memory config. @@ -1214,36 +1504,51 @@ type ProtectedItemDynamicMemoryConfig struct { TargetMemoryBufferPercentage *int32 } -// ProtectedItemModel - Protected item model. -type ProtectedItemModel struct { - // REQUIRED; Protected item model properties. - Properties *ProtectedItemModelProperties +// ProtectedItemJobProperties - Protected item job properties. +type ProtectedItemJobProperties struct { + // READ-ONLY; Gets or sets the job friendly display name. + DisplayName *string - // READ-ONLY; Gets or sets the Id of the resource. + // READ-ONLY; Gets or sets end time of the job. + EndTime *time.Time + + // READ-ONLY; Gets or sets job Id. ID *string - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; Gets or sets job name. Name *string - // READ-ONLY - SystemData *ProtectedItemModelSystemData + // READ-ONLY; Gets or sets protection scenario name. + ScenarioName *string - // READ-ONLY; Gets or sets the type of the resource. - Type *string + // READ-ONLY; Gets or sets start time of the job. + StartTime *time.Time + + // READ-ONLY; Gets or sets job state. + State *string } -// ProtectedItemModelCollection - Protected item model collection. -type ProtectedItemModelCollection struct { - // Gets or sets the value of next link. - NextLink *string +// ProtectedItemModel - Protected item model. +type ProtectedItemModel struct { + // The resource-specific properties for this resource. + Properties *ProtectedItemModelProperties - // Gets or sets the list of protected items. - Value []*ProtectedItemModel + // READ-ONLY; The protected item name. + 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 } // ProtectedItemModelCustomProperties - Protected item model custom properties. type ProtectedItemModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for ProtectedItemModelCustomProperties. InstanceType *string } @@ -1253,6 +1558,27 @@ func (p *ProtectedItemModelCustomProperties) GetProtectedItemModelCustomProperti return p } +// ProtectedItemModelCustomPropertiesUpdate - Protected item model custom properties. +type ProtectedItemModelCustomPropertiesUpdate struct { + // REQUIRED; Discriminator property for ProtectedItemModelCustomPropertiesUpdate. + InstanceType *string +} + +// GetProtectedItemModelCustomPropertiesUpdate implements the ProtectedItemModelCustomPropertiesUpdateClassification interface +// for type ProtectedItemModelCustomPropertiesUpdate. +func (p *ProtectedItemModelCustomPropertiesUpdate) GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate { + return p +} + +// ProtectedItemModelListResult - The response of a ProtectedItemModel list operation. +type ProtectedItemModelListResult struct { + // REQUIRED; The ProtectedItemModel items on this page + Value []*ProtectedItemModel + + // The link to the next page of items + NextLink *string +} + // ProtectedItemModelProperties - Protected item model properties. type ProtectedItemModelProperties struct { // REQUIRED; Protected item model custom properties. @@ -1270,11 +1596,11 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the protected item correlation Id. CorrelationID *string - // READ-ONLY - CurrentJob *ProtectedItemModelPropertiesCurrentJob + // READ-ONLY; Gets or sets the current scenario. + CurrentJob *ProtectedItemJobProperties - // READ-ONLY; Gets or sets the DRA Id. - DraID *string + // READ-ONLY; Gets or sets the fabric agent Id. + FabricAgentID *string // READ-ONLY; Gets or sets the fabric Id. FabricID *string @@ -1288,11 +1614,11 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the list of health errors. HealthErrors []*HealthErrorModel - // READ-ONLY - LastFailedEnableProtectionJob *ProtectedItemModelPropertiesLastFailedEnableProtectionJob + // READ-ONLY; Gets or sets the last failed enabled protection job. + LastFailedEnableProtectionJob *ProtectedItemJobProperties - // READ-ONLY - LastFailedPlannedFailoverJob *ProtectedItemModelPropertiesLastFailedPlannedFailoverJob + // READ-ONLY; Gets or sets the last failed planned failover job. + LastFailedPlannedFailoverJob *ProtectedItemJobProperties // READ-ONLY; Gets or sets the Last successful planned failover time. LastSuccessfulPlannedFailoverTime *time.Time @@ -1303,8 +1629,8 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the Last successful unplanned failover time. LastSuccessfulUnplannedFailoverTime *time.Time - // READ-ONLY - LastTestFailoverJob *ProtectedItemModelPropertiesLastTestFailoverJob + // READ-ONLY; Gets or sets the last test failover job. + LastTestFailoverJob *ProtectedItemJobProperties // READ-ONLY; Gets or sets the protection state. ProtectionState *ProtectionState @@ -1312,7 +1638,7 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the protection state description. ProtectionStateDescription *string - // READ-ONLY; Gets or sets the provisioning state of the Dra. + // READ-ONLY; Gets or sets the provisioning state of the fabric agent. ProvisioningState *ProvisioningState // READ-ONLY; Gets or sets protected item replication health. @@ -1327,8 +1653,8 @@ type ProtectedItemModelProperties struct { // READ-ONLY; Gets or sets the source fabric provider Id. SourceFabricProviderID *string - // READ-ONLY; Gets or sets the target DRA Id. - TargetDraID *string + // READ-ONLY; Gets or sets the target fabric agent Id. + TargetFabricAgentID *string // READ-ONLY; Gets or sets the target fabric Id. TargetFabricID *string @@ -1343,148 +1669,51 @@ type ProtectedItemModelProperties struct { TestFailoverStateDescription *string } -type ProtectedItemModelPropertiesCurrentJob struct { - // READ-ONLY; Gets or sets the workflow friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets end time of the workflow. - EndTime *time.Time - - // READ-ONLY; Gets or sets workflow Id. - ID *string - - // READ-ONLY; Gets or sets workflow name. - Name *string - - // READ-ONLY; Gets or sets protection scenario name. - ScenarioName *string - - // READ-ONLY; Gets or sets start time of the workflow. - StartTime *time.Time - - // READ-ONLY; Gets or sets workflow state. - State *string -} - -type ProtectedItemModelPropertiesLastFailedEnableProtectionJob struct { - // READ-ONLY; Gets or sets the workflow friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets end time of the workflow. - EndTime *time.Time - - // READ-ONLY; Gets or sets workflow Id. - ID *string - - // READ-ONLY; Gets or sets workflow name. - Name *string - - // READ-ONLY; Gets or sets protection scenario name. - ScenarioName *string - - // READ-ONLY; Gets or sets start time of the workflow. - StartTime *time.Time - - // READ-ONLY; Gets or sets workflow state. - State *string -} - -type ProtectedItemModelPropertiesLastFailedPlannedFailoverJob struct { - // READ-ONLY; Gets or sets the workflow friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets end time of the workflow. - EndTime *time.Time - - // READ-ONLY; Gets or sets workflow Id. - ID *string - - // READ-ONLY; Gets or sets workflow name. - Name *string - - // READ-ONLY; Gets or sets protection scenario name. - ScenarioName *string - - // READ-ONLY; Gets or sets start time of the workflow. - StartTime *time.Time - - // READ-ONLY; Gets or sets workflow state. - State *string +// ProtectedItemModelPropertiesUpdate - Protected item model properties update. +type ProtectedItemModelPropertiesUpdate struct { + // Protected item model custom properties update. + CustomProperties ProtectedItemModelCustomPropertiesUpdateClassification } -type ProtectedItemModelPropertiesLastTestFailoverJob struct { - // READ-ONLY; Gets or sets the workflow friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets end time of the workflow. - EndTime *time.Time +// ProtectedItemModelUpdate - Protected item model update. +type ProtectedItemModelUpdate struct { + // Protected item model properties. + Properties *ProtectedItemModelPropertiesUpdate - // READ-ONLY; Gets or sets workflow Id. + // READ-ONLY; Gets or sets the Id of the resource. ID *string - // READ-ONLY; Gets or sets workflow name. + // READ-ONLY; Gets or sets the name of the resource. Name *string - // READ-ONLY; Gets or sets protection scenario name. - ScenarioName *string - - // READ-ONLY; Gets or sets start time of the workflow. - StartTime *time.Time + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData - // READ-ONLY; Gets or sets workflow state. - State *string -} - -type ProtectedItemModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string + // READ-ONLY; Gets or sets the type of the resource. + Type *string } // RecoveryPointModel - Recovery point model. type RecoveryPointModel struct { - // REQUIRED; Recovery point model properties. + // The resource-specific properties for this resource. Properties *RecoveryPointModelProperties - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The recovery point name. Name *string - // READ-ONLY - SystemData *RecoveryPointModelSystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string -// RecoveryPointModelCollection - Recovery point model collection. -type RecoveryPointModelCollection struct { - // Gets or sets the value of next link. - NextLink *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Gets or sets the list of recovery points. - Value []*RecoveryPointModel + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // RecoveryPointModelCustomProperties - Recovery point model custom properties. type RecoveryPointModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for RecoveryPointModelCustomProperties. InstanceType *string } @@ -1494,6 +1723,15 @@ func (r *RecoveryPointModelCustomProperties) GetRecoveryPointModelCustomProperti return r } +// RecoveryPointModelListResult - The response of a RecoveryPointModel list operation. +type RecoveryPointModelListResult struct { + // REQUIRED; The RecoveryPointModel items on this page + Value []*RecoveryPointModel + + // The link to the next page of items + NextLink *string +} + // RecoveryPointModelProperties - Recovery point model properties. type RecoveryPointModelProperties struct { // REQUIRED; Recovery point model custom properties. @@ -1504,58 +1742,56 @@ type RecoveryPointModelProperties struct { // REQUIRED; Gets or sets the recovery point type. RecoveryPointType *RecoveryPointType + + // READ-ONLY; Gets or sets the provisioning state of the recovery point item. + ProvisioningState *ProvisioningState } -type RecoveryPointModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time +// RemotePrivateEndpoint - Represent remote private endpoint information for the private endpoint connection proxy. +type RemotePrivateEndpoint struct { + // REQUIRED; Gets or sets private link service proxy id. + ID *string - // Gets or sets identity that created the resource. - CreatedBy *string + // Gets or sets the list of Connection Details. This is the connection details for private endpoint. + ConnectionDetails []*ConnectionDetails - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string + // Gets or sets the list of Manual Private Link Service Connections and gets populated for Manual approval flow. + ManualPrivateLinkServiceConnections []*PrivateLinkServiceConnection - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time + // Gets or sets the list of Private Link Service Connections and gets populated for Auto approval flow. + PrivateLinkServiceConnections []*PrivateLinkServiceConnection - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string + // Gets or sets the list of private link service proxies. + PrivateLinkServiceProxies []*PrivateLinkServiceProxy +} - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string +// RemotePrivateEndpointConnection - Represent remote private endpoint connection. +type RemotePrivateEndpointConnection struct { + // Gets or sets the remote private endpoint connection id. + ID *string } // ReplicationExtensionModel - Replication extension model. type ReplicationExtensionModel struct { - // REQUIRED; Replication extension model properties. + // The resource-specific properties for this resource. Properties *ReplicationExtensionModelProperties - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. + // READ-ONLY; The replication extension name. Name *string - // READ-ONLY - SystemData *ReplicationExtensionModelSystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string -// ReplicationExtensionModelCollection - Replication extension model collection. -type ReplicationExtensionModelCollection struct { - // Gets or sets the value of next link. - NextLink *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // Gets or sets the list of replication extensions. - Value []*ReplicationExtensionModel + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // ReplicationExtensionModelCustomProperties - Replication extension model custom properties. type ReplicationExtensionModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // REQUIRED; Discriminator property for ReplicationExtensionModelCustomProperties. InstanceType *string } @@ -1565,6 +1801,15 @@ func (r *ReplicationExtensionModelCustomProperties) GetReplicationExtensionModel return r } +// ReplicationExtensionModelListResult - The response of a ReplicationExtensionModel list operation. +type ReplicationExtensionModelListResult struct { + // REQUIRED; The ReplicationExtensionModel items on this page + Value []*ReplicationExtensionModel + + // The link to the next page of items + NextLink *string +} + // ReplicationExtensionModelProperties - Replication extension model properties. type ReplicationExtensionModelProperties struct { // REQUIRED; Replication extension model custom properties. @@ -1574,39 +1819,40 @@ type ReplicationExtensionModelProperties struct { ProvisioningState *ProvisioningState } -type ReplicationExtensionModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). +// StorageContainerProperties - Storage container properties. +type StorageContainerProperties struct { + // REQUIRED; Gets or sets the ClusterSharedVolumePath. + ClusterSharedVolumePath *string + + // REQUIRED; Gets or sets the Name. + Name *string +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). CreatedAt *time.Time - // Gets or sets identity that created the resource. + // The identity that created the resource. CreatedBy *string - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string + // The type of identity that created the resource. + CreatedByType *CreatedByType - // Gets or sets the timestamp of resource last modification (UTC). + // The timestamp of resource last modification (UTC) LastModifiedAt *time.Time - // Gets or sets the identity that last modified the resource. + // The identity that last modified the resource. LastModifiedBy *string - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} - -// StorageContainerProperties - Storage container properties. -type StorageContainerProperties struct { - // REQUIRED; Gets or sets the ClusterSharedVolumePath. - ClusterSharedVolumePath *string - - // REQUIRED; Gets or sets the Name. - Name *string + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType } // TaskModel - Task model. type TaskModel struct { - // Gets or sets the list of children workflow models. - ChildrenWorkflows []*WorkflowModel + // Gets or sets the list of children job models. + ChildrenJobs []*JobModel // Task model custom properties. CustomProperties *TaskModelCustomProperties @@ -1630,68 +1876,79 @@ type TaskModelCustomProperties struct { InstanceType *string } -// TestFailoverCleanupWorkflowModelCustomProperties - Test failover cleanup workflow model custom properties. -type TestFailoverCleanupWorkflowModelCustomProperties struct { +// TestFailoverCleanupJobModelCustomProperties - Test failover cleanup job model custom properties. +type TestFailoverCleanupJobModelCustomProperties struct { // REQUIRED; Gets or sets the instance type. InstanceType *string // READ-ONLY; Gets or sets any custom properties of the affected object. - AffectedObjectDetails map[string]*string + AffectedObjectDetails *JobModelCustomPropertiesAffectedObjectDetails // READ-ONLY; Gets or sets the test failover cleanup comments. Comments *string } -// GetWorkflowModelCustomProperties implements the WorkflowModelCustomPropertiesClassification interface for type TestFailoverCleanupWorkflowModelCustomProperties. -func (t *TestFailoverCleanupWorkflowModelCustomProperties) GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties { - return &WorkflowModelCustomProperties{ +// GetJobModelCustomProperties implements the JobModelCustomPropertiesClassification interface for type TestFailoverCleanupJobModelCustomProperties. +func (t *TestFailoverCleanupJobModelCustomProperties) GetJobModelCustomProperties() *JobModelCustomProperties { + return &JobModelCustomProperties{ AffectedObjectDetails: t.AffectedObjectDetails, InstanceType: t.InstanceType, } } -// TestFailoverWorkflowModelCustomProperties - Test failover workflow model custom properties. -type TestFailoverWorkflowModelCustomProperties struct { +// TestFailoverJobModelCustomProperties - Test failover job model custom properties. +type TestFailoverJobModelCustomProperties struct { // REQUIRED; Gets or sets the instance type. InstanceType *string // READ-ONLY; Gets or sets any custom properties of the affected object. - AffectedObjectDetails map[string]*string + AffectedObjectDetails *JobModelCustomPropertiesAffectedObjectDetails // READ-ONLY; Gets or sets the test VM details. ProtectedItemDetails []*FailoverProtectedItemProperties } -// GetWorkflowModelCustomProperties implements the WorkflowModelCustomPropertiesClassification interface for type TestFailoverWorkflowModelCustomProperties. -func (t *TestFailoverWorkflowModelCustomProperties) GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties { - return &WorkflowModelCustomProperties{ +// GetJobModelCustomProperties implements the JobModelCustomPropertiesClassification interface for type TestFailoverJobModelCustomProperties. +func (t *TestFailoverJobModelCustomProperties) GetJobModelCustomProperties() *JobModelCustomProperties { + return &JobModelCustomProperties{ AffectedObjectDetails: t.AffectedObjectDetails, InstanceType: t.InstanceType, } } -// VMwareDraModelCustomProperties - VMware DRA model custom properties. -type VMwareDraModelCustomProperties struct { - // REQUIRED; Gets or sets the BIOS Id of the DRA machine. +// UserAssignedIdentity - User assigned identity properties +type UserAssignedIdentity struct { + // READ-ONLY; The client ID of the assigned identity. + ClientID *string + + // READ-ONLY; The principal ID of the assigned identity. + PrincipalID *string +} + +// VMwareFabricAgentModelCustomProperties - VMware fabric agent model custom properties. +type VMwareFabricAgentModelCustomProperties struct { + // REQUIRED; Gets or sets the BIOS Id of the fabric agent machine. BiosID *string - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMware", any specified value is ignored. InstanceType *string // REQUIRED; Identity model. MarsAuthenticationIdentity *IdentityModel } -// GetDraModelCustomProperties implements the DraModelCustomPropertiesClassification interface for type VMwareDraModelCustomProperties. -func (v *VMwareDraModelCustomProperties) GetDraModelCustomProperties() *DraModelCustomProperties { - return &DraModelCustomProperties{ +// GetFabricAgentModelCustomProperties implements the FabricAgentModelCustomPropertiesClassification interface for type VMwareFabricAgentModelCustomProperties. +func (v *VMwareFabricAgentModelCustomProperties) GetFabricAgentModelCustomProperties() *FabricAgentModelCustomProperties { + return &FabricAgentModelCustomProperties{ InstanceType: v.InstanceType, } } // VMwareMigrateFabricModelCustomProperties - VMware migrate fabric model custom properties. type VMwareMigrateFabricModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMwareMigrate", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the ARM Id of the migration solution. @@ -1722,6 +1979,21 @@ type VMwareToAzStackHCIDiskInput struct { // REQUIRED; Gets or sets a value indicating whether disk is os disk. IsOsDisk *bool + // Gets or sets a value of disk block size. + DiskBlockSize *int64 + + // Disk controller. + DiskController *DiskControllerInputs + + // Gets or sets a value of disk identifier. + DiskIdentifier *string + + // Gets or sets a value of disk logical sector size. + DiskLogicalSectorSize *int64 + + // Gets or sets a value of disk physical sector size. + DiskPhysicalSectorSize *int64 + // Gets or sets a value indicating whether dynamic sizing is enabled on the virtual hard disk. IsDynamic *bool @@ -1729,6 +2001,35 @@ type VMwareToAzStackHCIDiskInput struct { StorageContainerID *string } +// VMwareToAzStackHCIEventModelCustomProperties - VMware to AzStackHCI event model custom properties. This class provides +// provider specific details for events of type DataContract.HealthEvents.HealthEventType.ProtectedItemHealth and DataContract.HealthEvents.HealthEventType.AgentHealth. +type VMwareToAzStackHCIEventModelCustomProperties struct { + // REQUIRED; Gets or sets the instance type. + InstanceType *string + + // READ-ONLY; Gets or sets the friendly name of the source which has raised this health event. + EventSourceFriendlyName *string + + // READ-ONLY; Gets or sets the protected item friendly name. + ProtectedItemFriendlyName *string + + // READ-ONLY; Gets or sets the server type. + ServerType *string + + // READ-ONLY; Gets or sets the source appliance name. + SourceApplianceName *string + + // READ-ONLY; Gets or sets the source target name. + TargetApplianceName *string +} + +// GetEventModelCustomProperties implements the EventModelCustomPropertiesClassification interface for type VMwareToAzStackHCIEventModelCustomProperties. +func (v *VMwareToAzStackHCIEventModelCustomProperties) GetEventModelCustomProperties() *EventModelCustomProperties { + return &EventModelCustomProperties{ + InstanceType: v.InstanceType, + } +} + // VMwareToAzStackHCINicInput - VMwareToAzStackHCI NIC properties. type VMwareToAzStackHCINicInput struct { // REQUIRED; Gets or sets the NIC label. @@ -1740,10 +2041,16 @@ type VMwareToAzStackHCINicInput struct { // REQUIRED; Gets or sets the selection type of the NIC. SelectionTypeForFailover *VMNicSelection - // REQUIRED; Gets or sets the target network Id within AzStackHCI Cluster. + // Gets or sets a value indicating whether mac address migration is enabled. + IsMacMigrationEnabled *bool + + // Gets or sets a value indicating whether static ip migration is enabled. + IsStaticIPMigrationEnabled *bool + + // Gets or sets the target network Id within AzStackHCI Cluster. TargetNetworkID *string - // REQUIRED; Gets or sets the target test network Id within AzStackHCI Cluster. + // Gets or sets the target test network Id within AzStackHCI Cluster. TestNetworkID *string // READ-ONLY; Gets or sets the network name. @@ -1752,7 +2059,8 @@ type VMwareToAzStackHCINicInput struct { // VMwareToAzStackHCIPlannedFailoverModelCustomProperties - VMware to AzStackHCI planned failover model custom properties. type VMwareToAzStackHCIPlannedFailoverModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMwareToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets a value indicating whether VM needs to be shut down. @@ -1775,7 +2083,8 @@ type VMwareToAzStackHCIPolicyModelCustomProperties struct { // REQUIRED; Gets or sets the crash consistent snapshot frequency (in minutes). CrashConsistentFrequencyInMinutes *int32 - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMwareToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the duration in minutes until which the recovery points need to be stored. @@ -1794,6 +2103,15 @@ type VMwareToAzStackHCIProtectedDiskProperties struct { // READ-ONLY; Gets or sets the disk capacity in bytes. CapacityInBytes *int64 + // READ-ONLY; Gets or sets a value of disk block size. + DiskBlockSize *int64 + + // READ-ONLY; Gets or sets a value of disk logical sector size. + DiskLogicalSectorSize *int64 + + // READ-ONLY; Gets or sets a value of disk physical sector size. + DiskPhysicalSectorSize *int64 + // READ-ONLY; Gets or sets the disk type. DiskType *string @@ -1839,7 +2157,8 @@ type VMwareToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the hypervisor generation of the virtual machine possible values are 1,2. HyperVGeneration *string - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMwareToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the list of VM NIC to replicate. @@ -1848,8 +2167,8 @@ type VMwareToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the run as account Id. RunAsAccountID *string - // REQUIRED; Gets or sets the source DRA name. - SourceDraName *string + // REQUIRED; Gets or sets the source fabric agent name. + SourceFabricAgentName *string // REQUIRED; Gets or sets the target storage container ARM Id. StorageContainerID *string @@ -1857,8 +2176,8 @@ type VMwareToAzStackHCIProtectedItemModelCustomProperties struct { // REQUIRED; Gets or sets the Target Arc Cluster Custom Location ARM Id. TargetArcClusterCustomLocationID *string - // REQUIRED; Gets or sets the target DRA name. - TargetDraName *string + // REQUIRED; Gets or sets the target fabric agent name. + TargetFabricAgentName *string // REQUIRED; Gets or sets the Target HCI Cluster ARM Id. TargetHciClusterID *string @@ -1979,6 +2298,39 @@ func (v *VMwareToAzStackHCIProtectedItemModelCustomProperties) GetProtectedItemM } } +// VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate - VMware to AzStackHCI Protected item model custom properties. +type VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate struct { + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMwareToAzStackHCI", any specified value is ignored. + InstanceType *string + + // Protected item dynamic memory config. + DynamicMemoryConfig *ProtectedItemDynamicMemoryConfig + + // Gets or sets a value indicating whether memory is dynamical. + IsDynamicRAM *bool + + // Gets or sets the list of VM NIC to replicate. + NicsToInclude []*VMwareToAzStackHCINicInput + + // Gets or sets the type of the OS. + OSType *string + + // Gets or sets the target CPU cores. + TargetCPUCores *int32 + + // Gets or sets the target memory in mega-bytes. + TargetMemoryInMegaBytes *int32 +} + +// GetProtectedItemModelCustomPropertiesUpdate implements the ProtectedItemModelCustomPropertiesUpdateClassification interface +// for type VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (v *VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate) GetProtectedItemModelCustomPropertiesUpdate() *ProtectedItemModelCustomPropertiesUpdate { + return &ProtectedItemModelCustomPropertiesUpdate{ + InstanceType: v.InstanceType, + } +} + // VMwareToAzStackHCIProtectedNicProperties - VMwareToAzStackHCI NIC properties. type VMwareToAzStackHCIProtectedNicProperties struct { // Gets or sets a value indicating whether this is the primary NIC. @@ -2006,12 +2358,30 @@ type VMwareToAzStackHCIProtectedNicProperties struct { TestNetworkID *string } +// VMwareToAzStackHCIRecoveryPointModelCustomProperties - VMware to AzStackHCI recovery point model custom properties. +type VMwareToAzStackHCIRecoveryPointModelCustomProperties struct { + // REQUIRED; Gets or sets the instance type. + InstanceType *string + + // READ-ONLY; Gets or sets the list of the disk Ids. + DiskIDs []*string +} + +// GetRecoveryPointModelCustomProperties implements the RecoveryPointModelCustomPropertiesClassification interface for type +// VMwareToAzStackHCIRecoveryPointModelCustomProperties. +func (v *VMwareToAzStackHCIRecoveryPointModelCustomProperties) GetRecoveryPointModelCustomProperties() *RecoveryPointModelCustomProperties { + return &RecoveryPointModelCustomProperties{ + InstanceType: v.InstanceType, + } +} + // VMwareToAzStackHCIReplicationExtensionModelCustomProperties - VMware to AzStackHCI Replication extension model custom properties. type VMwareToAzStackHCIReplicationExtensionModelCustomProperties struct { // REQUIRED; Gets or sets the ARM Id of the target AzStackHCI fabric. AzStackHciFabricArmID *string - // REQUIRED; Gets or sets the instance type. + // CONSTANT; Gets or sets the instance type. + // Field has constant value "VMwareToAzStackHCI", any specified value is ignored. InstanceType *string // REQUIRED; Gets or sets the ARM Id of the source VMware fabric. @@ -2068,37 +2438,54 @@ func (v *VMwareToAzStackHCIReplicationExtensionModelCustomProperties) GetReplica } } +// VaultIdentityModel - Vault model. +type VaultIdentityModel struct { + // REQUIRED; Gets or sets the identityType which can be either SystemAssigned or None. + Type *VaultIdentityType + + // READ-ONLY; Gets or sets the object ID of the service principal object for the managed identity that is used to grant role-based + // access to an Azure resource. + PrincipalID *string + + // READ-ONLY; Gets or sets a Globally Unique Identifier (GUID) that represents the Azure AD tenant where the resource is now + // a member. + TenantID *string +} + // VaultModel - Vault model. type VaultModel struct { - // REQUIRED; Gets or sets the location of the vault. + // REQUIRED; The geo-location where the resource lives Location *string - // Vault properties. + // READ-ONLY; The vault name. + Name *string + + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + + // The resource-specific properties for this resource. Properties *VaultModelProperties - // Gets or sets the resource tags. + // Resource tags. Tags map[string]*string - // READ-ONLY; Gets or sets the Id of the resource. + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Gets or sets the name of the resource. - Name *string - - // READ-ONLY - SystemData *VaultModelSystemData + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; Gets or sets the type of the resource. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// VaultModelCollection - Vault model collection. -type VaultModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of vaults. +// VaultModelListResult - The response of a VaultModel list operation. +type VaultModelListResult struct { + // REQUIRED; The VaultModel items on this page Value []*VaultModel + + // The link to the next page of items + NextLink *string } // VaultModelProperties - Vault properties. @@ -2113,28 +2500,11 @@ type VaultModelProperties struct { ServiceResourceID *string } -type VaultModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} - -// VaultModelUpdate - Vault model for update. +// VaultModelUpdate - Vault model update. type VaultModelUpdate struct { + // Vault identity. + Identity *VaultIdentityModel + // Vault properties. Properties *VaultModelProperties @@ -2147,144 +2517,9 @@ type VaultModelUpdate struct { // READ-ONLY; Gets or sets the name of the resource. Name *string - // READ-ONLY - SystemData *VaultModelUpdateSystemData - - // READ-ONLY; Gets or sets the type of the resource. - Type *string -} - -type VaultModelUpdateSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} - -// WorkflowModel - Workflow model. -type WorkflowModel struct { - // REQUIRED; Workflow model properties. - Properties *WorkflowModelProperties - - // READ-ONLY; Gets or sets the Id of the resource. - ID *string - - // READ-ONLY; Gets or sets the name of the resource. - Name *string - - // READ-ONLY - SystemData *WorkflowModelSystemData + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData // READ-ONLY; Gets or sets the type of the resource. Type *string } - -// WorkflowModelCollection - Workflow model collection. -type WorkflowModelCollection struct { - // Gets or sets the value of next link. - NextLink *string - - // Gets or sets the list of workflows. - Value []*WorkflowModel -} - -// WorkflowModelCustomProperties - Workflow model custom properties. -type WorkflowModelCustomProperties struct { - // REQUIRED; Gets or sets the instance type. - InstanceType *string - - // READ-ONLY; Gets or sets any custom properties of the affected object. - AffectedObjectDetails map[string]*string -} - -// GetWorkflowModelCustomProperties implements the WorkflowModelCustomPropertiesClassification interface for type WorkflowModelCustomProperties. -func (w *WorkflowModelCustomProperties) GetWorkflowModelCustomProperties() *WorkflowModelCustomProperties { - return w -} - -// WorkflowModelProperties - Workflow model properties. -type WorkflowModelProperties struct { - // REQUIRED; Workflow model custom properties. - CustomProperties WorkflowModelCustomPropertiesClassification - - // READ-ONLY; Gets or sets the workflow activity id. - ActivityID *string - - // READ-ONLY; Gets or sets the list of allowed actions on the workflow. - AllowedActions []*string - - // READ-ONLY; Gets or sets the friendly display name. - DisplayName *string - - // READ-ONLY; Gets or sets the end time. - EndTime *time.Time - - // READ-ONLY; Gets or sets the list of errors. - Errors []*ErrorModel - - // READ-ONLY; Gets or sets the affected object Id. - ObjectID *string - - // READ-ONLY; Gets or sets the affected object internal Id. - ObjectInternalID *string - - // READ-ONLY; Gets or sets the affected object internal name. - ObjectInternalName *string - - // READ-ONLY; Gets or sets the affected object name. - ObjectName *string - - // READ-ONLY; Gets or sets the object type. - ObjectType *WorkflowObjectType - - // READ-ONLY; Gets or sets the replication provider. - ReplicationProviderID *string - - // READ-ONLY; Gets or sets the source fabric provider. - SourceFabricProviderID *string - - // READ-ONLY; Gets or sets the start time. - StartTime *time.Time - - // READ-ONLY; Gets or sets the workflow state. - State *WorkflowState - - // READ-ONLY; Gets or sets the target fabric provider. - TargetFabricProviderID *string - - // READ-ONLY; Gets or sets the list of tasks. - Tasks []*TaskModel -} - -type WorkflowModelSystemData struct { - // Gets or sets the timestamp of resource creation (UTC). - CreatedAt *time.Time - - // Gets or sets identity that created the resource. - CreatedBy *string - - // Gets or sets the type of identity that created the resource: user, application, managedIdentity. - CreatedByType *string - - // Gets or sets the timestamp of resource last modification (UTC). - LastModifiedAt *time.Time - - // Gets or sets the identity that last modified the resource. - LastModifiedBy *string - - // Gets or sets the type of identity that last modified the resource: user, application, managedIdentity. - LastModifiedByType *string -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models_serde.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models_serde.go index e3fabf49a712..f6dc83d4ade9 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/models_serde.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 armrecoveryservicesdatareplication @@ -175,45 +171,58 @@ func (c *CheckNameAvailabilityResponseModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DeploymentPreflightModel. -func (d DeploymentPreflightModel) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConnectionDetails. +func (c ConnectionDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resources", d.Resources) + populate(objectMap, "groupId", c.GroupID) + populate(objectMap, "id", c.ID) + populate(objectMap, "linkIdentifier", c.LinkIdentifier) + populate(objectMap, "memberName", c.MemberName) + populate(objectMap, "privateIpAddress", c.PrivateIPAddress) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPreflightModel. -func (d *DeploymentPreflightModel) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionDetails. +func (c *ConnectionDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } for key, val := range rawMsg { var err error switch key { - case "resources": - err = unpopulate(val, "Resources", &d.Resources) + case "groupId": + err = unpopulate(val, "GroupID", &c.GroupID) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "linkIdentifier": + err = unpopulate(val, "LinkIdentifier", &c.LinkIdentifier) + delete(rawMsg, key) + case "memberName": + err = unpopulate(val, "MemberName", &c.MemberName) + delete(rawMsg, key) + case "privateIpAddress": + err = unpopulate(val, "PrivateIPAddress", &c.PrivateIPAddress) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", c, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DeploymentPreflightResource. -func (d DeploymentPreflightResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentPreflightModel. +func (d DeploymentPreflightModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apiVersion", d.APIVersion) - populate(objectMap, "location", d.Location) - populate(objectMap, "name", d.Name) - populate(objectMap, "type", d.Type) + populate(objectMap, "resources", d.Resources) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPreflightResource. -func (d *DeploymentPreflightResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPreflightModel. +func (d *DeploymentPreflightModel) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -221,17 +230,8 @@ func (d *DeploymentPreflightResource) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "apiVersion": - err = unpopulate(val, "APIVersion", &d.APIVersion) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &d.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "resources": + err = unpopulate(val, "Resources", &d.Resources) delete(rawMsg, key) } if err != nil { @@ -241,19 +241,19 @@ func (d *DeploymentPreflightResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DraModel. -func (d DraModel) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DeploymentPreflightResource. +func (d DeploymentPreflightResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) + populate(objectMap, "apiVersion", d.APIVersion) + populate(objectMap, "location", d.Location) populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) + populateAny(objectMap, "properties", d.Properties) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModel. -func (d *DraModel) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentPreflightResource. +func (d *DeploymentPreflightResource) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -261,8 +261,11 @@ func (d *DraModel) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) + case "apiVersion": + err = unpopulate(val, "APIVersion", &d.APIVersion) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &d.Name) @@ -270,9 +273,6 @@ func (d *DraModel) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -284,145 +284,17 @@ func (d *DraModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DraModelCollection. -func (d DraModelCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModelCollection. -func (d *DraModelCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DraModelCustomProperties. -func (d DraModelCustomProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - objectMap["instanceType"] = d.InstanceType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModelCustomProperties. -func (d *DraModelCustomProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &d.InstanceType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DraModelProperties. -func (d DraModelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "authenticationIdentity", d.AuthenticationIdentity) - populate(objectMap, "correlationId", d.CorrelationID) - populate(objectMap, "customProperties", d.CustomProperties) - populate(objectMap, "healthErrors", d.HealthErrors) - populate(objectMap, "isResponsive", d.IsResponsive) - populateDateTimeRFC3339(objectMap, "lastHeartbeat", d.LastHeartbeat) - populate(objectMap, "machineId", d.MachineID) - populate(objectMap, "machineName", d.MachineName) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "resourceAccessIdentity", d.ResourceAccessIdentity) - populate(objectMap, "versionNumber", d.VersionNumber) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModelProperties. -func (d *DraModelProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "authenticationIdentity": - err = unpopulate(val, "AuthenticationIdentity", &d.AuthenticationIdentity) - delete(rawMsg, key) - case "correlationId": - err = unpopulate(val, "CorrelationID", &d.CorrelationID) - delete(rawMsg, key) - case "customProperties": - d.CustomProperties, err = unmarshalDraModelCustomPropertiesClassification(val) - delete(rawMsg, key) - case "healthErrors": - err = unpopulate(val, "HealthErrors", &d.HealthErrors) - delete(rawMsg, key) - case "isResponsive": - err = unpopulate(val, "IsResponsive", &d.IsResponsive) - delete(rawMsg, key) - case "lastHeartbeat": - err = unpopulateDateTimeRFC3339(val, "LastHeartbeat", &d.LastHeartbeat) - delete(rawMsg, key) - case "machineId": - err = unpopulate(val, "MachineID", &d.MachineID) - delete(rawMsg, key) - case "machineName": - err = unpopulate(val, "MachineName", &d.MachineName) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) - delete(rawMsg, key) - case "resourceAccessIdentity": - err = unpopulate(val, "ResourceAccessIdentity", &d.ResourceAccessIdentity) - delete(rawMsg, key) - case "versionNumber": - err = unpopulate(val, "VersionNumber", &d.VersionNumber) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DraModelSystemData. -func (d DraModelSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DiskControllerInputs. +func (d DiskControllerInputs) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", d.CreatedAt) - populate(objectMap, "createdBy", d.CreatedBy) - populate(objectMap, "createdByType", d.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", d.LastModifiedAt) - populate(objectMap, "lastModifiedBy", d.LastModifiedBy) - populate(objectMap, "lastModifiedByType", d.LastModifiedByType) + populate(objectMap, "controllerId", d.ControllerID) + populate(objectMap, "controllerLocation", d.ControllerLocation) + populate(objectMap, "controllerName", d.ControllerName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DraModelSystemData. -func (d *DraModelSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DiskControllerInputs. +func (d *DiskControllerInputs) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -430,23 +302,14 @@ func (d *DraModelSystemData) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &d.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &d.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &d.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &d.LastModifiedAt) + case "controllerId": + err = unpopulate(val, "ControllerID", &d.ControllerID) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &d.LastModifiedBy) + case "controllerLocation": + err = unpopulate(val, "ControllerLocation", &d.ControllerLocation) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &d.LastModifiedByType) + case "controllerName": + err = unpopulate(val, "ControllerName", &d.ControllerName) delete(rawMsg, key) } if err != nil { @@ -499,16 +362,16 @@ func (e *EmailConfigurationModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailConfigurationModelCollection. -func (e EmailConfigurationModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EmailConfigurationModelListResult. +func (e EmailConfigurationModelListResult) 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 EmailConfigurationModelCollection. -func (e *EmailConfigurationModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EmailConfigurationModelListResult. +func (e *EmailConfigurationModelListResult) UnmarshalJSON(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) @@ -535,6 +398,7 @@ func (e EmailConfigurationModelProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "customEmailAddresses", e.CustomEmailAddresses) populate(objectMap, "locale", e.Locale) + populate(objectMap, "provisioningState", e.ProvisioningState) populate(objectMap, "sendToOwners", e.SendToOwners) return json.Marshal(objectMap) } @@ -554,6 +418,9 @@ func (e *EmailConfigurationModelProperties) UnmarshalJSON(data []byte) error { case "locale": err = unpopulate(val, "Locale", &e.Locale) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) case "sendToOwners": err = unpopulate(val, "SendToOwners", &e.SendToOwners) delete(rawMsg, key) @@ -565,53 +432,6 @@ func (e *EmailConfigurationModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EmailConfigurationModelSystemData. -func (e EmailConfigurationModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", e.CreatedAt) - populate(objectMap, "createdBy", e.CreatedBy) - populate(objectMap, "createdByType", e.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", e.LastModifiedAt) - populate(objectMap, "lastModifiedBy", e.LastModifiedBy) - populate(objectMap, "lastModifiedByType", e.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EmailConfigurationModelSystemData. -func (e *EmailConfigurationModelSystemData) UnmarshalJSON(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 "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &e.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &e.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &e.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &e.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &e.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &e.LastModifiedByType) - 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 ErrorModel. func (e ErrorModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -706,16 +526,15 @@ func (e *EventModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventModelCollection. -func (e EventModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventModelCustomProperties. +func (e EventModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) + populate(objectMap, "instanceType", e.InstanceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelCollection. -func (e *EventModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelCustomProperties. +func (e *EventModelCustomProperties) UnmarshalJSON(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) @@ -723,11 +542,8 @@ func (e *EventModelCollection) UnmarshalJSON(data []byte) error { 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) + case "instanceType": + err = unpopulate(val, "InstanceType", &e.InstanceType) delete(rawMsg, key) } if err != nil { @@ -737,15 +553,16 @@ func (e *EventModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventModelCustomProperties. -func (e EventModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EventModelListResult. +func (e EventModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = e.InstanceType + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelCustomProperties. -func (e *EventModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelListResult. +func (e *EventModelListResult) UnmarshalJSON(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) @@ -753,8 +570,11 @@ func (e *EventModelCustomProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &e.InstanceType) + 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 { @@ -773,6 +593,7 @@ func (e EventModelProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "eventName", e.EventName) populate(objectMap, "eventType", e.EventType) populate(objectMap, "healthErrors", e.HealthErrors) + populate(objectMap, "provisioningState", e.ProvisioningState) populate(objectMap, "resourceName", e.ResourceName) populate(objectMap, "resourceType", e.ResourceType) populate(objectMap, "severity", e.Severity) @@ -807,6 +628,9 @@ func (e *EventModelProperties) UnmarshalJSON(data []byte) error { case "healthErrors": err = unpopulate(val, "HealthErrors", &e.HealthErrors) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) case "resourceName": err = unpopulate(val, "ResourceName", &e.ResourceName) delete(rawMsg, key) @@ -827,68 +651,19 @@ func (e *EventModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type EventModelSystemData. -func (e EventModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", e.CreatedAt) - populate(objectMap, "createdBy", e.CreatedBy) - populate(objectMap, "createdByType", e.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", e.LastModifiedAt) - populate(objectMap, "lastModifiedBy", e.LastModifiedBy) - populate(objectMap, "lastModifiedByType", e.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventModelSystemData. -func (e *EventModelSystemData) UnmarshalJSON(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 "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &e.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &e.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &e.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &e.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &e.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &e.LastModifiedByType) - 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 FabricModel. -func (f FabricModel) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FabricAgentModel. +func (f FabricAgentModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", f.ID) - populate(objectMap, "location", f.Location) populate(objectMap, "name", f.Name) populate(objectMap, "properties", f.Properties) populate(objectMap, "systemData", f.SystemData) - populate(objectMap, "tags", f.Tags) populate(objectMap, "type", f.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModel. -func (f *FabricModel) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricAgentModel. +func (f *FabricAgentModel) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) @@ -899,9 +674,6 @@ func (f *FabricModel) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &f.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &f.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &f.Name) delete(rawMsg, key) @@ -911,9 +683,6 @@ func (f *FabricModel) UnmarshalJSON(data []byte) error { case "systemData": err = unpopulate(val, "SystemData", &f.SystemData) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &f.Tags) - delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &f.Type) delete(rawMsg, key) @@ -925,16 +694,43 @@ func (f *FabricModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FabricModelCollection. -func (f FabricModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FabricAgentModelCustomProperties. +func (f FabricAgentModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "instanceType", f.InstanceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricAgentModelCustomProperties. +func (f *FabricAgentModelCustomProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "instanceType": + err = unpopulate(val, "InstanceType", &f.InstanceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FabricAgentModelListResult. +func (f FabricAgentModelListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) populate(objectMap, "value", f.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelCollection. -func (f *FabricModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricAgentModelListResult. +func (f *FabricAgentModelListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) @@ -956,10 +752,128 @@ func (f *FabricModelCollection) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type FabricAgentModelProperties. +func (f FabricAgentModelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationIdentity", f.AuthenticationIdentity) + populate(objectMap, "correlationId", f.CorrelationID) + populate(objectMap, "customProperties", f.CustomProperties) + populate(objectMap, "healthErrors", f.HealthErrors) + populate(objectMap, "isResponsive", f.IsResponsive) + populateDateTimeRFC3339(objectMap, "lastHeartbeat", f.LastHeartbeat) + populate(objectMap, "machineId", f.MachineID) + populate(objectMap, "machineName", f.MachineName) + populate(objectMap, "provisioningState", f.ProvisioningState) + populate(objectMap, "resourceAccessIdentity", f.ResourceAccessIdentity) + populate(objectMap, "versionNumber", f.VersionNumber) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricAgentModelProperties. +func (f *FabricAgentModelProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationIdentity": + err = unpopulate(val, "AuthenticationIdentity", &f.AuthenticationIdentity) + delete(rawMsg, key) + case "correlationId": + err = unpopulate(val, "CorrelationID", &f.CorrelationID) + delete(rawMsg, key) + case "customProperties": + f.CustomProperties, err = unmarshalFabricAgentModelCustomPropertiesClassification(val) + delete(rawMsg, key) + case "healthErrors": + err = unpopulate(val, "HealthErrors", &f.HealthErrors) + delete(rawMsg, key) + case "isResponsive": + err = unpopulate(val, "IsResponsive", &f.IsResponsive) + delete(rawMsg, key) + case "lastHeartbeat": + err = unpopulateDateTimeRFC3339(val, "LastHeartbeat", &f.LastHeartbeat) + delete(rawMsg, key) + case "machineId": + err = unpopulate(val, "MachineID", &f.MachineID) + delete(rawMsg, key) + case "machineName": + err = unpopulate(val, "MachineName", &f.MachineName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &f.ProvisioningState) + delete(rawMsg, key) + case "resourceAccessIdentity": + err = unpopulate(val, "ResourceAccessIdentity", &f.ResourceAccessIdentity) + delete(rawMsg, key) + case "versionNumber": + err = unpopulate(val, "VersionNumber", &f.VersionNumber) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FabricModel. +func (f FabricModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", f.ID) + populate(objectMap, "location", f.Location) + populate(objectMap, "name", f.Name) + populate(objectMap, "properties", f.Properties) + populate(objectMap, "systemData", f.SystemData) + populate(objectMap, "tags", f.Tags) + populate(objectMap, "type", f.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModel. +func (f *FabricModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &f.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &f.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &f.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &f.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &f.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &f.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &f.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type FabricModelCustomProperties. func (f FabricModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = f.InstanceType + populate(objectMap, "instanceType", f.InstanceType) return json.Marshal(objectMap) } @@ -983,6 +897,37 @@ func (f *FabricModelCustomProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type FabricModelListResult. +func (f FabricModelListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelListResult. +func (f *FabricModelListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &f.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &f.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type FabricModelProperties. func (f FabricModelProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1030,53 +975,6 @@ func (f *FabricModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FabricModelSystemData. -func (f FabricModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", f.CreatedAt) - populate(objectMap, "createdBy", f.CreatedBy) - populate(objectMap, "createdByType", f.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", f.LastModifiedAt) - populate(objectMap, "lastModifiedBy", f.LastModifiedBy) - populate(objectMap, "lastModifiedByType", f.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelSystemData. -func (f *FabricModelSystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &f.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &f.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &f.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &f.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &f.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &f.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type FabricModelUpdate. func (f FabricModelUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1124,20 +1022,17 @@ func (f *FabricModelUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FabricModelUpdateSystemData. -func (f FabricModelUpdateSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FailoverJobModelCustomProperties. +func (f FailoverJobModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", f.CreatedAt) - populate(objectMap, "createdBy", f.CreatedBy) - populate(objectMap, "createdByType", f.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", f.LastModifiedAt) - populate(objectMap, "lastModifiedBy", f.LastModifiedBy) - populate(objectMap, "lastModifiedByType", f.LastModifiedByType) + populate(objectMap, "affectedObjectDetails", f.AffectedObjectDetails) + objectMap["instanceType"] = "FailoverJobDetails" + populate(objectMap, "protectedItemDetails", f.ProtectedItemDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FabricModelUpdateSystemData. -func (f *FabricModelUpdateSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverJobModelCustomProperties. +func (f *FailoverJobModelCustomProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) @@ -1145,23 +1040,14 @@ func (f *FabricModelUpdateSystemData) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &f.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &f.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &f.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &f.LastModifiedAt) + case "affectedObjectDetails": + err = unpopulate(val, "AffectedObjectDetails", &f.AffectedObjectDetails) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &f.LastModifiedBy) + case "instanceType": + err = unpopulate(val, "InstanceType", &f.InstanceType) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &f.LastModifiedByType) + case "protectedItemDetails": + err = unpopulate(val, "ProtectedItemDetails", &f.ProtectedItemDetails) delete(rawMsg, key) } if err != nil { @@ -1222,36 +1108,48 @@ func (f *FailoverProtectedItemProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type FailoverWorkflowModelCustomProperties. -func (f FailoverWorkflowModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GroupConnectivityInformation. +func (g GroupConnectivityInformation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "affectedObjectDetails", f.AffectedObjectDetails) - objectMap["instanceType"] = "FailoverWorkflowDetails" - populate(objectMap, "protectedItemDetails", f.ProtectedItemDetails) + populate(objectMap, "customerVisibleFqdns", g.CustomerVisibleFqdns) + populate(objectMap, "groupId", g.GroupID) + populate(objectMap, "internalFqdn", g.InternalFqdn) + populate(objectMap, "memberName", g.MemberName) + populate(objectMap, "privateLinkServiceArmRegion", g.PrivateLinkServiceArmRegion) + populate(objectMap, "redirectMapId", g.RedirectMapID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type FailoverWorkflowModelCustomProperties. -func (f *FailoverWorkflowModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GroupConnectivityInformation. +func (g *GroupConnectivityInformation) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "affectedObjectDetails": - err = unpopulate(val, "AffectedObjectDetails", &f.AffectedObjectDetails) + case "customerVisibleFqdns": + err = unpopulate(val, "CustomerVisibleFqdns", &g.CustomerVisibleFqdns) delete(rawMsg, key) - case "instanceType": - err = unpopulate(val, "InstanceType", &f.InstanceType) + case "groupId": + err = unpopulate(val, "GroupID", &g.GroupID) delete(rawMsg, key) - case "protectedItemDetails": - err = unpopulate(val, "ProtectedItemDetails", &f.ProtectedItemDetails) + case "internalFqdn": + err = unpopulate(val, "InternalFqdn", &g.InternalFqdn) + delete(rawMsg, key) + case "memberName": + err = unpopulate(val, "MemberName", &g.MemberName) + delete(rawMsg, key) + case "privateLinkServiceArmRegion": + err = unpopulate(val, "PrivateLinkServiceArmRegion", &g.PrivateLinkServiceArmRegion) + delete(rawMsg, key) + case "redirectMapId": + err = unpopulate(val, "RedirectMapID", &g.RedirectMapID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil @@ -1386,8 +1284,13 @@ func (h *HyperVMigrateFabricModelCustomProperties) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCIDiskInput. func (h HyperVToAzStackHCIDiskInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "diskBlockSize", h.DiskBlockSize) + populate(objectMap, "diskController", h.DiskController) populate(objectMap, "diskFileFormat", h.DiskFileFormat) populate(objectMap, "diskId", h.DiskID) + populate(objectMap, "diskIdentifier", h.DiskIdentifier) + populate(objectMap, "diskLogicalSectorSize", h.DiskLogicalSectorSize) + populate(objectMap, "diskPhysicalSectorSize", h.DiskPhysicalSectorSize) populate(objectMap, "diskSizeGB", h.DiskSizeGB) populate(objectMap, "isDynamic", h.IsDynamic) populate(objectMap, "isOsDisk", h.IsOsDisk) @@ -1404,12 +1307,27 @@ func (h *HyperVToAzStackHCIDiskInput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "diskBlockSize": + err = unpopulate(val, "DiskBlockSize", &h.DiskBlockSize) + delete(rawMsg, key) + case "diskController": + err = unpopulate(val, "DiskController", &h.DiskController) + delete(rawMsg, key) case "diskFileFormat": err = unpopulate(val, "DiskFileFormat", &h.DiskFileFormat) delete(rawMsg, key) case "diskId": err = unpopulate(val, "DiskID", &h.DiskID) delete(rawMsg, key) + case "diskIdentifier": + err = unpopulate(val, "DiskIdentifier", &h.DiskIdentifier) + delete(rawMsg, key) + case "diskLogicalSectorSize": + err = unpopulate(val, "DiskLogicalSectorSize", &h.DiskLogicalSectorSize) + delete(rawMsg, key) + case "diskPhysicalSectorSize": + err = unpopulate(val, "DiskPhysicalSectorSize", &h.DiskPhysicalSectorSize) + delete(rawMsg, key) case "diskSizeGB": err = unpopulate(val, "DiskSizeGB", &h.DiskSizeGB) delete(rawMsg, key) @@ -1480,6 +1398,8 @@ func (h *HyperVToAzStackHCIEventModelCustomProperties) UnmarshalJSON(data []byte // MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCINicInput. func (h HyperVToAzStackHCINicInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "isMacMigrationEnabled", h.IsMacMigrationEnabled) + populate(objectMap, "isStaticIpMigrationEnabled", h.IsStaticIPMigrationEnabled) populate(objectMap, "networkName", h.NetworkName) populate(objectMap, "nicId", h.NicID) populate(objectMap, "selectionTypeForFailover", h.SelectionTypeForFailover) @@ -1497,6 +1417,12 @@ func (h *HyperVToAzStackHCINicInput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "isMacMigrationEnabled": + err = unpopulate(val, "IsMacMigrationEnabled", &h.IsMacMigrationEnabled) + delete(rawMsg, key) + case "isStaticIpMigrationEnabled": + err = unpopulate(val, "IsStaticIPMigrationEnabled", &h.IsStaticIPMigrationEnabled) + delete(rawMsg, key) case "networkName": err = unpopulate(val, "NetworkName", &h.NetworkName) delete(rawMsg, key) @@ -1594,6 +1520,9 @@ func (h *HyperVToAzStackHCIPolicyModelCustomProperties) UnmarshalJSON(data []byt func (h HyperVToAzStackHCIProtectedDiskProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "capacityInBytes", h.CapacityInBytes) + populate(objectMap, "diskBlockSize", h.DiskBlockSize) + populate(objectMap, "diskLogicalSectorSize", h.DiskLogicalSectorSize) + populate(objectMap, "diskPhysicalSectorSize", h.DiskPhysicalSectorSize) populate(objectMap, "diskType", h.DiskType) populate(objectMap, "isDynamic", h.IsDynamic) populate(objectMap, "isOsDisk", h.IsOsDisk) @@ -1619,6 +1548,15 @@ func (h *HyperVToAzStackHCIProtectedDiskProperties) UnmarshalJSON(data []byte) e case "capacityInBytes": err = unpopulate(val, "CapacityInBytes", &h.CapacityInBytes) delete(rawMsg, key) + case "diskBlockSize": + err = unpopulate(val, "DiskBlockSize", &h.DiskBlockSize) + delete(rawMsg, key) + case "diskLogicalSectorSize": + err = unpopulate(val, "DiskLogicalSectorSize", &h.DiskLogicalSectorSize) + delete(rawMsg, key) + case "diskPhysicalSectorSize": + err = unpopulate(val, "DiskPhysicalSectorSize", &h.DiskPhysicalSectorSize) + delete(rawMsg, key) case "diskType": err = unpopulate(val, "DiskType", &h.DiskType) delete(rawMsg, key) @@ -1683,7 +1621,7 @@ func (h HyperVToAzStackHCIProtectedItemModelCustomProperties) MarshalJSON() ([]b populate(objectMap, "runAsAccountId", h.RunAsAccountID) populate(objectMap, "sourceApplianceName", h.SourceApplianceName) populate(objectMap, "sourceCpuCores", h.SourceCPUCores) - populate(objectMap, "sourceDraName", h.SourceDraName) + populate(objectMap, "sourceFabricAgentName", h.SourceFabricAgentName) populate(objectMap, "sourceMemoryInMegaBytes", h.SourceMemoryInMegaBytes) populate(objectMap, "sourceVmName", h.SourceVMName) populate(objectMap, "storageContainerId", h.StorageContainerID) @@ -1691,7 +1629,7 @@ func (h HyperVToAzStackHCIProtectedItemModelCustomProperties) MarshalJSON() ([]b populate(objectMap, "targetArcClusterCustomLocationId", h.TargetArcClusterCustomLocationID) populate(objectMap, "targetAzStackHciClusterName", h.TargetAzStackHciClusterName) populate(objectMap, "targetCpuCores", h.TargetCPUCores) - populate(objectMap, "targetDraName", h.TargetDraName) + populate(objectMap, "targetFabricAgentName", h.TargetFabricAgentName) populate(objectMap, "targetHciClusterId", h.TargetHciClusterID) populate(objectMap, "targetLocation", h.TargetLocation) populate(objectMap, "targetMemoryInMegaBytes", h.TargetMemoryInMegaBytes) @@ -1781,8 +1719,8 @@ func (h *HyperVToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat case "sourceCpuCores": err = unpopulate(val, "SourceCPUCores", &h.SourceCPUCores) delete(rawMsg, key) - case "sourceDraName": - err = unpopulate(val, "SourceDraName", &h.SourceDraName) + case "sourceFabricAgentName": + err = unpopulate(val, "SourceFabricAgentName", &h.SourceFabricAgentName) delete(rawMsg, key) case "sourceMemoryInMegaBytes": err = unpopulate(val, "SourceMemoryInMegaBytes", &h.SourceMemoryInMegaBytes) @@ -1805,8 +1743,8 @@ func (h *HyperVToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat case "targetCpuCores": err = unpopulate(val, "TargetCPUCores", &h.TargetCPUCores) delete(rawMsg, key) - case "targetDraName": - err = unpopulate(val, "TargetDraName", &h.TargetDraName) + case "targetFabricAgentName": + err = unpopulate(val, "TargetFabricAgentName", &h.TargetFabricAgentName) delete(rawMsg, key) case "targetHciClusterId": err = unpopulate(val, "TargetHciClusterID", &h.TargetHciClusterID) @@ -1840,20 +1778,21 @@ func (h *HyperVToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat return nil } -// MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCIProtectedNicProperties. -func (h HyperVToAzStackHCIProtectedNicProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (h HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "macAddress", h.MacAddress) - populate(objectMap, "networkName", h.NetworkName) - populate(objectMap, "nicId", h.NicID) - populate(objectMap, "selectionTypeForFailover", h.SelectionTypeForFailover) - populate(objectMap, "targetNetworkId", h.TargetNetworkID) - populate(objectMap, "testNetworkId", h.TestNetworkID) + populate(objectMap, "dynamicMemoryConfig", h.DynamicMemoryConfig) + objectMap["instanceType"] = "HyperVToAzStackHCI" + populate(objectMap, "isDynamicRam", h.IsDynamicRAM) + populate(objectMap, "nicsToInclude", h.NicsToInclude) + populate(objectMap, "osType", h.OSType) + populate(objectMap, "targetCpuCores", h.TargetCPUCores) + populate(objectMap, "targetMemoryInMegaBytes", h.TargetMemoryInMegaBytes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type HyperVToAzStackHCIProtectedNicProperties. -func (h *HyperVToAzStackHCIProtectedNicProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (h *HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", h, err) @@ -1861,22 +1800,72 @@ func (h *HyperVToAzStackHCIProtectedNicProperties) UnmarshalJSON(data []byte) er for key, val := range rawMsg { var err error switch key { - case "macAddress": - err = unpopulate(val, "MacAddress", &h.MacAddress) + case "dynamicMemoryConfig": + err = unpopulate(val, "DynamicMemoryConfig", &h.DynamicMemoryConfig) delete(rawMsg, key) - case "networkName": - err = unpopulate(val, "NetworkName", &h.NetworkName) + case "instanceType": + err = unpopulate(val, "InstanceType", &h.InstanceType) delete(rawMsg, key) - case "nicId": - err = unpopulate(val, "NicID", &h.NicID) + case "isDynamicRam": + err = unpopulate(val, "IsDynamicRAM", &h.IsDynamicRAM) delete(rawMsg, key) - case "selectionTypeForFailover": - err = unpopulate(val, "SelectionTypeForFailover", &h.SelectionTypeForFailover) + case "nicsToInclude": + err = unpopulate(val, "NicsToInclude", &h.NicsToInclude) delete(rawMsg, key) - case "targetNetworkId": - err = unpopulate(val, "TargetNetworkID", &h.TargetNetworkID) + case "osType": + err = unpopulate(val, "OSType", &h.OSType) delete(rawMsg, key) - case "testNetworkId": + case "targetCpuCores": + err = unpopulate(val, "TargetCPUCores", &h.TargetCPUCores) + delete(rawMsg, key) + case "targetMemoryInMegaBytes": + err = unpopulate(val, "TargetMemoryInMegaBytes", &h.TargetMemoryInMegaBytes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HyperVToAzStackHCIProtectedNicProperties. +func (h HyperVToAzStackHCIProtectedNicProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "macAddress", h.MacAddress) + populate(objectMap, "networkName", h.NetworkName) + populate(objectMap, "nicId", h.NicID) + populate(objectMap, "selectionTypeForFailover", h.SelectionTypeForFailover) + populate(objectMap, "targetNetworkId", h.TargetNetworkID) + populate(objectMap, "testNetworkId", h.TestNetworkID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HyperVToAzStackHCIProtectedNicProperties. +func (h *HyperVToAzStackHCIProtectedNicProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "macAddress": + err = unpopulate(val, "MacAddress", &h.MacAddress) + delete(rawMsg, key) + case "networkName": + err = unpopulate(val, "NetworkName", &h.NetworkName) + delete(rawMsg, key) + case "nicId": + err = unpopulate(val, "NicID", &h.NicID) + delete(rawMsg, key) + case "selectionTypeForFailover": + err = unpopulate(val, "SelectionTypeForFailover", &h.SelectionTypeForFailover) + delete(rawMsg, key) + case "targetNetworkId": + err = unpopulate(val, "TargetNetworkID", &h.TargetNetworkID) + delete(rawMsg, key) + case "testNetworkId": err = unpopulate(val, "TestNetworkID", &h.TestNetworkID) delete(rawMsg, key) } @@ -2119,6 +2108,278 @@ func (i *InnerHealthErrorModel) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type JobModel. +func (j JobModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", j.ID) + populate(objectMap, "name", j.Name) + populate(objectMap, "properties", j.Properties) + populate(objectMap, "systemData", j.SystemData) + populate(objectMap, "type", j.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModel. +func (j *JobModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &j.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &j.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &j.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &j.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobModelCustomProperties. +func (j JobModelCustomProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "affectedObjectDetails", j.AffectedObjectDetails) + populate(objectMap, "instanceType", j.InstanceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModelCustomProperties. +func (j *JobModelCustomProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "affectedObjectDetails": + err = unpopulate(val, "AffectedObjectDetails", &j.AffectedObjectDetails) + delete(rawMsg, key) + case "instanceType": + err = unpopulate(val, "InstanceType", &j.InstanceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobModelCustomPropertiesAffectedObjectDetails. +func (j JobModelCustomPropertiesAffectedObjectDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", j.Description) + if j.Type != nil { + objectMap["type"] = "object" + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModelCustomPropertiesAffectedObjectDetails. +func (j *JobModelCustomPropertiesAffectedObjectDetails) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &j.Description) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobModelListResult. +func (j JobModelListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", j.NextLink) + populate(objectMap, "value", j.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModelListResult. +func (j *JobModelListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &j.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &j.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JobModelProperties. +func (j JobModelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activityId", j.ActivityID) + populate(objectMap, "allowedActions", j.AllowedActions) + populate(objectMap, "customProperties", j.CustomProperties) + populate(objectMap, "displayName", j.DisplayName) + populateDateTimeRFC3339(objectMap, "endTime", j.EndTime) + populate(objectMap, "errors", j.Errors) + populate(objectMap, "objectId", j.ObjectID) + populate(objectMap, "objectInternalId", j.ObjectInternalID) + populate(objectMap, "objectInternalName", j.ObjectInternalName) + populate(objectMap, "objectName", j.ObjectName) + populate(objectMap, "objectType", j.ObjectType) + populate(objectMap, "provisioningState", j.ProvisioningState) + populate(objectMap, "replicationProviderId", j.ReplicationProviderID) + populate(objectMap, "sourceFabricProviderId", j.SourceFabricProviderID) + populateDateTimeRFC3339(objectMap, "startTime", j.StartTime) + populate(objectMap, "state", j.State) + populate(objectMap, "targetFabricProviderId", j.TargetFabricProviderID) + populate(objectMap, "tasks", j.Tasks) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JobModelProperties. +func (j *JobModelProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "activityId": + err = unpopulate(val, "ActivityID", &j.ActivityID) + delete(rawMsg, key) + case "allowedActions": + err = unpopulate(val, "AllowedActions", &j.AllowedActions) + delete(rawMsg, key) + case "customProperties": + j.CustomProperties, err = unmarshalJobModelCustomPropertiesClassification(val) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &j.DisplayName) + delete(rawMsg, key) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &j.EndTime) + delete(rawMsg, key) + case "errors": + err = unpopulate(val, "Errors", &j.Errors) + delete(rawMsg, key) + case "objectId": + err = unpopulate(val, "ObjectID", &j.ObjectID) + delete(rawMsg, key) + case "objectInternalId": + err = unpopulate(val, "ObjectInternalID", &j.ObjectInternalID) + delete(rawMsg, key) + case "objectInternalName": + err = unpopulate(val, "ObjectInternalName", &j.ObjectInternalName) + delete(rawMsg, key) + case "objectName": + err = unpopulate(val, "ObjectName", &j.ObjectName) + delete(rawMsg, key) + case "objectType": + err = unpopulate(val, "ObjectType", &j.ObjectType) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &j.ProvisioningState) + delete(rawMsg, key) + case "replicationProviderId": + err = unpopulate(val, "ReplicationProviderID", &j.ReplicationProviderID) + delete(rawMsg, key) + case "sourceFabricProviderId": + err = unpopulate(val, "SourceFabricProviderID", &j.SourceFabricProviderID) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &j.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &j.State) + delete(rawMsg, key) + case "targetFabricProviderId": + err = unpopulate(val, "TargetFabricProviderID", &j.TargetFabricProviderID) + delete(rawMsg, key) + case "tasks": + err = unpopulate(val, "Tasks", &j.Tasks) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedServiceIdentity. +func (m ManagedServiceIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", m.PrincipalID) + populate(objectMap, "tenantId", m.TenantID) + populate(objectMap, "type", m.Type) + populate(objectMap, "userAssignedIdentities", m.UserAssignedIdentities) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedServiceIdentity. +func (m *ManagedServiceIdentity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &m.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &m.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + case "userAssignedIdentities": + err = unpopulate(val, "UserAssignedIdentities", &m.UserAssignedIdentities) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2305,7 +2566,7 @@ func (p *PlannedFailoverModel) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type PlannedFailoverModelCustomProperties. func (p PlannedFailoverModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = p.InstanceType + populate(objectMap, "instanceType", p.InstanceType) return json.Marshal(objectMap) } @@ -2399,16 +2660,15 @@ func (p *PolicyModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyModelCollection. -func (p PolicyModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyModelCustomProperties. +func (p PolicyModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "instanceType", p.InstanceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelCollection. -func (p *PolicyModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelCustomProperties. +func (p *PolicyModelCustomProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -2416,11 +2676,8 @@ func (p *PolicyModelCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "instanceType": + err = unpopulate(val, "InstanceType", &p.InstanceType) delete(rawMsg, key) } if err != nil { @@ -2430,15 +2687,16 @@ func (p *PolicyModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyModelCustomProperties. -func (p PolicyModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PolicyModelListResult. +func (p PolicyModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = p.InstanceType + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelCustomProperties. -func (p *PolicyModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelListResult. +func (p *PolicyModelListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -2446,8 +2704,11 @@ func (p *PolicyModelCustomProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &p.InstanceType) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { @@ -2488,20 +2749,15 @@ func (p *PolicyModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PolicyModelSystemData. -func (p PolicyModelSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", p.CreatedAt) - populate(objectMap, "createdBy", p.CreatedBy) - populate(objectMap, "createdByType", p.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", p.LastModifiedAt) - populate(objectMap, "lastModifiedBy", p.LastModifiedBy) - populate(objectMap, "lastModifiedByType", p.LastModifiedByType) + populate(objectMap, "id", p.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PolicyModelSystemData. -func (p *PolicyModelSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -2509,23 +2765,448 @@ func (p *PolicyModelSystemData) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &p.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &p.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &p.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &p.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &p.LastModifiedBy) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &p.LastModifiedByType) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProxy. +func (p PrivateEndpointConnectionProxy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProxy. +func (p *PrivateEndpointConnectionProxy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProxyListResult. +func (p PrivateEndpointConnectionProxyListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProxyListResult. +func (p *PrivateEndpointConnectionProxyListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProxyProperties. +func (p PrivateEndpointConnectionProxyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "remotePrivateEndpoint", p.RemotePrivateEndpoint) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProxyProperties. +func (p *PrivateEndpointConnectionProxyProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "remotePrivateEndpoint": + err = unpopulate(val, "RemotePrivateEndpoint", &p.RemotePrivateEndpoint) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionResponseProperties. +func (p PrivateEndpointConnectionResponseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionResponseProperties. +func (p *PrivateEndpointConnectionResponseProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceListResult. +func (p PrivateLinkResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceListResult. +func (p *PrivateLinkResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnection. +func (p PrivateLinkServiceConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "name", p.Name) + populate(objectMap, "requestMessage", p.RequestMessage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnection. +func (p *PrivateLinkServiceConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "requestMessage": + err = unpopulate(val, "RequestMessage", &p.RequestMessage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkServiceProxy. +func (p PrivateLinkServiceProxy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupConnectivityInformation", p.GroupConnectivityInformation) + populate(objectMap, "id", p.ID) + populate(objectMap, "remotePrivateEndpointConnection", p.RemotePrivateEndpointConnection) + populate(objectMap, "remotePrivateLinkServiceConnectionState", p.RemotePrivateLinkServiceConnectionState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceProxy. +func (p *PrivateLinkServiceProxy) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "groupConnectivityInformation": + err = unpopulate(val, "GroupConnectivityInformation", &p.GroupConnectivityInformation) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "remotePrivateEndpointConnection": + err = unpopulate(val, "RemotePrivateEndpointConnection", &p.RemotePrivateEndpointConnection) + delete(rawMsg, key) + case "remotePrivateLinkServiceConnectionState": + err = unpopulate(val, "RemotePrivateLinkServiceConnectionState", &p.RemotePrivateLinkServiceConnectionState) delete(rawMsg, key) } if err != nil { @@ -2544,8 +3225,47 @@ func (p ProtectedItemDynamicMemoryConfig) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemDynamicMemoryConfig. -func (p *ProtectedItemDynamicMemoryConfig) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemDynamicMemoryConfig. +func (p *ProtectedItemDynamicMemoryConfig) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "maximumMemoryInMegaBytes": + err = unpopulate(val, "MaximumMemoryInMegaBytes", &p.MaximumMemoryInMegaBytes) + delete(rawMsg, key) + case "minimumMemoryInMegaBytes": + err = unpopulate(val, "MinimumMemoryInMegaBytes", &p.MinimumMemoryInMegaBytes) + delete(rawMsg, key) + case "targetMemoryBufferPercentage": + err = unpopulate(val, "TargetMemoryBufferPercentage", &p.TargetMemoryBufferPercentage) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemJobProperties. +func (p ProtectedItemJobProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", p.DisplayName) + populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "scenarioName", p.ScenarioName) + populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) + populate(objectMap, "state", p.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemJobProperties. +func (p *ProtectedItemJobProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -2553,14 +3273,26 @@ func (p *ProtectedItemDynamicMemoryConfig) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "maximumMemoryInMegaBytes": - err = unpopulate(val, "MaximumMemoryInMegaBytes", &p.MaximumMemoryInMegaBytes) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) delete(rawMsg, key) - case "minimumMemoryInMegaBytes": - err = unpopulate(val, "MinimumMemoryInMegaBytes", &p.MinimumMemoryInMegaBytes) + case "endTime": + err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) delete(rawMsg, key) - case "targetMemoryBufferPercentage": - err = unpopulate(val, "TargetMemoryBufferPercentage", &p.TargetMemoryBufferPercentage) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "scenarioName": + err = unpopulate(val, "ScenarioName", &p.ScenarioName) + delete(rawMsg, key) + case "startTime": + err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &p.State) delete(rawMsg, key) } if err != nil { @@ -2613,16 +3345,15 @@ func (p *ProtectedItemModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelCollection. -func (p ProtectedItemModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelCustomProperties. +func (p ProtectedItemModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) + populate(objectMap, "instanceType", p.InstanceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelCollection. -func (p *ProtectedItemModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelCustomProperties. +func (p *ProtectedItemModelCustomProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -2630,11 +3361,8 @@ func (p *ProtectedItemModelCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &p.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &p.Value) + case "instanceType": + err = unpopulate(val, "InstanceType", &p.InstanceType) delete(rawMsg, key) } if err != nil { @@ -2644,15 +3372,15 @@ func (p *ProtectedItemModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelCustomProperties. -func (p ProtectedItemModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelCustomPropertiesUpdate. +func (p ProtectedItemModelCustomPropertiesUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = p.InstanceType + populate(objectMap, "instanceType", p.InstanceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelCustomProperties. -func (p *ProtectedItemModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelCustomPropertiesUpdate. +func (p *ProtectedItemModelCustomPropertiesUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -2671,6 +3399,37 @@ func (p *ProtectedItemModelCustomProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelListResult. +func (p ProtectedItemModelListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelListResult. +func (p *ProtectedItemModelListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelProperties. func (p ProtectedItemModelProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2678,7 +3437,7 @@ func (p ProtectedItemModelProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "correlationId", p.CorrelationID) populate(objectMap, "currentJob", p.CurrentJob) populate(objectMap, "customProperties", p.CustomProperties) - populate(objectMap, "draId", p.DraID) + populate(objectMap, "fabricAgentId", p.FabricAgentID) populate(objectMap, "fabricId", p.FabricID) populate(objectMap, "fabricObjectId", p.FabricObjectID) populate(objectMap, "fabricObjectName", p.FabricObjectName) @@ -2698,7 +3457,7 @@ func (p ProtectedItemModelProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "resyncRequired", p.ResyncRequired) populate(objectMap, "resynchronizationState", p.ResynchronizationState) populate(objectMap, "sourceFabricProviderId", p.SourceFabricProviderID) - populate(objectMap, "targetDraId", p.TargetDraID) + populate(objectMap, "targetFabricAgentId", p.TargetFabricAgentID) populate(objectMap, "targetFabricId", p.TargetFabricID) populate(objectMap, "targetFabricProviderId", p.TargetFabricProviderID) populate(objectMap, "testFailoverState", p.TestFailoverState) @@ -2727,8 +3486,8 @@ func (p *ProtectedItemModelProperties) UnmarshalJSON(data []byte) error { case "customProperties": p.CustomProperties, err = unmarshalProtectedItemModelCustomPropertiesClassification(val) delete(rawMsg, key) - case "draId": - err = unpopulate(val, "DraID", &p.DraID) + case "fabricAgentId": + err = unpopulate(val, "FabricAgentID", &p.FabricAgentID) delete(rawMsg, key) case "fabricId": err = unpopulate(val, "FabricID", &p.FabricID) @@ -2787,8 +3546,8 @@ func (p *ProtectedItemModelProperties) UnmarshalJSON(data []byte) error { case "sourceFabricProviderId": err = unpopulate(val, "SourceFabricProviderID", &p.SourceFabricProviderID) delete(rawMsg, key) - case "targetDraId": - err = unpopulate(val, "TargetDraID", &p.TargetDraID) + case "targetFabricAgentId": + err = unpopulate(val, "TargetFabricAgentID", &p.TargetFabricAgentID) delete(rawMsg, key) case "targetFabricId": err = unpopulate(val, "TargetFabricID", &p.TargetFabricID) @@ -2810,123 +3569,15 @@ func (p *ProtectedItemModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesCurrentJob. -func (p ProtectedItemModelPropertiesCurrentJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "scenarioName", p.ScenarioName) - populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "state", p.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesCurrentJob. -func (p *ProtectedItemModelPropertiesCurrentJob) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "scenarioName": - err = unpopulate(val, "ScenarioName", &p.ScenarioName) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesLastFailedEnableProtectionJob. -func (p ProtectedItemModelPropertiesLastFailedEnableProtectionJob) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "scenarioName", p.ScenarioName) - populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "state", p.State) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesLastFailedEnableProtectionJob. -func (p *ProtectedItemModelPropertiesLastFailedEnableProtectionJob) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "scenarioName": - err = unpopulate(val, "ScenarioName", &p.ScenarioName) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesLastFailedPlannedFailoverJob. -func (p ProtectedItemModelPropertiesLastFailedPlannedFailoverJob) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesUpdate. +func (p ProtectedItemModelPropertiesUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "scenarioName", p.ScenarioName) - populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "state", p.State) + populate(objectMap, "customProperties", p.CustomProperties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesLastFailedPlannedFailoverJob. -func (p *ProtectedItemModelPropertiesLastFailedPlannedFailoverJob) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesUpdate. +func (p *ProtectedItemModelPropertiesUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -2934,26 +3585,8 @@ func (p *ProtectedItemModelPropertiesLastFailedPlannedFailoverJob) UnmarshalJSON for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &p.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) - delete(rawMsg, key) - case "scenarioName": - err = unpopulate(val, "ScenarioName", &p.ScenarioName) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) + case "customProperties": + p.CustomProperties, err = unmarshalProtectedItemModelCustomPropertiesUpdateClassification(val) delete(rawMsg, key) } if err != nil { @@ -2963,21 +3596,19 @@ func (p *ProtectedItemModelPropertiesLastFailedPlannedFailoverJob) UnmarshalJSON return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelPropertiesLastTestFailoverJob. -func (p ProtectedItemModelPropertiesLastTestFailoverJob) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelUpdate. +func (p ProtectedItemModelUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", p.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", p.EndTime) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) - populate(objectMap, "scenarioName", p.ScenarioName) - populateDateTimeRFC3339(objectMap, "startTime", p.StartTime) - populate(objectMap, "state", p.State) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelPropertiesLastTestFailoverJob. -func (p *ProtectedItemModelPropertiesLastTestFailoverJob) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelUpdate. +func (p *ProtectedItemModelUpdate) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -2985,73 +3616,20 @@ func (p *ProtectedItemModelPropertiesLastTestFailoverJob) UnmarshalJSON(data []b for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &p.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &p.EndTime) - delete(rawMsg, key) case "id": err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "scenarioName": - err = unpopulate(val, "ScenarioName", &p.ScenarioName) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &p.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &p.State) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ProtectedItemModelSystemData. -func (p ProtectedItemModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", p.CreatedAt) - populate(objectMap, "createdBy", p.CreatedBy) - populate(objectMap, "createdByType", p.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", p.LastModifiedAt) - populate(objectMap, "lastModifiedBy", p.LastModifiedBy) - populate(objectMap, "lastModifiedByType", p.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectedItemModelSystemData. -func (p *ProtectedItemModelSystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", p, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &p.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &p.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &p.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &p.LastModifiedAt) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &p.LastModifiedBy) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &p.LastModifiedByType) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { @@ -3104,16 +3682,15 @@ func (r *RecoveryPointModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelCollection. -func (r RecoveryPointModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelCustomProperties. +func (r RecoveryPointModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "instanceType", r.InstanceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelCollection. -func (r *RecoveryPointModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelCustomProperties. +func (r *RecoveryPointModelCustomProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -3121,11 +3698,8 @@ func (r *RecoveryPointModelCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "instanceType": + err = unpopulate(val, "InstanceType", &r.InstanceType) delete(rawMsg, key) } if err != nil { @@ -3135,15 +3709,16 @@ func (r *RecoveryPointModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelCustomProperties. -func (r RecoveryPointModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelListResult. +func (r RecoveryPointModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = r.InstanceType + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelCustomProperties. -func (r *RecoveryPointModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelListResult. +func (r *RecoveryPointModelListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -3151,8 +3726,11 @@ func (r *RecoveryPointModelCustomProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &r.InstanceType) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -3166,6 +3744,7 @@ func (r *RecoveryPointModelCustomProperties) UnmarshalJSON(data []byte) error { func (r RecoveryPointModelProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "customProperties", r.CustomProperties) + populate(objectMap, "provisioningState", r.ProvisioningState) populateDateTimeRFC3339(objectMap, "recoveryPointTime", r.RecoveryPointTime) populate(objectMap, "recoveryPointType", r.RecoveryPointType) return json.Marshal(objectMap) @@ -3183,6 +3762,9 @@ func (r *RecoveryPointModelProperties) UnmarshalJSON(data []byte) error { case "customProperties": r.CustomProperties, err = unmarshalRecoveryPointModelCustomPropertiesClassification(val) delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &r.ProvisioningState) + delete(rawMsg, key) case "recoveryPointTime": err = unpopulateDateTimeRFC3339(val, "RecoveryPointTime", &r.RecoveryPointTime) delete(rawMsg, key) @@ -3197,20 +3779,19 @@ func (r *RecoveryPointModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RecoveryPointModelSystemData. -func (r RecoveryPointModelSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RemotePrivateEndpoint. +func (r RemotePrivateEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", r.CreatedAt) - populate(objectMap, "createdBy", r.CreatedBy) - populate(objectMap, "createdByType", r.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", r.LastModifiedAt) - populate(objectMap, "lastModifiedBy", r.LastModifiedBy) - populate(objectMap, "lastModifiedByType", r.LastModifiedByType) + populate(objectMap, "connectionDetails", r.ConnectionDetails) + populate(objectMap, "id", r.ID) + populate(objectMap, "manualPrivateLinkServiceConnections", r.ManualPrivateLinkServiceConnections) + populate(objectMap, "privateLinkServiceConnections", r.PrivateLinkServiceConnections) + populate(objectMap, "privateLinkServiceProxies", r.PrivateLinkServiceProxies) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RecoveryPointModelSystemData. -func (r *RecoveryPointModelSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RemotePrivateEndpoint. +func (r *RemotePrivateEndpoint) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -3218,23 +3799,47 @@ func (r *RecoveryPointModelSystemData) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &r.CreatedAt) + case "connectionDetails": + err = unpopulate(val, "ConnectionDetails", &r.ConnectionDetails) delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &r.CreatedBy) + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &r.CreatedByType) + case "manualPrivateLinkServiceConnections": + err = unpopulate(val, "ManualPrivateLinkServiceConnections", &r.ManualPrivateLinkServiceConnections) delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &r.LastModifiedAt) + case "privateLinkServiceConnections": + err = unpopulate(val, "PrivateLinkServiceConnections", &r.PrivateLinkServiceConnections) delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &r.LastModifiedBy) + case "privateLinkServiceProxies": + err = unpopulate(val, "PrivateLinkServiceProxies", &r.PrivateLinkServiceProxies) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &r.LastModifiedByType) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RemotePrivateEndpointConnection. +func (r RemotePrivateEndpointConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", r.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RemotePrivateEndpointConnection. +func (r *RemotePrivateEndpointConnection) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &r.ID) delete(rawMsg, key) } if err != nil { @@ -3287,16 +3892,15 @@ func (r *ReplicationExtensionModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelCollection. -func (r ReplicationExtensionModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelCustomProperties. +func (r ReplicationExtensionModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "instanceType", r.InstanceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelCollection. -func (r *ReplicationExtensionModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelCustomProperties. +func (r *ReplicationExtensionModelCustomProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -3304,11 +3908,8 @@ func (r *ReplicationExtensionModelCollection) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "instanceType": + err = unpopulate(val, "InstanceType", &r.InstanceType) delete(rawMsg, key) } if err != nil { @@ -3318,15 +3919,16 @@ func (r *ReplicationExtensionModelCollection) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelCustomProperties. -func (r ReplicationExtensionModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelListResult. +func (r ReplicationExtensionModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["instanceType"] = r.InstanceType + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelCustomProperties. -func (r *ReplicationExtensionModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelListResult. +func (r *ReplicationExtensionModelListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -3334,8 +3936,11 @@ func (r *ReplicationExtensionModelCustomProperties) UnmarshalJSON(data []byte) e for key, val := range rawMsg { var err error switch key { - case "instanceType": - err = unpopulate(val, "InstanceType", &r.InstanceType) + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) } if err != nil { @@ -3376,63 +3981,51 @@ func (r *ReplicationExtensionModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ReplicationExtensionModelSystemData. -func (r ReplicationExtensionModelSystemData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type StorageContainerProperties. +func (s StorageContainerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", r.CreatedAt) - populate(objectMap, "createdBy", r.CreatedBy) - populate(objectMap, "createdByType", r.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", r.LastModifiedAt) - populate(objectMap, "lastModifiedBy", r.LastModifiedBy) - populate(objectMap, "lastModifiedByType", r.LastModifiedByType) + populate(objectMap, "clusterSharedVolumePath", s.ClusterSharedVolumePath) + populate(objectMap, "name", s.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ReplicationExtensionModelSystemData. -func (r *ReplicationExtensionModelSystemData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageContainerProperties. +func (s *StorageContainerProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } for key, val := range rawMsg { var err error switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &r.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &r.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &r.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &r.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &r.LastModifiedBy) + case "clusterSharedVolumePath": + err = unpopulate(val, "ClusterSharedVolumePath", &s.ClusterSharedVolumePath) delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &r.LastModifiedByType) + case "name": + err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) + return fmt.Errorf("unmarshalling type %T: %v", s, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type StorageContainerProperties. -func (s StorageContainerProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "clusterSharedVolumePath", s.ClusterSharedVolumePath) - populate(objectMap, "name", s.Name) + 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 StorageContainerProperties. -func (s *StorageContainerProperties) UnmarshalJSON(data []byte) error { +// 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) @@ -3440,11 +4033,23 @@ func (s *StorageContainerProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "clusterSharedVolumePath": - err = unpopulate(val, "ClusterSharedVolumePath", &s.ClusterSharedVolumePath) + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &s.Name) + 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 { @@ -3457,7 +4062,7 @@ func (s *StorageContainerProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TaskModel. func (t TaskModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "childrenWorkflows", t.ChildrenWorkflows) + populate(objectMap, "childrenJobs", t.ChildrenJobs) populate(objectMap, "customProperties", t.CustomProperties) populateDateTimeRFC3339(objectMap, "endTime", t.EndTime) populateDateTimeRFC3339(objectMap, "startTime", t.StartTime) @@ -3475,8 +4080,8 @@ func (t *TaskModel) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "childrenWorkflows": - err = unpopulate(val, "ChildrenWorkflows", &t.ChildrenWorkflows) + case "childrenJobs": + err = unpopulate(val, "ChildrenJobs", &t.ChildrenJobs) delete(rawMsg, key) case "customProperties": err = unpopulate(val, "CustomProperties", &t.CustomProperties) @@ -3528,17 +4133,17 @@ func (t *TaskModelCustomProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TestFailoverCleanupWorkflowModelCustomProperties. -func (t TestFailoverCleanupWorkflowModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TestFailoverCleanupJobModelCustomProperties. +func (t TestFailoverCleanupJobModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "affectedObjectDetails", t.AffectedObjectDetails) populate(objectMap, "comments", t.Comments) - objectMap["instanceType"] = "TestFailoverCleanupWorkflowDetails" + objectMap["instanceType"] = "TestFailoverCleanupJobDetails" return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TestFailoverCleanupWorkflowModelCustomProperties. -func (t *TestFailoverCleanupWorkflowModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TestFailoverCleanupJobModelCustomProperties. +func (t *TestFailoverCleanupJobModelCustomProperties) UnmarshalJSON(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) @@ -3563,17 +4168,17 @@ func (t *TestFailoverCleanupWorkflowModelCustomProperties) UnmarshalJSON(data [] return nil } -// MarshalJSON implements the json.Marshaller interface for type TestFailoverWorkflowModelCustomProperties. -func (t TestFailoverWorkflowModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type TestFailoverJobModelCustomProperties. +func (t TestFailoverJobModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "affectedObjectDetails", t.AffectedObjectDetails) - objectMap["instanceType"] = "TestFailoverWorkflowDetails" + objectMap["instanceType"] = "TestFailoverJobDetails" populate(objectMap, "protectedItemDetails", t.ProtectedItemDetails) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type TestFailoverWorkflowModelCustomProperties. -func (t *TestFailoverWorkflowModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type TestFailoverJobModelCustomProperties. +func (t *TestFailoverJobModelCustomProperties) UnmarshalJSON(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) @@ -3598,8 +4203,39 @@ func (t *TestFailoverWorkflowModelCustomProperties) UnmarshalJSON(data []byte) e return nil } -// MarshalJSON implements the json.Marshaller interface for type VMwareDraModelCustomProperties. -func (v VMwareDraModelCustomProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. +func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", u.ClientID) + populate(objectMap, "principalId", u.PrincipalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserAssignedIdentity. +func (u *UserAssignedIdentity) UnmarshalJSON(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 "clientId": + err = unpopulate(val, "ClientID", &u.ClientID) + delete(rawMsg, key) + case "principalId": + err = unpopulate(val, "PrincipalID", &u.PrincipalID) + 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 VMwareFabricAgentModelCustomProperties. +func (v VMwareFabricAgentModelCustomProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "biosId", v.BiosID) objectMap["instanceType"] = "VMware" @@ -3607,8 +4243,8 @@ func (v VMwareDraModelCustomProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareDraModelCustomProperties. -func (v *VMwareDraModelCustomProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareFabricAgentModelCustomProperties. +func (v *VMwareFabricAgentModelCustomProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -3671,8 +4307,13 @@ func (v *VMwareMigrateFabricModelCustomProperties) UnmarshalJSON(data []byte) er // MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIDiskInput. func (v VMwareToAzStackHCIDiskInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "diskBlockSize", v.DiskBlockSize) + populate(objectMap, "diskController", v.DiskController) populate(objectMap, "diskFileFormat", v.DiskFileFormat) populate(objectMap, "diskId", v.DiskID) + populate(objectMap, "diskIdentifier", v.DiskIdentifier) + populate(objectMap, "diskLogicalSectorSize", v.DiskLogicalSectorSize) + populate(objectMap, "diskPhysicalSectorSize", v.DiskPhysicalSectorSize) populate(objectMap, "diskSizeGB", v.DiskSizeGB) populate(objectMap, "isDynamic", v.IsDynamic) populate(objectMap, "isOsDisk", v.IsOsDisk) @@ -3689,12 +4330,27 @@ func (v *VMwareToAzStackHCIDiskInput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "diskBlockSize": + err = unpopulate(val, "DiskBlockSize", &v.DiskBlockSize) + delete(rawMsg, key) + case "diskController": + err = unpopulate(val, "DiskController", &v.DiskController) + delete(rawMsg, key) case "diskFileFormat": err = unpopulate(val, "DiskFileFormat", &v.DiskFileFormat) delete(rawMsg, key) case "diskId": err = unpopulate(val, "DiskID", &v.DiskID) delete(rawMsg, key) + case "diskIdentifier": + err = unpopulate(val, "DiskIdentifier", &v.DiskIdentifier) + delete(rawMsg, key) + case "diskLogicalSectorSize": + err = unpopulate(val, "DiskLogicalSectorSize", &v.DiskLogicalSectorSize) + delete(rawMsg, key) + case "diskPhysicalSectorSize": + err = unpopulate(val, "DiskPhysicalSectorSize", &v.DiskPhysicalSectorSize) + delete(rawMsg, key) case "diskSizeGB": err = unpopulate(val, "DiskSizeGB", &v.DiskSizeGB) delete(rawMsg, key) @@ -3715,9 +4371,58 @@ func (v *VMwareToAzStackHCIDiskInput) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIEventModelCustomProperties. +func (v VMwareToAzStackHCIEventModelCustomProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eventSourceFriendlyName", v.EventSourceFriendlyName) + objectMap["instanceType"] = "VMwareToAzStackHCI" + populate(objectMap, "protectedItemFriendlyName", v.ProtectedItemFriendlyName) + populate(objectMap, "serverType", v.ServerType) + populate(objectMap, "sourceApplianceName", v.SourceApplianceName) + populate(objectMap, "targetApplianceName", v.TargetApplianceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareToAzStackHCIEventModelCustomProperties. +func (v *VMwareToAzStackHCIEventModelCustomProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "eventSourceFriendlyName": + err = unpopulate(val, "EventSourceFriendlyName", &v.EventSourceFriendlyName) + delete(rawMsg, key) + case "instanceType": + err = unpopulate(val, "InstanceType", &v.InstanceType) + delete(rawMsg, key) + case "protectedItemFriendlyName": + err = unpopulate(val, "ProtectedItemFriendlyName", &v.ProtectedItemFriendlyName) + delete(rawMsg, key) + case "serverType": + err = unpopulate(val, "ServerType", &v.ServerType) + delete(rawMsg, key) + case "sourceApplianceName": + err = unpopulate(val, "SourceApplianceName", &v.SourceApplianceName) + delete(rawMsg, key) + case "targetApplianceName": + err = unpopulate(val, "TargetApplianceName", &v.TargetApplianceName) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCINicInput. func (v VMwareToAzStackHCINicInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "isMacMigrationEnabled", v.IsMacMigrationEnabled) + populate(objectMap, "isStaticIpMigrationEnabled", v.IsStaticIPMigrationEnabled) populate(objectMap, "label", v.Label) populate(objectMap, "networkName", v.NetworkName) populate(objectMap, "nicId", v.NicID) @@ -3736,6 +4441,12 @@ func (v *VMwareToAzStackHCINicInput) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "isMacMigrationEnabled": + err = unpopulate(val, "IsMacMigrationEnabled", &v.IsMacMigrationEnabled) + delete(rawMsg, key) + case "isStaticIpMigrationEnabled": + err = unpopulate(val, "IsStaticIPMigrationEnabled", &v.IsStaticIPMigrationEnabled) + delete(rawMsg, key) case "label": err = unpopulate(val, "Label", &v.Label) delete(rawMsg, key) @@ -3836,6 +4547,9 @@ func (v *VMwareToAzStackHCIPolicyModelCustomProperties) UnmarshalJSON(data []byt func (v VMwareToAzStackHCIProtectedDiskProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "capacityInBytes", v.CapacityInBytes) + populate(objectMap, "diskBlockSize", v.DiskBlockSize) + populate(objectMap, "diskLogicalSectorSize", v.DiskLogicalSectorSize) + populate(objectMap, "diskPhysicalSectorSize", v.DiskPhysicalSectorSize) populate(objectMap, "diskType", v.DiskType) populate(objectMap, "isDynamic", v.IsDynamic) populate(objectMap, "isOsDisk", v.IsOsDisk) @@ -3861,6 +4575,15 @@ func (v *VMwareToAzStackHCIProtectedDiskProperties) UnmarshalJSON(data []byte) e case "capacityInBytes": err = unpopulate(val, "CapacityInBytes", &v.CapacityInBytes) delete(rawMsg, key) + case "diskBlockSize": + err = unpopulate(val, "DiskBlockSize", &v.DiskBlockSize) + delete(rawMsg, key) + case "diskLogicalSectorSize": + err = unpopulate(val, "DiskLogicalSectorSize", &v.DiskLogicalSectorSize) + delete(rawMsg, key) + case "diskPhysicalSectorSize": + err = unpopulate(val, "DiskPhysicalSectorSize", &v.DiskPhysicalSectorSize) + delete(rawMsg, key) case "diskType": err = unpopulate(val, "DiskType", &v.DiskType) delete(rawMsg, key) @@ -3932,7 +4655,7 @@ func (v VMwareToAzStackHCIProtectedItemModelCustomProperties) MarshalJSON() ([]b populate(objectMap, "runAsAccountId", v.RunAsAccountID) populate(objectMap, "sourceApplianceName", v.SourceApplianceName) populate(objectMap, "sourceCpuCores", v.SourceCPUCores) - populate(objectMap, "sourceDraName", v.SourceDraName) + populate(objectMap, "sourceFabricAgentName", v.SourceFabricAgentName) populate(objectMap, "sourceMemoryInMegaBytes", v.SourceMemoryInMegaBytes) populate(objectMap, "sourceVmName", v.SourceVMName) populate(objectMap, "storageContainerId", v.StorageContainerID) @@ -3940,7 +4663,7 @@ func (v VMwareToAzStackHCIProtectedItemModelCustomProperties) MarshalJSON() ([]b populate(objectMap, "targetArcClusterCustomLocationId", v.TargetArcClusterCustomLocationID) populate(objectMap, "targetAzStackHciClusterName", v.TargetAzStackHciClusterName) populate(objectMap, "targetCpuCores", v.TargetCPUCores) - populate(objectMap, "targetDraName", v.TargetDraName) + populate(objectMap, "targetFabricAgentName", v.TargetFabricAgentName) populate(objectMap, "targetHciClusterId", v.TargetHciClusterID) populate(objectMap, "targetLocation", v.TargetLocation) populate(objectMap, "targetMemoryInMegaBytes", v.TargetMemoryInMegaBytes) @@ -4051,8 +4774,8 @@ func (v *VMwareToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat case "sourceCpuCores": err = unpopulate(val, "SourceCPUCores", &v.SourceCPUCores) delete(rawMsg, key) - case "sourceDraName": - err = unpopulate(val, "SourceDraName", &v.SourceDraName) + case "sourceFabricAgentName": + err = unpopulate(val, "SourceFabricAgentName", &v.SourceFabricAgentName) delete(rawMsg, key) case "sourceMemoryInMegaBytes": err = unpopulate(val, "SourceMemoryInMegaBytes", &v.SourceMemoryInMegaBytes) @@ -4075,8 +4798,8 @@ func (v *VMwareToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat case "targetCpuCores": err = unpopulate(val, "TargetCPUCores", &v.TargetCPUCores) delete(rawMsg, key) - case "targetDraName": - err = unpopulate(val, "TargetDraName", &v.TargetDraName) + case "targetFabricAgentName": + err = unpopulate(val, "TargetFabricAgentName", &v.TargetFabricAgentName) delete(rawMsg, key) case "targetHciClusterId": err = unpopulate(val, "TargetHciClusterID", &v.TargetHciClusterID) @@ -4110,6 +4833,57 @@ func (v *VMwareToAzStackHCIProtectedItemModelCustomProperties) UnmarshalJSON(dat return nil } +// MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (v VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dynamicMemoryConfig", v.DynamicMemoryConfig) + objectMap["instanceType"] = "VMwareToAzStackHCI" + populate(objectMap, "isDynamicRam", v.IsDynamicRAM) + populate(objectMap, "nicsToInclude", v.NicsToInclude) + populate(objectMap, "osType", v.OSType) + populate(objectMap, "targetCpuCores", v.TargetCPUCores) + populate(objectMap, "targetMemoryInMegaBytes", v.TargetMemoryInMegaBytes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate. +func (v *VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dynamicMemoryConfig": + err = unpopulate(val, "DynamicMemoryConfig", &v.DynamicMemoryConfig) + delete(rawMsg, key) + case "instanceType": + err = unpopulate(val, "InstanceType", &v.InstanceType) + delete(rawMsg, key) + case "isDynamicRam": + err = unpopulate(val, "IsDynamicRAM", &v.IsDynamicRAM) + delete(rawMsg, key) + case "nicsToInclude": + err = unpopulate(val, "NicsToInclude", &v.NicsToInclude) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, "OSType", &v.OSType) + delete(rawMsg, key) + case "targetCpuCores": + err = unpopulate(val, "TargetCPUCores", &v.TargetCPUCores) + delete(rawMsg, key) + case "targetMemoryInMegaBytes": + err = unpopulate(val, "TargetMemoryInMegaBytes", &v.TargetMemoryInMegaBytes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIProtectedNicProperties. func (v VMwareToAzStackHCIProtectedNicProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4154,8 +4928,39 @@ func (v *VMwareToAzStackHCIProtectedNicProperties) UnmarshalJSON(data []byte) er case "targetNetworkId": err = unpopulate(val, "TargetNetworkID", &v.TargetNetworkID) delete(rawMsg, key) - case "testNetworkId": - err = unpopulate(val, "TestNetworkID", &v.TestNetworkID) + case "testNetworkId": + err = unpopulate(val, "TestNetworkID", &v.TestNetworkID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMwareToAzStackHCIRecoveryPointModelCustomProperties. +func (v VMwareToAzStackHCIRecoveryPointModelCustomProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diskIds", v.DiskIDs) + objectMap["instanceType"] = "VMwareToAzStackHCIRecoveryPointModelCustomProperties" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMwareToAzStackHCIRecoveryPointModelCustomProperties. +func (v *VMwareToAzStackHCIRecoveryPointModelCustomProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "diskIds": + err = unpopulate(val, "DiskIDs", &v.DiskIDs) + delete(rawMsg, key) + case "instanceType": + err = unpopulate(val, "InstanceType", &v.InstanceType) delete(rawMsg, key) } if err != nil { @@ -4256,10 +5061,46 @@ func (v *VMwareToAzStackHCIReplicationExtensionModelCustomProperties) UnmarshalJ return nil } +// MarshalJSON implements the json.Marshaller interface for type VaultIdentityModel. +func (v VaultIdentityModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "principalId", v.PrincipalID) + populate(objectMap, "tenantId", v.TenantID) + populate(objectMap, "type", v.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultIdentityModel. +func (v *VaultIdentityModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principalId": + err = unpopulate(val, "PrincipalID", &v.PrincipalID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &v.TenantID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &v.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type VaultModel. func (v VaultModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", v.ID) + populate(objectMap, "identity", v.Identity) populate(objectMap, "location", v.Location) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) @@ -4281,6 +5122,9 @@ func (v *VaultModel) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) case "location": err = unpopulate(val, "Location", &v.Location) delete(rawMsg, key) @@ -4307,16 +5151,16 @@ func (v *VaultModel) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultModelCollection. -func (v VaultModelCollection) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type VaultModelListResult. +func (v VaultModelListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", v.NextLink) populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultModelCollection. -func (v *VaultModelCollection) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type VaultModelListResult. +func (v *VaultModelListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", v, err) @@ -4373,57 +5217,11 @@ func (v *VaultModelProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultModelSystemData. -func (v VaultModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", v.CreatedAt) - populate(objectMap, "createdBy", v.CreatedBy) - populate(objectMap, "createdByType", v.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", v.LastModifiedAt) - populate(objectMap, "lastModifiedBy", v.LastModifiedBy) - populate(objectMap, "lastModifiedByType", v.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultModelSystemData. -func (v *VaultModelSystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &v.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &v.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &v.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &v.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &v.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &v.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type VaultModelUpdate. func (v VaultModelUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", v.ID) + populate(objectMap, "identity", v.Identity) populate(objectMap, "name", v.Name) populate(objectMap, "properties", v.Properties) populate(objectMap, "systemData", v.SystemData) @@ -4444,6 +5242,9 @@ func (v *VaultModelUpdate) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &v.ID) delete(rawMsg, key) + case "identity": + err = unpopulate(val, "Identity", &v.Identity) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &v.Name) delete(rawMsg, key) @@ -4467,308 +5268,28 @@ func (v *VaultModelUpdate) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VaultModelUpdateSystemData. -func (v VaultModelUpdateSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", v.CreatedAt) - populate(objectMap, "createdBy", v.CreatedBy) - populate(objectMap, "createdByType", v.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", v.LastModifiedAt) - populate(objectMap, "lastModifiedBy", v.LastModifiedBy) - populate(objectMap, "lastModifiedByType", v.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VaultModelUpdateSystemData. -func (v *VaultModelUpdateSystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &v.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &v.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &v.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &v.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &v.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &v.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", v, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModel. -func (w WorkflowModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", w.ID) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "systemData", w.SystemData) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModel. -func (w *WorkflowModel) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &w.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &w.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &w.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &w.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &w.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModelCollection. -func (w WorkflowModelCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", w.NextLink) - populate(objectMap, "value", w.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModelCollection. -func (w *WorkflowModelCollection) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &w.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &w.Value) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModelCustomProperties. -func (w WorkflowModelCustomProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "affectedObjectDetails", w.AffectedObjectDetails) - objectMap["instanceType"] = w.InstanceType - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModelCustomProperties. -func (w *WorkflowModelCustomProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "affectedObjectDetails": - err = unpopulate(val, "AffectedObjectDetails", &w.AffectedObjectDetails) - delete(rawMsg, key) - case "instanceType": - err = unpopulate(val, "InstanceType", &w.InstanceType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModelProperties. -func (w WorkflowModelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "activityId", w.ActivityID) - populate(objectMap, "allowedActions", w.AllowedActions) - populate(objectMap, "customProperties", w.CustomProperties) - populate(objectMap, "displayName", w.DisplayName) - populateDateTimeRFC3339(objectMap, "endTime", w.EndTime) - populate(objectMap, "errors", w.Errors) - populate(objectMap, "objectId", w.ObjectID) - populate(objectMap, "objectInternalId", w.ObjectInternalID) - populate(objectMap, "objectInternalName", w.ObjectInternalName) - populate(objectMap, "objectName", w.ObjectName) - populate(objectMap, "objectType", w.ObjectType) - populate(objectMap, "replicationProviderId", w.ReplicationProviderID) - populate(objectMap, "sourceFabricProviderId", w.SourceFabricProviderID) - populateDateTimeRFC3339(objectMap, "startTime", w.StartTime) - populate(objectMap, "state", w.State) - populate(objectMap, "targetFabricProviderId", w.TargetFabricProviderID) - populate(objectMap, "tasks", w.Tasks) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModelProperties. -func (w *WorkflowModelProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "activityId": - err = unpopulate(val, "ActivityID", &w.ActivityID) - delete(rawMsg, key) - case "allowedActions": - err = unpopulate(val, "AllowedActions", &w.AllowedActions) - delete(rawMsg, key) - case "customProperties": - w.CustomProperties, err = unmarshalWorkflowModelCustomPropertiesClassification(val) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &w.DisplayName) - delete(rawMsg, key) - case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &w.EndTime) - delete(rawMsg, key) - case "errors": - err = unpopulate(val, "Errors", &w.Errors) - delete(rawMsg, key) - case "objectId": - err = unpopulate(val, "ObjectID", &w.ObjectID) - delete(rawMsg, key) - case "objectInternalId": - err = unpopulate(val, "ObjectInternalID", &w.ObjectInternalID) - delete(rawMsg, key) - case "objectInternalName": - err = unpopulate(val, "ObjectInternalName", &w.ObjectInternalName) - delete(rawMsg, key) - case "objectName": - err = unpopulate(val, "ObjectName", &w.ObjectName) - delete(rawMsg, key) - case "objectType": - err = unpopulate(val, "ObjectType", &w.ObjectType) - delete(rawMsg, key) - case "replicationProviderId": - err = unpopulate(val, "ReplicationProviderID", &w.ReplicationProviderID) - delete(rawMsg, key) - case "sourceFabricProviderId": - err = unpopulate(val, "SourceFabricProviderID", &w.SourceFabricProviderID) - delete(rawMsg, key) - case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &w.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &w.State) - delete(rawMsg, key) - case "targetFabricProviderId": - err = unpopulate(val, "TargetFabricProviderID", &w.TargetFabricProviderID) - delete(rawMsg, key) - case "tasks": - err = unpopulate(val, "Tasks", &w.Tasks) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type WorkflowModelSystemData. -func (w WorkflowModelSystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", w.CreatedAt) - populate(objectMap, "createdBy", w.CreatedBy) - populate(objectMap, "createdByType", w.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", w.LastModifiedAt) - populate(objectMap, "lastModifiedBy", w.LastModifiedBy) - populate(objectMap, "lastModifiedByType", w.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type WorkflowModelSystemData. -func (w *WorkflowModelSystemData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &w.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &w.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &w.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &w.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &w.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &w.LastModifiedByType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", w, err) - } +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 } - return nil } -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 if !reflect.ValueOf(v).IsNil() { + } else { m[k] = v } } func unpopulate(data json.RawMessage, fn string, v any) error { - if data == nil { + if data == nil || string(data) == "null" { return nil } if err := json.Unmarshal(data, v); err != nil { diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_client.go similarity index 54% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_client.go index 19b7c31d5347..65f72c177c08 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vaultoperationstatus_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_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 armrecoveryservicesdatareplication @@ -20,63 +16,63 @@ import ( "strings" ) -// VaultOperationStatusClient contains the methods for the VaultOperationStatus group. -// Don't use this type directly, use NewVaultOperationStatusClient() instead. -type VaultOperationStatusClient struct { +// OperationResultsClient contains the methods for the OperationResults group. +// Don't use this type directly, use NewOperationResultsClient() instead. +type OperationResultsClient struct { internal *arm.Client subscriptionID string } -// NewVaultOperationStatusClient creates a new instance of VaultOperationStatusClient with the specified values. +// NewOperationResultsClient creates a new instance of OperationResultsClient 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 NewVaultOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*VaultOperationStatusClient, error) { +func NewOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationResultsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &VaultOperationStatusClient{ + client := &OperationResultsClient{ subscriptionID: subscriptionID, internal: cl, } return client, nil } -// Get - Tracks the results of an asynchronous operation on the vault. +// Get - Gets the operation result status. +// +// Gets the operations. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. // - operationID - The ID of an ongoing async operation. -// - options - VaultOperationStatusClientGetOptions contains the optional parameters for the VaultOperationStatusClient.Get -// method. -func (client *VaultOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *VaultOperationStatusClientGetOptions) (VaultOperationStatusClientGetResponse, error) { +// - options - OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. +func (client *OperationResultsClient) Get(ctx context.Context, resourceGroupName string, operationID string, options *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error) { var err error - const operationName = "VaultOperationStatusClient.Get" + const operationName = "OperationResultsClient.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, vaultName, operationID, options) + req, err := client.getCreateRequest(ctx, resourceGroupName, operationID, options) if err != nil { - return VaultOperationStatusClientGetResponse{}, err + return OperationResultsClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return VaultOperationStatusClientGetResponse{}, err + return OperationResultsClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return VaultOperationStatusClientGetResponse{}, err + return OperationResultsClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *VaultOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, operationID string, options *VaultOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/operations/{operationId}" +func (client *OperationResultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, operationID string, _ *OperationResultsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/operationResults/{operationId}/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/{operationId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -85,10 +81,6 @@ func (client *VaultOperationStatusClient) getCreateRequest(ctx context.Context, return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) if operationID == "" { return nil, errors.New("parameter operationID cannot be empty") } @@ -98,17 +90,17 @@ func (client *VaultOperationStatusClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 *VaultOperationStatusClient) getHandleResponse(resp *http.Response) (VaultOperationStatusClientGetResponse, error) { - result := VaultOperationStatusClientGetResponse{} +func (client *OperationResultsClient) getHandleResponse(resp *http.Response) (OperationResultsClientGetResponse, error) { + result := OperationResultsClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return VaultOperationStatusClientGetResponse{}, err + return OperationResultsClientGetResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_client_example_test.go similarity index 52% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client_example_test.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_client_example_test.go index 8a445501bb63..95f0310bdf56 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/draoperationstatus_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operationresults_client_example_test.go @@ -1,45 +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. -// 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 armrecoveryservicesdatareplication_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/DraOperationStatus_Get.json -func ExampleDraOperationStatusClient_Get() { +// Generated from example definition: 2024-09-01/OperationResults_Get.json +func ExampleOperationResultsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewDraOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "wPR", "M", "dadsqwcq", nil) + res, err := clientFactory.NewOperationResultsClient().Get(ctx, "rgswagger_2024-09-01", "lghle", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), + // res = armrecoveryservicesdatareplication.OperationResultsClientGetResponse{ + // OperationStatus: &armrecoveryservicesdatareplication.OperationStatus{ + // ID: to.Ptr("inhnjrxtqtyumflbzdne"), + // Name: to.Ptr("eawsgzqm"), + // Status: to.Ptr("jjijbsrjfqvqzriekxfvynb"), + // StartTime: to.Ptr("slmhzgrfzkkrxdalacmidyxijq"), + // EndTime: to.Ptr("ixkalnbiajfpjtur"), + // }, // } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client.go index a918a38ab518..4e0b61d1cbb0 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armrecoveryservicesdatareplication @@ -37,9 +33,9 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListPager - Gets the operations. +// NewListPager - List the operations for the provider // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - 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) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.DataReplication/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-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client_example_test.go index d455e99cc3d3..35a105402796 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/operations_client_example_test.go @@ -1,30 +1,24 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armrecoveryservicesdatareplication_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Operations_List.json +// Generated from example definition: 2024-09-01/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 := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,20 +33,24 @@ func ExampleOperationsClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = armrecoveryservicesdatareplication.OperationListResult{ - // Value: []*armrecoveryservicesdatareplication.Operation{ - // { - // Name: to.Ptr("chktcqashuxscvbp"), - // ActionType: to.Ptr(armrecoveryservicesdatareplication.ActionTypeInternal), - // Display: &armrecoveryservicesdatareplication.OperationDisplay{ - // Description: to.Ptr("bjdvnagzxjandxcbcrf"), - // Operation: to.Ptr("dfal"), - // Provider: to.Ptr("yembewkfmaq"), - // Resource: to.Ptr("epyscqvmqhxbwgyqhzeaumpor"), + // page = armrecoveryservicesdatareplication.OperationsClientListResponse{ + // OperationListResult: armrecoveryservicesdatareplication.OperationListResult{ + // Value: []*armrecoveryservicesdatareplication.Operation{ + // { + // Name: to.Ptr("chktcqashuxscvbp"), + // IsDataAction: to.Ptr(true), + // Display: &armrecoveryservicesdatareplication.OperationDisplay{ + // Provider: to.Ptr("yembewkfmaq"), + // Resource: to.Ptr("epyscqvmqhxbwgyqhzeaumpor"), + // Operation: to.Ptr("dfal"), + // Description: to.Ptr("bjdvnagzxjandxcbcrf"), + // }, + // Origin: to.Ptr(armrecoveryservicesdatareplication.OriginUser), + // ActionType: to.Ptr(armrecoveryservicesdatareplication.ActionTypeInternal), // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armrecoveryservicesdatareplication.OriginUser), - // }}, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/options.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/options.go index a802a5622ecd..00196123cf41 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/options.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/options.go @@ -1,54 +1,21 @@ -//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 armrecoveryservicesdatareplication -// AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions contains the optional parameters for the AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability -// method. -type AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityOptions struct { +// CheckNameAvailabilityClientPostOptions contains the optional parameters for the CheckNameAvailabilityClient.Post method. +type CheckNameAvailabilityClientPostOptions struct { // Resource details. Body *CheckNameAvailabilityModel } -// AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions contains the optional parameters for the AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight -// method. -type AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightOptions struct { +// DeploymentPreflightClientPostOptions contains the optional parameters for the DeploymentPreflightClient.Post method. +type DeploymentPreflightClientPostOptions struct { // Deployment preflight model. Body *DeploymentPreflightModel } -// DraClientBeginCreateOptions contains the optional parameters for the DraClient.BeginCreate method. -type DraClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DraClientBeginDeleteOptions contains the optional parameters for the DraClient.BeginDelete method. -type DraClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// DraClientGetOptions contains the optional parameters for the DraClient.Get method. -type DraClientGetOptions struct { - // placeholder for future optional parameters -} - -// DraClientListOptions contains the optional parameters for the DraClient.NewListPager method. -type DraClientListOptions struct { - // placeholder for future optional parameters -} - -// DraOperationStatusClientGetOptions contains the optional parameters for the DraOperationStatusClient.Get method. -type DraOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - // EmailConfigurationClientCreateOptions contains the optional parameters for the EmailConfigurationClient.Create method. type EmailConfigurationClientCreateOptions struct { // placeholder for future optional parameters @@ -74,25 +41,50 @@ type EventClientListOptions struct { // Continuation token. ContinuationToken *string - // Filter string. - Filter *string + // OData options. + OdataOptions *string + + // Page size. + PageSize *int32 +} + +// FabricAgentClientBeginCreateOptions contains the optional parameters for the FabricAgentClient.BeginCreate method. +type FabricAgentClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FabricAgentClientBeginDeleteOptions contains the optional parameters for the FabricAgentClient.BeginDelete method. +type FabricAgentClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// FabricAgentClientGetOptions contains the optional parameters for the FabricAgentClient.Get method. +type FabricAgentClientGetOptions struct { + // placeholder for future optional parameters +} + +// FabricAgentClientListOptions contains the optional parameters for the FabricAgentClient.NewListPager method. +type FabricAgentClientListOptions struct { + // placeholder for future optional parameters } // FabricClientBeginCreateOptions contains the optional parameters for the FabricClient.BeginCreate method. type FabricClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // FabricClientBeginDeleteOptions contains the optional parameters for the FabricClient.BeginDelete method. type FabricClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // FabricClientBeginUpdateOptions contains the optional parameters for the FabricClient.BeginUpdate method. type FabricClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -104,8 +96,7 @@ type FabricClientGetOptions struct { // FabricClientListBySubscriptionOptions contains the optional parameters for the FabricClient.NewListBySubscriptionPager // method. type FabricClientListBySubscriptionOptions struct { - // Continuation token from the previous call. - ContinuationToken *string + // placeholder for future optional parameters } // FabricClientListOptions contains the optional parameters for the FabricClient.NewListPager method. @@ -114,8 +105,25 @@ type FabricClientListOptions struct { ContinuationToken *string } -// FabricOperationsStatusClientGetOptions contains the optional parameters for the FabricOperationsStatusClient.Get method. -type FabricOperationsStatusClientGetOptions struct { +// JobClientGetOptions contains the optional parameters for the JobClient.Get method. +type JobClientGetOptions struct { + // placeholder for future optional parameters +} + +// JobClientListOptions contains the optional parameters for the JobClient.NewListPager method. +type JobClientListOptions struct { + // Continuation token. + ContinuationToken *string + + // OData options. + OdataOptions *string + + // Page size. + PageSize *int32 +} + +// OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. +type OperationResultsClientGetOptions struct { // placeholder for future optional parameters } @@ -126,13 +134,13 @@ type OperationsClientListOptions struct { // PolicyClientBeginCreateOptions contains the optional parameters for the PolicyClient.BeginCreate method. type PolicyClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // PolicyClientBeginDeleteOptions contains the optional parameters for the PolicyClient.BeginDelete method. type PolicyClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -146,33 +154,98 @@ type PolicyClientListOptions struct { // placeholder for future optional parameters } -// PolicyOperationStatusClientGetOptions contains the optional parameters for the PolicyOperationStatusClient.Get method. -type PolicyOperationStatusClientGetOptions struct { +// PrivateEndpointConnectionProxiesClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.BeginDelete +// method. +type PrivateEndpointConnectionProxiesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionProxiesClientCreateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Create +// method. +type PrivateEndpointConnectionProxiesClientCreateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionProxiesClientGetOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Get +// method. +type PrivateEndpointConnectionProxiesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionProxiesClientListOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.NewListPager +// method. +type PrivateEndpointConnectionProxiesClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionProxiesClientValidateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Validate +// method. +type PrivateEndpointConnectionProxiesClientValidateOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +type PrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update +// method. +type PrivateEndpointConnectionsClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. +type PrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager +// method. +type PrivateLinkResourcesClientListOptions struct { // placeholder for future optional parameters } // ProtectedItemClientBeginCreateOptions contains the optional parameters for the ProtectedItemClient.BeginCreate method. type ProtectedItemClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ProtectedItemClientBeginDeleteOptions contains the optional parameters for the ProtectedItemClient.BeginDelete method. type ProtectedItemClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string + // A flag indicating whether to do force delete or not. ForceDelete *bool - - // Resumes the LRO from the provided token. - ResumeToken string } // ProtectedItemClientBeginPlannedFailoverOptions contains the optional parameters for the ProtectedItemClient.BeginPlannedFailover // method. type ProtectedItemClientBeginPlannedFailoverOptions struct { - // Planned failover model. - Body *PlannedFailoverModel + // Resumes the long-running operation from the provided token. + ResumeToken string +} - // Resumes the LRO from the provided token. +// ProtectedItemClientBeginUpdateOptions contains the optional parameters for the ProtectedItemClient.BeginUpdate method. +type ProtectedItemClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -183,36 +256,37 @@ type ProtectedItemClientGetOptions struct { // ProtectedItemClientListOptions contains the optional parameters for the ProtectedItemClient.NewListPager method. type ProtectedItemClientListOptions struct { - // placeholder for future optional parameters -} + // Continuation token. + ContinuationToken *string -// ProtectedItemOperationStatusClientGetOptions contains the optional parameters for the ProtectedItemOperationStatusClient.Get -// method. -type ProtectedItemOperationStatusClientGetOptions struct { - // placeholder for future optional parameters + // OData options. + OdataOptions *string + + // Page size. + PageSize *int32 } -// RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. -type RecoveryPointsClientGetOptions struct { +// RecoveryPointClientGetOptions contains the optional parameters for the RecoveryPointClient.Get method. +type RecoveryPointClientGetOptions struct { // placeholder for future optional parameters } -// RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.NewListPager method. -type RecoveryPointsClientListOptions struct { +// RecoveryPointClientListOptions contains the optional parameters for the RecoveryPointClient.NewListPager method. +type RecoveryPointClientListOptions struct { // placeholder for future optional parameters } // ReplicationExtensionClientBeginCreateOptions contains the optional parameters for the ReplicationExtensionClient.BeginCreate // method. type ReplicationExtensionClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ReplicationExtensionClientBeginDeleteOptions contains the optional parameters for the ReplicationExtensionClient.BeginDelete // method. type ReplicationExtensionClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -227,27 +301,21 @@ type ReplicationExtensionClientListOptions struct { // placeholder for future optional parameters } -// ReplicationExtensionOperationStatusClientGetOptions contains the optional parameters for the ReplicationExtensionOperationStatusClient.Get -// method. -type ReplicationExtensionOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - // VaultClientBeginCreateOptions contains the optional parameters for the VaultClient.BeginCreate method. type VaultClientBeginCreateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VaultClientBeginDeleteOptions contains the optional parameters for the VaultClient.BeginDelete method. type VaultClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VaultClientBeginUpdateOptions contains the optional parameters for the VaultClient.BeginUpdate method. type VaultClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -258,8 +326,7 @@ type VaultClientGetOptions struct { // VaultClientListBySubscriptionOptions contains the optional parameters for the VaultClient.NewListBySubscriptionPager method. type VaultClientListBySubscriptionOptions struct { - // Continuation token from the previous call. - ContinuationToken *string + // placeholder for future optional parameters } // VaultClientListOptions contains the optional parameters for the VaultClient.NewListPager method. @@ -267,27 +334,3 @@ type VaultClientListOptions struct { // Continuation token from the previous call. ContinuationToken *string } - -// VaultOperationStatusClientGetOptions contains the optional parameters for the VaultOperationStatusClient.Get method. -type VaultOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} - -// WorkflowClientGetOptions contains the optional parameters for the WorkflowClient.Get method. -type WorkflowClientGetOptions struct { - // placeholder for future optional parameters -} - -// WorkflowClientListOptions contains the optional parameters for the WorkflowClient.NewListPager method. -type WorkflowClientListOptions struct { - // Continuation token. - ContinuationToken *string - - // Filter string. - Filter *string -} - -// WorkflowOperationStatusClientGetOptions contains the optional parameters for the WorkflowOperationStatusClient.Get method. -type WorkflowOperationStatusClientGetOptions struct { - // placeholder for future optional parameters -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client.go index 9917eb0a2277..3386b1a0e840 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_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 armrecoveryservicesdatareplication @@ -46,21 +42,20 @@ func NewPolicyClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreate - Creates the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - policyName - The policy name. -// - body - Policy model. +// - resource - Policy model. // - options - PolicyClientBeginCreateOptions contains the optional parameters for the PolicyClient.BeginCreate method. -func (client *PolicyClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, policyName string, body PolicyModel, options *PolicyClientBeginCreateOptions) (*runtime.Poller[PolicyClientCreateResponse], error) { +func (client *PolicyClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, policyName string, resource PolicyModel, options *PolicyClientBeginCreateOptions) (*runtime.Poller[PolicyClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, vaultName, policyName, body, options) + resp, err := client.create(ctx, resourceGroupName, vaultName, policyName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PolicyClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -73,14 +68,14 @@ func (client *PolicyClient) BeginCreate(ctx context.Context, resourceGroupName s // Create - Creates the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *PolicyClient) create(ctx context.Context, resourceGroupName string, vaultName string, policyName string, body PolicyModel, options *PolicyClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *PolicyClient) create(ctx context.Context, resourceGroupName string, vaultName string, policyName string, resource PolicyModel, options *PolicyClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "PolicyClient.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, vaultName, policyName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, vaultName, policyName, resource, options) if err != nil { return nil, err } @@ -96,7 +91,7 @@ func (client *PolicyClient) create(ctx context.Context, resourceGroupName string } // createCreateRequest creates the Create request. -func (client *PolicyClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, body PolicyModel, options *PolicyClientBeginCreateOptions) (*policy.Request, error) { +func (client *PolicyClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, resource PolicyModel, _ *PolicyClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -119,10 +114,11 @@ func (client *PolicyClient) createCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 @@ -131,7 +127,7 @@ func (client *PolicyClient) createCreateRequest(ctx context.Context, resourceGro // BeginDelete - Removes the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - policyName - The policy name. @@ -143,8 +139,7 @@ func (client *PolicyClient) BeginDelete(ctx context.Context, resourceGroupName s return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PolicyClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -157,7 +152,7 @@ func (client *PolicyClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Removes the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *PolicyClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, policyName string, options *PolicyClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "PolicyClient.BeginDelete" @@ -180,7 +175,7 @@ func (client *PolicyClient) deleteOperation(ctx context.Context, resourceGroupNa } // deleteCreateRequest creates the Delete request. -func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, options *PolicyClientBeginDeleteOptions) (*policy.Request, error) { +func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, _ *PolicyClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -203,7 +198,7 @@ func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -212,7 +207,7 @@ func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Gets the details of the policy. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - policyName - The policy name. @@ -240,7 +235,7 @@ func (client *PolicyClient) Get(ctx context.Context, resourceGroupName string, v } // getCreateRequest creates the Get request. -func (client *PolicyClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, options *PolicyClientGetOptions) (*policy.Request, error) { +func (client *PolicyClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, _ *PolicyClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -263,7 +258,7 @@ func (client *PolicyClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -280,7 +275,7 @@ func (client *PolicyClient) getHandleResponse(resp *http.Response) (PolicyClient // NewListPager - Gets the list of policies in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - PolicyClientListOptions contains the optional parameters for the PolicyClient.NewListPager method. @@ -308,7 +303,7 @@ func (client *PolicyClient) NewListPager(resourceGroupName string, vaultName str } // listCreateRequest creates the List request. -func (client *PolicyClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *PolicyClientListOptions) (*policy.Request, error) { +func (client *PolicyClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *PolicyClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -327,7 +322,7 @@ func (client *PolicyClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -336,7 +331,7 @@ func (client *PolicyClient) listCreateRequest(ctx context.Context, resourceGroup // listHandleResponse handles the List response. func (client *PolicyClient) listHandleResponse(resp *http.Response) (PolicyClientListResponse, error) { result := PolicyClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PolicyModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.PolicyModelListResult); err != nil { return PolicyClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client_example_test.go index b1c2cb3b8c9e..e1d54f59d1ea 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policy_client_example_test.go @@ -1,140 +1,123 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// 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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Get.json -func ExamplePolicyClient_Get() { +// Generated from example definition: 2024-09-01/Policy_Create.json +func ExamplePolicyClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewPolicyClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "wdqsacasc", nil) + poller, err := clientFactory.NewPolicyClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "fafqwc", armrecoveryservicesdatareplication.PolicyModel{ + Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{}, + }, 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.PolicyModel = armrecoveryservicesdatareplication.PolicyModel{ - // Name: to.Ptr("ocmty"), - // Type: to.Ptr("pvltqld"), - // ID: to.Ptr("ffivjzdtqgguqlenedikvdilazliwm"), - // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.PolicyModelCustomProperties{ - // InstanceType: to.Ptr("PolicyModelCustomProperties"), + // res = armrecoveryservicesdatareplication.PolicyClientCreateResponse{ + // PolicyModel: &armrecoveryservicesdatareplication.PolicyModel{ + // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/replicationPolicies/policy1"), + // Name: to.Ptr("ocmty"), + // Type: to.Ptr("pvltqld"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), + // LastModifiedBy: to.Ptr("xy"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.PolicyModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), - // CreatedByType: to.Ptr("qwzrkjsfloruegijrfnfpn"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // LastModifiedBy: to.Ptr("xy"), - // LastModifiedByType: to.Ptr("rnc"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Create.json -func ExamplePolicyClient_BeginCreate() { +// Generated from example definition: 2024-09-01/Policy_Delete.json +func ExamplePolicyClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPolicyClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "fafqwc", armrecoveryservicesdatareplication.PolicyModel{ - Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.PolicyModelCustomProperties{ - InstanceType: to.Ptr("PolicyModelCustomProperties"), - }, - }, - }, nil) + poller, err := clientFactory.NewPolicyClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "wqfscsdv", 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) } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PolicyModel = armrecoveryservicesdatareplication.PolicyModel{ - // Name: to.Ptr("ocmty"), - // Type: to.Ptr("pvltqld"), - // ID: to.Ptr("ffivjzdtqgguqlenedikvdilazliwm"), - // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.PolicyModelCustomProperties{ - // InstanceType: to.Ptr("PolicyModelCustomProperties"), - // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.PolicyModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), - // CreatedByType: to.Ptr("qwzrkjsfloruegijrfnfpn"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // LastModifiedBy: to.Ptr("xy"), - // LastModifiedByType: to.Ptr("rnc"), - // }, - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_Delete.json -func ExamplePolicyClient_BeginDelete() { +// Generated from example definition: 2024-09-01/Policy_Get.json +func ExamplePolicyClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewPolicyClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "wqfscsdv", nil) + res, err := clientFactory.NewPolicyClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "wdqsacasc", 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) - } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armrecoveryservicesdatareplication.PolicyClientGetResponse{ + // PolicyModel: &armrecoveryservicesdatareplication.PolicyModel{ + // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/replicationPolicies/policy1"), + // Name: to.Ptr("ocmty"), + // Type: to.Ptr("pvltqld"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), + // LastModifiedBy: to.Ptr("xy"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Policy_List.json +// Generated from example definition: 2024-09-01/Policy_List.json func ExamplePolicyClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -149,27 +132,25 @@ func ExamplePolicyClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.PolicyModelCollection = armrecoveryservicesdatareplication.PolicyModelCollection{ - // Value: []*armrecoveryservicesdatareplication.PolicyModel{ - // { - // Name: to.Ptr("ocmty"), - // Type: to.Ptr("pvltqld"), - // ID: to.Ptr("ffivjzdtqgguqlenedikvdilazliwm"), - // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.PolicyModelCustomProperties{ - // InstanceType: to.Ptr("PolicyModelCustomProperties"), + // page = armrecoveryservicesdatareplication.PolicyClientListResponse{ + // PolicyModelListResult: armrecoveryservicesdatareplication.PolicyModelListResult{ + // Value: []*armrecoveryservicesdatareplication.PolicyModel{ + // { + // Properties: &armrecoveryservicesdatareplication.PolicyModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/replicationPolicies/policy1"), + // Name: to.Ptr("ocmty"), + // Type: to.Ptr("pvltqld"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), + // LastModifiedBy: to.Ptr("xy"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.PolicyModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // CreatedBy: to.Ptr("yiaelkrpuzsfumovsxeb"), - // CreatedByType: to.Ptr("qwzrkjsfloruegijrfnfpn"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:54.713Z"); return t}()), - // LastModifiedBy: to.Ptr("xy"), - // LastModifiedByType: to.Ptr("rnc"), // }, - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client.go deleted file mode 100644 index 14244c942f19..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client.go +++ /dev/null @@ -1,119 +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 armrecoveryservicesdatareplication - -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" -) - -// PolicyOperationStatusClient contains the methods for the PolicyOperationStatus group. -// Don't use this type directly, use NewPolicyOperationStatusClient() instead. -type PolicyOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewPolicyOperationStatusClient creates a new instance of PolicyOperationStatusClient 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 NewPolicyOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PolicyOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &PolicyOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the policy. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. -// - policyName - The policy name. -// - operationID - The ID of an ongoing async operation. -// - options - PolicyOperationStatusClientGetOptions contains the optional parameters for the PolicyOperationStatusClient.Get -// method. -func (client *PolicyOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, policyName string, operationID string, options *PolicyOperationStatusClientGetOptions) (PolicyOperationStatusClientGetResponse, error) { - var err error - const operationName = "PolicyOperationStatusClient.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, vaultName, policyName, operationID, options) - if err != nil { - return PolicyOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return PolicyOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return PolicyOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *PolicyOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, policyName string, operationID string, options *PolicyOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationPolicies/{policyName}/operations/{operationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if policyName == "" { - return nil, errors.New("parameter policyName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{policyName}", url.PathEscape(policyName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - 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-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PolicyOperationStatusClient) getHandleResponse(resp *http.Response) (PolicyOperationStatusClientGetResponse, error) { - result := PolicyOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return PolicyOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client_example_test.go deleted file mode 100644 index a1f17fb1c935..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/policyoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/PolicyOperationStatus_Get.json -func ExamplePolicyOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewPolicyOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "xczxcwec", "wdqfsdxv", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/polymorphic_helpers.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/polymorphic_helpers.go index 286a31af02aa..4aef56029ca0 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/polymorphic_helpers.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/polymorphic_helpers.go @@ -1,29 +1,27 @@ -//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 armrecoveryservicesdatareplication import "encoding/json" -func unmarshalDraModelCustomPropertiesClassification(rawMsg json.RawMessage) (DraModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalEventModelCustomPropertiesClassification(rawMsg json.RawMessage) (EventModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b DraModelCustomPropertiesClassification + var b EventModelCustomPropertiesClassification switch m["instanceType"] { - case "VMware": - b = &VMwareDraModelCustomProperties{} + case "HyperVToAzStackHCI": + b = &HyperVToAzStackHCIEventModelCustomProperties{} + case "VMwareToAzStackHCI": + b = &VMwareToAzStackHCIEventModelCustomProperties{} default: - b = &DraModelCustomProperties{} + b = &EventModelCustomProperties{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -31,20 +29,20 @@ func unmarshalDraModelCustomPropertiesClassification(rawMsg json.RawMessage) (Dr return b, nil } -func unmarshalEventModelCustomPropertiesClassification(rawMsg json.RawMessage) (EventModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalFabricAgentModelCustomPropertiesClassification(rawMsg json.RawMessage) (FabricAgentModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b EventModelCustomPropertiesClassification + var b FabricAgentModelCustomPropertiesClassification switch m["instanceType"] { - case "HyperVToAzStackHCI": - b = &HyperVToAzStackHCIEventModelCustomProperties{} + case "VMware": + b = &VMwareFabricAgentModelCustomProperties{} default: - b = &EventModelCustomProperties{} + b = &FabricAgentModelCustomProperties{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -53,7 +51,7 @@ func unmarshalEventModelCustomPropertiesClassification(rawMsg json.RawMessage) ( } func unmarshalFabricModelCustomPropertiesClassification(rawMsg json.RawMessage) (FabricModelCustomPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -77,8 +75,33 @@ func unmarshalFabricModelCustomPropertiesClassification(rawMsg json.RawMessage) return b, nil } +func unmarshalJobModelCustomPropertiesClassification(rawMsg json.RawMessage) (JobModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b JobModelCustomPropertiesClassification + switch m["instanceType"] { + case "FailoverJobDetails": + b = &FailoverJobModelCustomProperties{} + case "TestFailoverCleanupJobDetails": + b = &TestFailoverCleanupJobModelCustomProperties{} + case "TestFailoverJobDetails": + b = &TestFailoverJobModelCustomProperties{} + default: + b = &JobModelCustomProperties{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + func unmarshalPlannedFailoverModelCustomPropertiesClassification(rawMsg json.RawMessage) (PlannedFailoverModelCustomPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -101,7 +124,7 @@ func unmarshalPlannedFailoverModelCustomPropertiesClassification(rawMsg json.Raw } func unmarshalPolicyModelCustomPropertiesClassification(rawMsg json.RawMessage) (PolicyModelCustomPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -124,7 +147,7 @@ func unmarshalPolicyModelCustomPropertiesClassification(rawMsg json.RawMessage) } func unmarshalProtectedItemModelCustomPropertiesClassification(rawMsg json.RawMessage) (ProtectedItemModelCustomPropertiesClassification, error) { - if rawMsg == nil { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any @@ -146,20 +169,22 @@ func unmarshalProtectedItemModelCustomPropertiesClassification(rawMsg json.RawMe return b, nil } -func unmarshalRecoveryPointModelCustomPropertiesClassification(rawMsg json.RawMessage) (RecoveryPointModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalProtectedItemModelCustomPropertiesUpdateClassification(rawMsg json.RawMessage) (ProtectedItemModelCustomPropertiesUpdateClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b RecoveryPointModelCustomPropertiesClassification + var b ProtectedItemModelCustomPropertiesUpdateClassification switch m["instanceType"] { case "HyperVToAzStackHCI": - b = &HyperVToAzStackHCIRecoveryPointModelCustomProperties{} + b = &HyperVToAzStackHCIProtectedItemModelCustomPropertiesUpdate{} + case "VMwareToAzStackHCI": + b = &VMwareToAzStackHCIProtectedItemModelCustomPropertiesUpdate{} default: - b = &RecoveryPointModelCustomProperties{} + b = &ProtectedItemModelCustomPropertiesUpdate{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -167,22 +192,22 @@ func unmarshalRecoveryPointModelCustomPropertiesClassification(rawMsg json.RawMe return b, nil } -func unmarshalReplicationExtensionModelCustomPropertiesClassification(rawMsg json.RawMessage) (ReplicationExtensionModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalRecoveryPointModelCustomPropertiesClassification(rawMsg json.RawMessage) (RecoveryPointModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b ReplicationExtensionModelCustomPropertiesClassification + var b RecoveryPointModelCustomPropertiesClassification switch m["instanceType"] { case "HyperVToAzStackHCI": - b = &HyperVToAzStackHCIReplicationExtensionModelCustomProperties{} - case "VMwareToAzStackHCI": - b = &VMwareToAzStackHCIReplicationExtensionModelCustomProperties{} + b = &HyperVToAzStackHCIRecoveryPointModelCustomProperties{} + case "VMwareToAzStackHCIRecoveryPointModelCustomProperties": + b = &VMwareToAzStackHCIRecoveryPointModelCustomProperties{} default: - b = &ReplicationExtensionModelCustomProperties{} + b = &RecoveryPointModelCustomProperties{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -190,24 +215,22 @@ func unmarshalReplicationExtensionModelCustomPropertiesClassification(rawMsg jso return b, nil } -func unmarshalWorkflowModelCustomPropertiesClassification(rawMsg json.RawMessage) (WorkflowModelCustomPropertiesClassification, error) { - if rawMsg == nil { +func unmarshalReplicationExtensionModelCustomPropertiesClassification(rawMsg json.RawMessage) (ReplicationExtensionModelCustomPropertiesClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } var m map[string]any if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b WorkflowModelCustomPropertiesClassification + var b ReplicationExtensionModelCustomPropertiesClassification switch m["instanceType"] { - case "FailoverWorkflowDetails": - b = &FailoverWorkflowModelCustomProperties{} - case "TestFailoverCleanupWorkflowDetails": - b = &TestFailoverCleanupWorkflowModelCustomProperties{} - case "TestFailoverWorkflowDetails": - b = &TestFailoverWorkflowModelCustomProperties{} + case "HyperVToAzStackHCI": + b = &HyperVToAzStackHCIReplicationExtensionModelCustomProperties{} + case "VMwareToAzStackHCI": + b = &VMwareToAzStackHCIReplicationExtensionModelCustomProperties{} default: - b = &WorkflowModelCustomProperties{} + b = &ReplicationExtensionModelCustomProperties{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client.go new file mode 100644 index 000000000000..fedf5a4caa8c --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client.go @@ -0,0 +1,407 @@ +// Copyright (c) Microsoft 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 armrecoveryservicesdatareplication + +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" +) + +// PrivateEndpointConnectionProxiesClient contains the methods for the PrivateEndpointConnectionProxies group. +// Don't use this type directly, use NewPrivateEndpointConnectionProxiesClient() instead. +type PrivateEndpointConnectionProxiesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionProxiesClient creates a new instance of PrivateEndpointConnectionProxiesClient 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 NewPrivateEndpointConnectionProxiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionProxiesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionProxiesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create a new private endpoint connection proxy which includes both auto and manual approval types. Creating the +// proxy resource will also create a private endpoint connection resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionProxyName - The private endpoint connection proxy name. +// - resource - Private endpoint connection creation input. +// - options - PrivateEndpointConnectionProxiesClientCreateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Create +// method. +func (client *PrivateEndpointConnectionProxiesClient) Create(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, resource PrivateEndpointConnectionProxy, options *PrivateEndpointConnectionProxiesClientCreateOptions) (PrivateEndpointConnectionProxiesClientCreateResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionProxiesClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionProxyName, resource, options) + if err != nil { + return PrivateEndpointConnectionProxiesClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionProxiesClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionProxiesClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *PrivateEndpointConnectionProxiesClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, resource PrivateEndpointConnectionProxy, _ *PrivateEndpointConnectionProxiesClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionProxyName == "" { + return nil, errors.New("parameter privateEndpointConnectionProxyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionProxyName}", url.PathEscape(privateEndpointConnectionProxyName)) + 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-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, resource); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *PrivateEndpointConnectionProxiesClient) createHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientCreateResponse, error) { + result := PrivateEndpointConnectionProxiesClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxy); err != nil { + return PrivateEndpointConnectionProxiesClientCreateResponse{}, err + } + return result, nil +} + +// BeginDelete - Returns the operation to track the deletion of private endpoint connection proxy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionProxyName - The private endpoint connection proxy name. +// - options - PrivateEndpointConnectionProxiesClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionProxiesClient) BeginDelete(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionProxiesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vaultName, privateEndpointConnectionProxyName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionProxiesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionProxiesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Returns the operation to track the deletion of private endpoint connection proxy. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +func (client *PrivateEndpointConnectionProxiesClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionProxiesClient.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, vaultName, privateEndpointConnectionProxyName, 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 *PrivateEndpointConnectionProxiesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, _ *PrivateEndpointConnectionProxiesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionProxyName == "" { + return nil, errors.New("parameter privateEndpointConnectionProxyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionProxyName}", url.PathEscape(privateEndpointConnectionProxyName)) + 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-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the private endpoint connection proxy details. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionProxyName - The private endpoint connection proxy name. +// - options - PrivateEndpointConnectionProxiesClientGetOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Get +// method. +func (client *PrivateEndpointConnectionProxiesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, options *PrivateEndpointConnectionProxiesClientGetOptions) (PrivateEndpointConnectionProxiesClientGetResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionProxiesClient.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, vaultName, privateEndpointConnectionProxyName, options) + if err != nil { + return PrivateEndpointConnectionProxiesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionProxiesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionProxiesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionProxiesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, _ *PrivateEndpointConnectionProxiesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionProxyName == "" { + return nil, errors.New("parameter privateEndpointConnectionProxyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionProxyName}", url.PathEscape(privateEndpointConnectionProxyName)) + 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-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 *PrivateEndpointConnectionProxiesClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientGetResponse, error) { + result := PrivateEndpointConnectionProxiesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxy); err != nil { + return PrivateEndpointConnectionProxiesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the all private endpoint connections proxies. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - options - PrivateEndpointConnectionProxiesClientListOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.NewListPager +// method. +func (client *PrivateEndpointConnectionProxiesClient) NewListPager(resourceGroupName string, vaultName string, options *PrivateEndpointConnectionProxiesClientListOptions) *runtime.Pager[PrivateEndpointConnectionProxiesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionProxiesClientListResponse]{ + More: func(page PrivateEndpointConnectionProxiesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionProxiesClientListResponse) (PrivateEndpointConnectionProxiesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionProxiesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, vaultName, options) + }, nil) + if err != nil { + return PrivateEndpointConnectionProxiesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateEndpointConnectionProxiesClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *PrivateEndpointConnectionProxiesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + 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-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 *PrivateEndpointConnectionProxiesClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientListResponse, error) { + result := PrivateEndpointConnectionProxiesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxyListResult); err != nil { + return PrivateEndpointConnectionProxiesClientListResponse{}, err + } + return result, nil +} + +// Validate - Returns remote private endpoint connection information after validation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionProxyName - The private endpoint connection proxy name. +// - body - The private endpoint connection proxy input. +// - options - PrivateEndpointConnectionProxiesClientValidateOptions contains the optional parameters for the PrivateEndpointConnectionProxiesClient.Validate +// method. +func (client *PrivateEndpointConnectionProxiesClient) Validate(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, body PrivateEndpointConnectionProxy, options *PrivateEndpointConnectionProxiesClientValidateOptions) (PrivateEndpointConnectionProxiesClientValidateResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionProxiesClient.Validate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateCreateRequest(ctx, resourceGroupName, vaultName, privateEndpointConnectionProxyName, body, options) + if err != nil { + return PrivateEndpointConnectionProxiesClientValidateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionProxiesClientValidateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionProxiesClientValidateResponse{}, err + } + resp, err := client.validateHandleResponse(httpResp) + return resp, err +} + +// validateCreateRequest creates the Validate request. +func (client *PrivateEndpointConnectionProxiesClient) validateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionProxyName string, body PrivateEndpointConnectionProxy, _ *PrivateEndpointConnectionProxiesClientValidateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnectionProxies/{privateEndpointConnectionProxyName}/validate" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionProxyName == "" { + return nil, errors.New("parameter privateEndpointConnectionProxyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionProxyName}", url.PathEscape(privateEndpointConnectionProxyName)) + 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 +} + +// validateHandleResponse handles the Validate response. +func (client *PrivateEndpointConnectionProxiesClient) validateHandleResponse(resp *http.Response) (PrivateEndpointConnectionProxiesClientValidateResponse, error) { + result := PrivateEndpointConnectionProxiesClientValidateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionProxy); err != nil { + return PrivateEndpointConnectionProxiesClientValidateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client_example_test.go new file mode 100644 index 000000000000..8976bed4bfff --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnectionproxies_client_example_test.go @@ -0,0 +1,501 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" +) + +// Generated from example definition: 2024-09-01/PrivateEndpointConnectionProxy_Create.json +func ExamplePrivateEndpointConnectionProxiesClient_Create() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionProxiesClient().Create(ctx, "rgswagger_2024-09-01", "4", "d", armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy{ + Etag: to.Ptr("hruibxrezstxroxrxweh"), + Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyProperties{ + RemotePrivateEndpoint: &armrecoveryservicesdatareplication.RemotePrivateEndpoint{ + ID: to.Ptr("yipalno"), + PrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + { + Name: to.Ptr("jqwntlzfsksl"), + GroupIDs: []*string{ + to.Ptr("hvejynjktikteipnioyeja"), + }, + RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + }, + }, + ManualPrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + { + Name: to.Ptr("jqwntlzfsksl"), + GroupIDs: []*string{ + to.Ptr("hvejynjktikteipnioyeja"), + }, + RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + }, + }, + PrivateLinkServiceProxies: []*armrecoveryservicesdatareplication.PrivateLinkServiceProxy{ + { + ID: to.Ptr("nzqxevuyqeedrqnkbnlcyrrrbzxvl"), + RemotePrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + Description: to.Ptr("y"), + ActionsRequired: to.Ptr("afwbq"), + }, + RemotePrivateEndpointConnection: &armrecoveryservicesdatareplication.RemotePrivateEndpointConnection{ + ID: to.Ptr("ocunsgawjsqohkrcyxiv"), + }, + GroupConnectivityInformation: []*armrecoveryservicesdatareplication.GroupConnectivityInformation{ + { + GroupID: to.Ptr("per"), + MemberName: to.Ptr("ybptuypgdqoxkuwqx"), + CustomerVisibleFqdns: []*string{ + to.Ptr("vedcg"), + }, + InternalFqdn: to.Ptr("maqavwhxwzzhbzjbryyquvitmup"), + RedirectMapID: to.Ptr("pezncxcq"), + PrivateLinkServiceArmRegion: to.Ptr("rerkqqxinteevmlbrdkktaqhcch"), + }, + }, + }, + }, + ConnectionDetails: []*armrecoveryservicesdatareplication.ConnectionDetails{ + { + ID: to.Ptr("lenqkogzkes"), + PrivateIPAddress: to.Ptr("cyiacdzzyqmxjpijjbwgasegehtqe"), + LinkIdentifier: to.Ptr("ravfufhkdowufd"), + GroupID: to.Ptr("pjrlygpadir"), + MemberName: to.Ptr("ybuysjrlfupewxe"), + }, + }, + }, + }, + }, 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientCreateResponse{ + // PrivateEndpointConnectionProxy: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnectionProxies/proxy1"), + // Name: to.Ptr("wrbeymbilwm"), + // Type: to.Ptr("xpfgxxykisvjcifsnlvtgjakwifak"), + // Etag: to.Ptr("hruibxrezstxroxrxweh"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyProperties{ + // RemotePrivateEndpoint: &armrecoveryservicesdatareplication.RemotePrivateEndpoint{ + // ID: to.Ptr("yipalno"), + // PrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // ManualPrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // PrivateLinkServiceProxies: []*armrecoveryservicesdatareplication.PrivateLinkServiceProxy{ + // { + // ID: to.Ptr("nzqxevuyqeedrqnkbnlcyrrrbzxvl"), + // RemotePrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // RemotePrivateEndpointConnection: &armrecoveryservicesdatareplication.RemotePrivateEndpointConnection{ + // ID: to.Ptr("ocunsgawjsqohkrcyxiv"), + // }, + // GroupConnectivityInformation: []*armrecoveryservicesdatareplication.GroupConnectivityInformation{ + // { + // GroupID: to.Ptr("per"), + // MemberName: to.Ptr("ybptuypgdqoxkuwqx"), + // CustomerVisibleFqdns: []*string{ + // to.Ptr("vedcg"), + // }, + // InternalFqdn: to.Ptr("maqavwhxwzzhbzjbryyquvitmup"), + // RedirectMapID: to.Ptr("pezncxcq"), + // PrivateLinkServiceArmRegion: to.Ptr("rerkqqxinteevmlbrdkktaqhcch"), + // }, + // }, + // }, + // }, + // ConnectionDetails: []*armrecoveryservicesdatareplication.ConnectionDetails{ + // { + // ID: to.Ptr("lenqkogzkes"), + // PrivateIPAddress: to.Ptr("cyiacdzzyqmxjpijjbwgasegehtqe"), + // LinkIdentifier: to.Ptr("ravfufhkdowufd"), + // GroupID: to.Ptr("pjrlygpadir"), + // MemberName: to.Ptr("ybuysjrlfupewxe"), + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/PrivateEndpointConnectionProxy_Delete.json +func ExamplePrivateEndpointConnectionProxiesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrivateEndpointConnectionProxiesClient().BeginDelete(ctx, "rgswagger_2024-09-01", "4", "d", 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/PrivateEndpointConnectionProxy_Get.json +func ExamplePrivateEndpointConnectionProxiesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionProxiesClient().Get(ctx, "rgswagger_2024-09-01", "4", "d", 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientGetResponse{ + // PrivateEndpointConnectionProxy: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnectionProxies/proxy1"), + // Name: to.Ptr("wrbeymbilwm"), + // Type: to.Ptr("xpfgxxykisvjcifsnlvtgjakwifak"), + // Etag: to.Ptr("hruibxrezstxroxrxweh"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyProperties{ + // RemotePrivateEndpoint: &armrecoveryservicesdatareplication.RemotePrivateEndpoint{ + // ID: to.Ptr("yipalno"), + // PrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // ManualPrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // PrivateLinkServiceProxies: []*armrecoveryservicesdatareplication.PrivateLinkServiceProxy{ + // { + // ID: to.Ptr("nzqxevuyqeedrqnkbnlcyrrrbzxvl"), + // RemotePrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // RemotePrivateEndpointConnection: &armrecoveryservicesdatareplication.RemotePrivateEndpointConnection{ + // ID: to.Ptr("ocunsgawjsqohkrcyxiv"), + // }, + // GroupConnectivityInformation: []*armrecoveryservicesdatareplication.GroupConnectivityInformation{ + // { + // GroupID: to.Ptr("per"), + // MemberName: to.Ptr("ybptuypgdqoxkuwqx"), + // CustomerVisibleFqdns: []*string{ + // to.Ptr("vedcg"), + // }, + // InternalFqdn: to.Ptr("maqavwhxwzzhbzjbryyquvitmup"), + // RedirectMapID: to.Ptr("pezncxcq"), + // PrivateLinkServiceArmRegion: to.Ptr("rerkqqxinteevmlbrdkktaqhcch"), + // }, + // }, + // }, + // }, + // ConnectionDetails: []*armrecoveryservicesdatareplication.ConnectionDetails{ + // { + // ID: to.Ptr("lenqkogzkes"), + // PrivateIPAddress: to.Ptr("cyiacdzzyqmxjpijjbwgasegehtqe"), + // LinkIdentifier: to.Ptr("ravfufhkdowufd"), + // GroupID: to.Ptr("pjrlygpadir"), + // MemberName: to.Ptr("ybuysjrlfupewxe"), + // }, + // }, + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/PrivateEndpointConnectionProxy_List.json +func ExamplePrivateEndpointConnectionProxiesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateEndpointConnectionProxiesClient().NewListPager("rgswagger_2024-09-01", "4", 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientListResponse{ + // PrivateEndpointConnectionProxyListResult: armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyListResult{ + // Value: []*armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnectionProxies/proxy1"), + // Name: to.Ptr("wrbeymbilwm"), + // Type: to.Ptr("xpfgxxykisvjcifsnlvtgjakwifak"), + // Etag: to.Ptr("hruibxrezstxroxrxweh"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyProperties{ + // RemotePrivateEndpoint: &armrecoveryservicesdatareplication.RemotePrivateEndpoint{ + // ID: to.Ptr("yipalno"), + // PrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // ManualPrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // PrivateLinkServiceProxies: []*armrecoveryservicesdatareplication.PrivateLinkServiceProxy{ + // { + // ID: to.Ptr("nzqxevuyqeedrqnkbnlcyrrrbzxvl"), + // RemotePrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // RemotePrivateEndpointConnection: &armrecoveryservicesdatareplication.RemotePrivateEndpointConnection{ + // ID: to.Ptr("ocunsgawjsqohkrcyxiv"), + // }, + // GroupConnectivityInformation: []*armrecoveryservicesdatareplication.GroupConnectivityInformation{ + // { + // GroupID: to.Ptr("per"), + // MemberName: to.Ptr("ybptuypgdqoxkuwqx"), + // CustomerVisibleFqdns: []*string{ + // to.Ptr("vedcg"), + // }, + // InternalFqdn: to.Ptr("maqavwhxwzzhbzjbryyquvitmup"), + // RedirectMapID: to.Ptr("pezncxcq"), + // PrivateLinkServiceArmRegion: to.Ptr("rerkqqxinteevmlbrdkktaqhcch"), + // }, + // }, + // }, + // }, + // ConnectionDetails: []*armrecoveryservicesdatareplication.ConnectionDetails{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnections/connection1"), + // PrivateIPAddress: to.Ptr("cyiacdzzyqmxjpijjbwgasegehtqe"), + // LinkIdentifier: to.Ptr("ravfufhkdowufd"), + // GroupID: to.Ptr("pjrlygpadir"), + // MemberName: to.Ptr("ybuysjrlfupewxe"), + // }, + // }, + // }, + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-09-01/PrivateEndpointConnectionProxy_Validate.json +func ExamplePrivateEndpointConnectionProxiesClient_Validate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionProxiesClient().Validate(ctx, "rgswagger_2024-09-01", "4", "d", armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy{ + Etag: to.Ptr("hruibxrezstxroxrxweh"), + Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyProperties{ + RemotePrivateEndpoint: &armrecoveryservicesdatareplication.RemotePrivateEndpoint{ + ID: to.Ptr("yipalno"), + PrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + { + Name: to.Ptr("jqwntlzfsksl"), + GroupIDs: []*string{ + to.Ptr("hvejynjktikteipnioyeja"), + }, + RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + }, + }, + ManualPrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + { + Name: to.Ptr("jqwntlzfsksl"), + GroupIDs: []*string{ + to.Ptr("hvejynjktikteipnioyeja"), + }, + RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + }, + }, + PrivateLinkServiceProxies: []*armrecoveryservicesdatareplication.PrivateLinkServiceProxy{ + { + ID: to.Ptr("nzqxevuyqeedrqnkbnlcyrrrbzxvl"), + RemotePrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + Description: to.Ptr("y"), + ActionsRequired: to.Ptr("afwbq"), + }, + RemotePrivateEndpointConnection: &armrecoveryservicesdatareplication.RemotePrivateEndpointConnection{ + ID: to.Ptr("ocunsgawjsqohkrcyxiv"), + }, + GroupConnectivityInformation: []*armrecoveryservicesdatareplication.GroupConnectivityInformation{ + { + GroupID: to.Ptr("per"), + MemberName: to.Ptr("ybptuypgdqoxkuwqx"), + CustomerVisibleFqdns: []*string{ + to.Ptr("vedcg"), + }, + InternalFqdn: to.Ptr("maqavwhxwzzhbzjbryyquvitmup"), + RedirectMapID: to.Ptr("pezncxcq"), + PrivateLinkServiceArmRegion: to.Ptr("rerkqqxinteevmlbrdkktaqhcch"), + }, + }, + }, + }, + ConnectionDetails: []*armrecoveryservicesdatareplication.ConnectionDetails{ + { + ID: to.Ptr("lenqkogzkes"), + PrivateIPAddress: to.Ptr("cyiacdzzyqmxjpijjbwgasegehtqe"), + LinkIdentifier: to.Ptr("ravfufhkdowufd"), + GroupID: to.Ptr("pjrlygpadir"), + MemberName: to.Ptr("ybuysjrlfupewxe"), + }, + }, + }, + }, + }, 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionProxiesClientValidateResponse{ + // PrivateEndpointConnectionProxy: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxy{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnectionProxies/proxy1"), + // Name: to.Ptr("wrbeymbilwm"), + // Type: to.Ptr("xpfgxxykisvjcifsnlvtgjakwifak"), + // Etag: to.Ptr("hruibxrezstxroxrxweh"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionProxyProperties{ + // RemotePrivateEndpoint: &armrecoveryservicesdatareplication.RemotePrivateEndpoint{ + // ID: to.Ptr("yipalno"), + // PrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // ManualPrivateLinkServiceConnections: []*armrecoveryservicesdatareplication.PrivateLinkServiceConnection{ + // { + // Name: to.Ptr("jqwntlzfsksl"), + // GroupIDs: []*string{ + // to.Ptr("hvejynjktikteipnioyeja"), + // }, + // RequestMessage: to.Ptr("bukgzpkvcvfbmcdmpcbiigbvugicqa"), + // }, + // }, + // PrivateLinkServiceProxies: []*armrecoveryservicesdatareplication.PrivateLinkServiceProxy{ + // { + // ID: to.Ptr("nzqxevuyqeedrqnkbnlcyrrrbzxvl"), + // RemotePrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // RemotePrivateEndpointConnection: &armrecoveryservicesdatareplication.RemotePrivateEndpointConnection{ + // ID: to.Ptr("ocunsgawjsqohkrcyxiv"), + // }, + // GroupConnectivityInformation: []*armrecoveryservicesdatareplication.GroupConnectivityInformation{ + // { + // GroupID: to.Ptr("per"), + // MemberName: to.Ptr("ybptuypgdqoxkuwqx"), + // CustomerVisibleFqdns: []*string{ + // to.Ptr("vedcg"), + // }, + // InternalFqdn: to.Ptr("maqavwhxwzzhbzjbryyquvitmup"), + // RedirectMapID: to.Ptr("pezncxcq"), + // PrivateLinkServiceArmRegion: to.Ptr("rerkqqxinteevmlbrdkktaqhcch"), + // }, + // }, + // }, + // }, + // ConnectionDetails: []*armrecoveryservicesdatareplication.ConnectionDetails{ + // { + // ID: to.Ptr("lenqkogzkes"), + // PrivateIPAddress: to.Ptr("cyiacdzzyqmxjpijjbwgasegehtqe"), + // LinkIdentifier: to.Ptr("ravfufhkdowufd"), + // GroupID: to.Ptr("pjrlygpadir"), + // MemberName: to.Ptr("ybuysjrlfupewxe"), + // }, + // }, + // }, + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client.go new file mode 100644 index 000000000000..b44c69c51bc8 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client.go @@ -0,0 +1,331 @@ +// Copyright (c) Microsoft 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 armrecoveryservicesdatareplication + +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" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient 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 NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginDelete - Deletes the private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionName - The private endpoint connection name. +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, vaultName, privateEndpointConnectionName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the private endpoint connection. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.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, vaultName, privateEndpointConnectionName, 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 *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the private endpoint connection details. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionName - The private endpoint connection name. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.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, vaultName, privateEndpointConnectionName, options) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, _ *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "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 *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { + result := PrivateEndpointConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the all private endpoint connections configured on the vault. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName string, vaultName string, options *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListResponse]{ + More: func(page PrivateEndpointConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListResponse) (PrivateEndpointConnectionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, vaultName, options) + }, nil) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnections" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + 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-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 *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListResponse, error) { + result := PrivateEndpointConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + return result, nil +} + +// Update - Updated the private endpoint connection status (Approval/Rejected). This gets invoked by resource admin. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateEndpointConnectionName - The private endpoint connection name. +// - resource - Private endpoint connection update input. +// - options - PrivateEndpointConnectionsClientUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Update +// method. +func (client *PrivateEndpointConnectionsClient) Update(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, resource PrivateEndpointConnection, options *PrivateEndpointConnectionsClientUpdateOptions) (PrivateEndpointConnectionsClientUpdateResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.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, vaultName, privateEndpointConnectionName, resource, options) + if err != nil { + return PrivateEndpointConnectionsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateEndpointConnectionName string, resource PrivateEndpointConnection, _ *PrivateEndpointConnectionsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "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, resource); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *PrivateEndpointConnectionsClient) updateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientUpdateResponse, error) { + result := PrivateEndpointConnectionsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client_example_test.go new file mode 100644 index 000000000000..6476142b1022 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privateendpointconnections_client_example_test.go @@ -0,0 +1,168 @@ +// Copyright (c) Microsoft 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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" +) + +// Generated from example definition: 2024-09-01/PrivateEndpointConnection_Delete.json +func ExamplePrivateEndpointConnectionsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewPrivateEndpointConnectionsClient().BeginDelete(ctx, "rgswagger_2024-09-01", "4", "sdwqtfhigjirrzhpbmqtzgs", 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/PrivateEndpointConnection_Get.json +func ExamplePrivateEndpointConnectionsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Get(ctx, "rgswagger_2024-09-01", "4", "vbkm", 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientGetResponse{ + // PrivateEndpointConnection: &armrecoveryservicesdatareplication.PrivateEndpointConnection{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnections/connection1"), + // Name: to.Ptr("kadsmyhrosefybpbwvwxs"), + // Type: to.Ptr("ztysngp"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionResponseProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // PrivateEndpoint: &armrecoveryservicesdatareplication.PrivateEndpoint{ + // ID: to.Ptr("cwcdqoynostmqwdwy"), + // }, + // PrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/PrivateEndpointConnection_List.json +func ExamplePrivateEndpointConnectionsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateEndpointConnectionsClient().NewListPager("rgswagger_2024-09-01", "4", 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientListResponse{ + // PrivateEndpointConnectionListResult: armrecoveryservicesdatareplication.PrivateEndpointConnectionListResult{ + // Value: []*armrecoveryservicesdatareplication.PrivateEndpointConnection{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnections/connection1"), + // Name: to.Ptr("kadsmyhrosefybpbwvwxs"), + // Type: to.Ptr("ztysngp"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionResponseProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // PrivateEndpoint: &armrecoveryservicesdatareplication.PrivateEndpoint{ + // ID: to.Ptr("cwcdqoynostmqwdwy"), + // }, + // PrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-09-01/PrivateEndpointConnection_Update.json +func ExamplePrivateEndpointConnectionsClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateEndpointConnectionsClient().Update(ctx, "rgswagger_2024-09-01", "4", "jitf", armrecoveryservicesdatareplication.PrivateEndpointConnection{ + Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionResponseProperties{ + PrivateEndpoint: &armrecoveryservicesdatareplication.PrivateEndpoint{ + ID: to.Ptr("cwcdqoynostmqwdwy"), + }, + PrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + Description: to.Ptr("y"), + ActionsRequired: to.Ptr("afwbq"), + }, + }, + }, 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 = armrecoveryservicesdatareplication.PrivateEndpointConnectionsClientUpdateResponse{ + // PrivateEndpointConnection: &armrecoveryservicesdatareplication.PrivateEndpointConnection{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateEndpointConnections/connection1"), + // Name: to.Ptr("kadsmyhrosefybpbwvwxs"), + // Type: to.Ptr("ztysngp"), + // Properties: &armrecoveryservicesdatareplication.PrivateEndpointConnectionResponseProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // PrivateEndpoint: &armrecoveryservicesdatareplication.PrivateEndpoint{ + // ID: to.Ptr("cwcdqoynostmqwdwy"), + // }, + // PrivateLinkServiceConnectionState: &armrecoveryservicesdatareplication.PrivateLinkServiceConnectionState{ + // Status: to.Ptr(armrecoveryservicesdatareplication.PrivateEndpointConnectionStatusApproved), + // Description: to.Ptr("y"), + // ActionsRequired: to.Ptr("afwbq"), + // }, + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client.go new file mode 100644 index 000000000000..6e52774d0e69 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client.go @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft 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 armrecoveryservicesdatareplication + +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" +) + +// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. +// Don't use this type directly, use NewPrivateLinkResourcesClient() instead. +type PrivateLinkResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient 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 NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateLinkResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets the details of site recovery private link resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - privateLinkResourceName - The private link name. +// - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get +// method. +func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, vaultName string, privateLinkResourceName string, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { + var err error + const operationName = "PrivateLinkResourcesClient.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, vaultName, privateLinkResourceName, options) + if err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, privateLinkResourceName string, _ *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateLinkResources/{privateLinkResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if privateLinkResourceName == "" { + return nil, errors.New("parameter privateLinkResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkResourceName}", url.PathEscape(privateLinkResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "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 *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesClientGetResponse, error) { + result := PrivateLinkResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets the list of private link resources. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager +// method. +func (client *PrivateLinkResourcesClient) NewListPager(resourceGroupName string, vaultName string, options *PrivateLinkResourcesClientListOptions) *runtime.Pager[PrivateLinkResourcesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListResponse]{ + More: func(page PrivateLinkResourcesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinkResourcesClientListResponse) (PrivateLinkResourcesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinkResourcesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, vaultName, options) + }, nil) + if err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *PrivateLinkResourcesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/privateLinkResources" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + 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-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 *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListResponse, error) { + result := PrivateLinkResourcesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client_example_test.go new file mode 100644 index 000000000000..b57b6e03d439 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/privatelinkresources_client_example_test.go @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft 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 armrecoveryservicesdatareplication_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" +) + +// Generated from example definition: 2024-09-01/PrivateLinkResource_Get.json +func ExamplePrivateLinkResourcesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewPrivateLinkResourcesClient().Get(ctx, "rgswagger_2024-09-01", "4", "d", 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 = armrecoveryservicesdatareplication.PrivateLinkResourcesClientGetResponse{ + // PrivateLinkResource: &armrecoveryservicesdatareplication.PrivateLinkResource{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateLinkResources/link1"), + // Name: to.Ptr("u"), + // Type: to.Ptr("ydabrhxuyafq"), + // Properties: &armrecoveryservicesdatareplication.PrivateLinkResourceProperties{ + // GroupID: to.Ptr("dzkqscbkzs"), + // RequiredMembers: []*string{ + // to.Ptr("irjjsneakjewcsigcocfdjvfad"), + // }, + // RequiredZoneNames: []*string{ + // to.Ptr("yp"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/PrivateLinkResource_List.json +func ExamplePrivateLinkResourcesClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewPrivateLinkResourcesClient().NewListPager("rgswagger_2024-09-01", "4", 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 = armrecoveryservicesdatareplication.PrivateLinkResourcesClientListResponse{ + // PrivateLinkResourceListResult: armrecoveryservicesdatareplication.PrivateLinkResourceListResult{ + // Value: []*armrecoveryservicesdatareplication.PrivateLinkResource{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/privateLinkResources/link1"), + // Name: to.Ptr("u"), + // Type: to.Ptr("ydabrhxuyafq"), + // Properties: &armrecoveryservicesdatareplication.PrivateLinkResourceProperties{ + // GroupID: to.Ptr("dzkqscbkzs"), + // RequiredMembers: []*string{ + // to.Ptr("irjjsneakjewcsigcocfdjvfad"), + // }, + // RequiredZoneNames: []*string{ + // to.Ptr("yp"), + // }, + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client.go index 0d7def263234..05b4c256a77a 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_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 armrecoveryservicesdatareplication @@ -47,22 +43,21 @@ func NewProtectedItemClient(subscriptionID string, credential azcore.TokenCreden // BeginCreate - Creates the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. -// - body - Protected item model. +// - resource - Protected item model. // - options - ProtectedItemClientBeginCreateOptions contains the optional parameters for the ProtectedItemClient.BeginCreate // method. -func (client *ProtectedItemClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body ProtectedItemModel, options *ProtectedItemClientBeginCreateOptions) (*runtime.Poller[ProtectedItemClientCreateResponse], error) { +func (client *ProtectedItemClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, resource ProtectedItemModel, options *ProtectedItemClientBeginCreateOptions) (*runtime.Poller[ProtectedItemClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, vaultName, protectedItemName, body, options) + resp, err := client.create(ctx, resourceGroupName, vaultName, protectedItemName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProtectedItemClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -75,14 +70,14 @@ func (client *ProtectedItemClient) BeginCreate(ctx context.Context, resourceGrou // Create - Creates the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *ProtectedItemClient) create(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body ProtectedItemModel, options *ProtectedItemClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *ProtectedItemClient) create(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, resource ProtectedItemModel, options *ProtectedItemClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ProtectedItemClient.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, vaultName, protectedItemName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, vaultName, protectedItemName, resource, options) if err != nil { return nil, err } @@ -98,7 +93,7 @@ func (client *ProtectedItemClient) create(ctx context.Context, resourceGroupName } // createCreateRequest creates the Create request. -func (client *ProtectedItemClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body ProtectedItemModel, options *ProtectedItemClientBeginCreateOptions) (*policy.Request, error) { +func (client *ProtectedItemClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, resource ProtectedItemModel, _ *ProtectedItemClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -121,10 +116,11 @@ func (client *ProtectedItemClient) createCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 @@ -133,7 +129,7 @@ func (client *ProtectedItemClient) createCreateRequest(ctx context.Context, reso // BeginDelete - Removes the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. @@ -146,8 +142,7 @@ func (client *ProtectedItemClient) BeginDelete(ctx context.Context, resourceGrou return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProtectedItemClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -160,7 +155,7 @@ func (client *ProtectedItemClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Removes the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *ProtectedItemClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ProtectedItemClient.BeginDelete" @@ -206,10 +201,10 @@ func (client *ProtectedItemClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ForceDelete != nil { reqQP.Set("forceDelete", strconv.FormatBool(*options.ForceDelete)) } - reqQP.Set("api-version", "2021-02-16-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,7 +213,7 @@ func (client *ProtectedItemClient) deleteCreateRequest(ctx context.Context, reso // Get - Gets the details of the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. @@ -246,7 +241,7 @@ func (client *ProtectedItemClient) Get(ctx context.Context, resourceGroupName st } // getCreateRequest creates the Get request. -func (client *ProtectedItemClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientGetOptions) (*policy.Request, error) { +func (client *ProtectedItemClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, _ *ProtectedItemClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -269,7 +264,7 @@ func (client *ProtectedItemClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -286,7 +281,7 @@ func (client *ProtectedItemClient) getHandleResponse(resp *http.Response) (Prote // NewListPager - Gets the list of protected items in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - ProtectedItemClientListOptions contains the optional parameters for the ProtectedItemClient.NewListPager method. @@ -333,7 +328,16 @@ func (client *ProtectedItemClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") + if options != nil && options.ContinuationToken != nil { + reqQP.Set("continuationToken", *options.ContinuationToken) + } + if options != nil && options.OdataOptions != nil { + reqQP.Set("odataOptions", *options.OdataOptions) + } + if options != nil && options.PageSize != nil { + reqQP.Set("pageSize", strconv.FormatInt(int64(*options.PageSize), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -342,7 +346,7 @@ func (client *ProtectedItemClient) listCreateRequest(ctx context.Context, resour // listHandleResponse handles the List response. func (client *ProtectedItemClient) listHandleResponse(resp *http.Response) (ProtectedItemClientListResponse, error) { result := ProtectedItemClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ProtectedItemModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ProtectedItemModelListResult); err != nil { return ProtectedItemClientListResponse{}, err } return result, nil @@ -351,21 +355,21 @@ func (client *ProtectedItemClient) listHandleResponse(resp *http.Response) (Prot // BeginPlannedFailover - Performs the planned failover on the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. +// - body - Planned failover model. // - options - ProtectedItemClientBeginPlannedFailoverOptions contains the optional parameters for the ProtectedItemClient.BeginPlannedFailover // method. -func (client *ProtectedItemClient) BeginPlannedFailover(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientBeginPlannedFailoverOptions) (*runtime.Poller[ProtectedItemClientPlannedFailoverResponse], error) { +func (client *ProtectedItemClient) BeginPlannedFailover(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body PlannedFailoverModel, options *ProtectedItemClientBeginPlannedFailoverOptions) (*runtime.Poller[ProtectedItemClientPlannedFailoverResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.plannedFailover(ctx, resourceGroupName, vaultName, protectedItemName, options) + resp, err := client.plannedFailover(ctx, resourceGroupName, vaultName, protectedItemName, body, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProtectedItemClientPlannedFailoverResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -378,14 +382,14 @@ func (client *ProtectedItemClient) BeginPlannedFailover(ctx context.Context, res // PlannedFailover - Performs the planned failover on the protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *ProtectedItemClient) plannedFailover(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientBeginPlannedFailoverOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *ProtectedItemClient) plannedFailover(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body PlannedFailoverModel, options *ProtectedItemClientBeginPlannedFailoverOptions) (*http.Response, error) { var err error const operationName = "ProtectedItemClient.BeginPlannedFailover" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.plannedFailoverCreateRequest(ctx, resourceGroupName, vaultName, protectedItemName, options) + req, err := client.plannedFailoverCreateRequest(ctx, resourceGroupName, vaultName, protectedItemName, body, options) if err != nil { return nil, err } @@ -401,7 +405,7 @@ func (client *ProtectedItemClient) plannedFailover(ctx context.Context, resource } // plannedFailoverCreateRequest creates the PlannedFailover request. -func (client *ProtectedItemClient) plannedFailoverCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *ProtectedItemClientBeginPlannedFailoverOptions) (*policy.Request, error) { +func (client *ProtectedItemClient) plannedFailoverCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, body PlannedFailoverModel, _ *ProtectedItemClientBeginPlannedFailoverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/plannedFailover" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -424,14 +428,98 @@ func (client *ProtectedItemClient) plannedFailoverCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// BeginUpdate - Performs update on the protected item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - vaultName - The vault name. +// - protectedItemName - The protected item name. +// - properties - Protected item model. +// - options - ProtectedItemClientBeginUpdateOptions contains the optional parameters for the ProtectedItemClient.BeginUpdate +// method. +func (client *ProtectedItemClient) BeginUpdate(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, properties ProtectedItemModelUpdate, options *ProtectedItemClientBeginUpdateOptions) (*runtime.Poller[ProtectedItemClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, vaultName, protectedItemName, properties, options) + if err != nil { return nil, err } - return req, nil + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProtectedItemClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProtectedItemClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Performs update on the protected item. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-09-01 +func (client *ProtectedItemClient) update(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, properties ProtectedItemModelUpdate, options *ProtectedItemClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ProtectedItemClient.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, vaultName, protectedItemName, 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 *ProtectedItemClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, properties ProtectedItemModelUpdate, _ *ProtectedItemClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if vaultName == "" { + return nil, errors.New("parameter vaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) + if protectedItemName == "" { + return nil, errors.New("parameter protectedItemName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) + 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-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, properties); err != nil { + return nil, err } return req, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client_example_test.go index defd9c3f155f..9d8aee2bbbea 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditem_client_example_test.go @@ -1,322 +1,316 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Get.json -func ExampleProtectedItemClient_Get() { +// Generated from example definition: 2024-09-01/ProtectedItem_Create.json +func ExampleProtectedItemClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewProtectedItemClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "d", nil) + poller, err := clientFactory.NewProtectedItemClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "d", armrecoveryservicesdatareplication.ProtectedItemModel{ + Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ + PolicyName: to.Ptr("tjoeiynplt"), + ReplicationExtensionName: to.Ptr("jwxdo"), + }, + }, 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.ProtectedItemModel = armrecoveryservicesdatareplication.ProtectedItemModel{ - // Name: to.Ptr("t"), - // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), - // ID: to.Ptr("egmhsfbgkarlobrgybkz"), - // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ - // AllowedJobs: []*string{ - // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs")}, + // res = armrecoveryservicesdatareplication.ProtectedItemClientCreateResponse{ + // ProtectedItemModel: &armrecoveryservicesdatareplication.ProtectedItemModel{ + // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ + // PolicyName: to.Ptr("tjoeiynplt"), + // ReplicationExtensionName: to.Ptr("jwxdo"), // CorrelationID: to.Ptr("mvxvtcqwgp"), - // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesCurrentJob{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), + // ProtectionStateDescription: to.Ptr("lp"), + // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), + // TestFailoverStateDescription: to.Ptr("msjz"), + // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), + // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), + // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), + // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), + // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), + // TargetFabricID: to.Ptr("fb"), + // FabricAgentID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), + // TargetFabricAgentID: to.Ptr("oscnhreunbyibimlpvsesu"), + // ResyncRequired: to.Ptr(true), + // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // ID: to.Ptr("bnmbzxzyfgwh"), // Name: to.Ptr("kqtvbrfmqaxdgpttkbmzpwafjp"), // DisplayName: to.Ptr("awutlqrisstqb"), + // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("bnmbzxzyfgwh"), - // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // }, + // AllowedJobs: []*string{ + // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs"), + // }, + // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("fhz"), + // ID: to.Ptr("hjzgyxgdy"), + // Name: to.Ptr("hvvolptulpcxwbnjdzky"), + // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), + // State: to.Ptr("ljsixxmmcaq"), // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // }, - // CustomProperties: &armrecoveryservicesdatareplication.ProtectedItemModelCustomProperties{ - // InstanceType: to.Ptr("ProtectedItemModelCustomProperties"), + // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ceksuyfiplxj"), + // ID: to.Ptr("ndjurplurnkguwfxx"), + // Name: to.Ptr("ofblltxwhwzhyr"), + // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), + // State: to.Ptr("wpur"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // }, - // DraID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), - // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), - // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), - // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("dfuovvz"), + // ID: to.Ptr("cta"), + // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), + // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), + // State: to.Ptr("nhbzw"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ // { + // AffectedResourceType: to.Ptr("scfniv"), // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedEnableProtectionJob{ - // Name: to.Ptr("hvvolptulpcxwbnjdzky"), - // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("hjzgyxgdy"), - // ScenarioName: to.Ptr("fhz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ljsixxmmcaq"), - // }, - // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedPlannedFailoverJob{ - // Name: to.Ptr("ofblltxwhwzhyr"), - // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("ndjurplurnkguwfxx"), - // ScenarioName: to.Ptr("ceksuyfiplxj"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("wpur"), - // }, - // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastTestFailoverJob{ - // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), - // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("cta"), - // ScenarioName: to.Ptr("dfuovvz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("nhbzw"), + // to.Ptr("fope"), + // }, + // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ + // { + // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), + // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), + // Category: to.Ptr("lcsdxrqxquke"), + // Severity: to.Ptr("wqxxiuaqjyagq"), + // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("djsmgrltruljo"), + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, + // Code: to.Ptr("dgxkefzmeukd"), + // HealthCategory: to.Ptr("itc"), + // Category: to.Ptr("leigw"), + // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), + // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), // }, - // PolicyName: to.Ptr("tjoeiynplt"), - // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), - // ProtectionStateDescription: to.Ptr("lp"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ReplicationExtensionName: to.Ptr("jwxdo"), - // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // ResyncRequired: to.Ptr(true), - // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), - // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), - // TargetDraID: to.Ptr("oscnhreunbyibimlpvsesu"), - // TargetFabricID: to.Ptr("fb"), - // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), - // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), - // TestFailoverStateDescription: to.Ptr("msjz"), // }, - // SystemData: &armrecoveryservicesdatareplication.ProtectedItemModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // CreatedBy: to.Ptr("ghut"), - // CreatedByType: to.Ptr("tzczp"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastModifiedBy: to.Ptr("epo"), - // LastModifiedByType: to.Ptr("ekzmwexhjttb"), - // }, - // } + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/protectedItems/item1"), + // Name: to.Ptr("t"), + // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ghut"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastModifiedBy: to.Ptr("epo"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Create.json -func ExampleProtectedItemClient_BeginCreate() { +// Generated from example definition: 2024-09-01/ProtectedItem_Delete.json +func ExampleProtectedItemClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewProtectedItemClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "d", armrecoveryservicesdatareplication.ProtectedItemModel{ - Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.ProtectedItemModelCustomProperties{ - InstanceType: to.Ptr("ProtectedItemModelCustomProperties"), - }, - PolicyName: to.Ptr("tjoeiynplt"), - ReplicationExtensionName: to.Ptr("jwxdo"), - }, - }, nil) + poller, err := clientFactory.NewProtectedItemClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "d", &ProtectedItemClientBeginDeleteOptions{ + forceDelete: to.Ptr(true)}) 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/ProtectedItem_Get.json +func ExampleProtectedItemClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewProtectedItemClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "d", 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.ProtectedItemModel = armrecoveryservicesdatareplication.ProtectedItemModel{ - // Name: to.Ptr("t"), - // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), - // ID: to.Ptr("egmhsfbgkarlobrgybkz"), - // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ - // AllowedJobs: []*string{ - // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs")}, + // res = armrecoveryservicesdatareplication.ProtectedItemClientGetResponse{ + // ProtectedItemModel: &armrecoveryservicesdatareplication.ProtectedItemModel{ + // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ + // PolicyName: to.Ptr("tjoeiynplt"), + // ReplicationExtensionName: to.Ptr("jwxdo"), // CorrelationID: to.Ptr("mvxvtcqwgp"), - // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesCurrentJob{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), + // ProtectionStateDescription: to.Ptr("lp"), + // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), + // TestFailoverStateDescription: to.Ptr("msjz"), + // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), + // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), + // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), + // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), + // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), + // TargetFabricID: to.Ptr("fb"), + // FabricAgentID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), + // TargetFabricAgentID: to.Ptr("oscnhreunbyibimlpvsesu"), + // ResyncRequired: to.Ptr(true), + // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // ID: to.Ptr("bnmbzxzyfgwh"), // Name: to.Ptr("kqtvbrfmqaxdgpttkbmzpwafjp"), // DisplayName: to.Ptr("awutlqrisstqb"), + // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("bnmbzxzyfgwh"), - // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // }, + // AllowedJobs: []*string{ + // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs"), + // }, + // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("fhz"), + // ID: to.Ptr("hjzgyxgdy"), + // Name: to.Ptr("hvvolptulpcxwbnjdzky"), + // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), + // State: to.Ptr("ljsixxmmcaq"), // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ceksuyfiplxj"), + // ID: to.Ptr("ndjurplurnkguwfxx"), + // Name: to.Ptr("ofblltxwhwzhyr"), + // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), + // State: to.Ptr("wpur"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // }, - // CustomProperties: &armrecoveryservicesdatareplication.ProtectedItemModelCustomProperties{ - // InstanceType: to.Ptr("ProtectedItemModelCustomProperties"), + // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("dfuovvz"), + // ID: to.Ptr("cta"), + // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), + // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), + // State: to.Ptr("nhbzw"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // }, - // DraID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), - // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), - // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), - // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ // { + // AffectedResourceType: to.Ptr("scfniv"), // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedEnableProtectionJob{ - // Name: to.Ptr("hvvolptulpcxwbnjdzky"), - // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("hjzgyxgdy"), - // ScenarioName: to.Ptr("fhz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ljsixxmmcaq"), + // to.Ptr("fope"), + // }, + // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ + // { + // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), + // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), + // Category: to.Ptr("lcsdxrqxquke"), + // Severity: to.Ptr("wqxxiuaqjyagq"), + // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("djsmgrltruljo"), + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, + // Code: to.Ptr("dgxkefzmeukd"), + // HealthCategory: to.Ptr("itc"), + // Category: to.Ptr("leigw"), + // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), + // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), // }, - // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedPlannedFailoverJob{ - // Name: to.Ptr("ofblltxwhwzhyr"), - // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("ndjurplurnkguwfxx"), - // ScenarioName: to.Ptr("ceksuyfiplxj"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("wpur"), - // }, - // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastTestFailoverJob{ - // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), - // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("cta"), - // ScenarioName: to.Ptr("dfuovvz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("nhbzw"), - // }, - // PolicyName: to.Ptr("tjoeiynplt"), - // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), - // ProtectionStateDescription: to.Ptr("lp"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ReplicationExtensionName: to.Ptr("jwxdo"), - // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // ResyncRequired: to.Ptr(true), - // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), - // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), - // TargetDraID: to.Ptr("oscnhreunbyibimlpvsesu"), - // TargetFabricID: to.Ptr("fb"), - // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), - // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), - // TestFailoverStateDescription: to.Ptr("msjz"), - // }, - // SystemData: &armrecoveryservicesdatareplication.ProtectedItemModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // CreatedBy: to.Ptr("ghut"), - // CreatedByType: to.Ptr("tzczp"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastModifiedBy: to.Ptr("epo"), - // LastModifiedByType: to.Ptr("ekzmwexhjttb"), // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_Delete.json -func ExampleProtectedItemClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProtectedItemClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "d", &armrecoveryservicesdatareplication.ProtectedItemClientBeginDeleteOptions{ForceDelete: to.Ptr(true)}) - 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) - } + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/protectedItems/item1"), + // Name: to.Ptr("t"), + // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ghut"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastModifiedBy: to.Ptr("epo"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_List.json +// Generated from example definition: 2024-09-01/ProtectedItem_List.json func ExampleProtectedItemClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -331,140 +325,137 @@ func ExampleProtectedItemClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ProtectedItemModelCollection = armrecoveryservicesdatareplication.ProtectedItemModelCollection{ - // Value: []*armrecoveryservicesdatareplication.ProtectedItemModel{ - // { - // Name: to.Ptr("t"), - // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), - // ID: to.Ptr("egmhsfbgkarlobrgybkz"), - // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ - // AllowedJobs: []*string{ - // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs")}, + // page = armrecoveryservicesdatareplication.ProtectedItemClientListResponse{ + // ProtectedItemModelListResult: armrecoveryservicesdatareplication.ProtectedItemModelListResult{ + // Value: []*armrecoveryservicesdatareplication.ProtectedItemModel{ + // { + // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ + // PolicyName: to.Ptr("tjoeiynplt"), + // ReplicationExtensionName: to.Ptr("jwxdo"), // CorrelationID: to.Ptr("mvxvtcqwgp"), - // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesCurrentJob{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), + // ProtectionStateDescription: to.Ptr("lp"), + // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), + // TestFailoverStateDescription: to.Ptr("msjz"), + // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), + // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), + // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), + // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), + // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), + // TargetFabricID: to.Ptr("fb"), + // FabricAgentID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), + // TargetFabricAgentID: to.Ptr("oscnhreunbyibimlpvsesu"), + // ResyncRequired: to.Ptr(true), + // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // ID: to.Ptr("bnmbzxzyfgwh"), // Name: to.Ptr("kqtvbrfmqaxdgpttkbmzpwafjp"), // DisplayName: to.Ptr("awutlqrisstqb"), + // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("bnmbzxzyfgwh"), - // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // }, + // AllowedJobs: []*string{ + // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs"), + // }, + // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("fhz"), + // ID: to.Ptr("hjzgyxgdy"), + // Name: to.Ptr("hvvolptulpcxwbnjdzky"), + // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), + // State: to.Ptr("ljsixxmmcaq"), // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // }, - // CustomProperties: &armrecoveryservicesdatareplication.ProtectedItemModelCustomProperties{ - // InstanceType: to.Ptr("ProtectedItemModelCustomProperties"), + // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ceksuyfiplxj"), + // ID: to.Ptr("ndjurplurnkguwfxx"), + // Name: to.Ptr("ofblltxwhwzhyr"), + // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), + // State: to.Ptr("wpur"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), // }, - // DraID: to.Ptr("vxrmsufvxothxauhvqdowascmy"), - // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), - // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), - // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("dfuovvz"), + // ID: to.Ptr("cta"), + // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), + // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), + // State: to.Ptr("nhbzw"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ // { + // AffectedResourceType: to.Ptr("scfniv"), // AffectedResourceCorrelationIDs: []*string{ - // to.Ptr("fope")}, - // AffectedResourceType: to.Ptr("scfniv"), - // Category: to.Ptr("leigw"), - // Causes: to.Ptr("xznphqrrmsdzm"), - // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ - // { - // Category: to.Ptr("lcsdxrqxquke"), - // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), - // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("sskcei"), - // Recommendation: to.Ptr("kqybwaesqumywtjepi"), - // Severity: to.Ptr("wqxxiuaqjyagq"), - // Source: to.Ptr("wevvftugwydzzw"), - // Summary: to.Ptr("djsmgrltruljo"), - // }}, - // Code: to.Ptr("dgxkefzmeukd"), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), - // HealthCategory: to.Ptr("itc"), - // IsCustomerResolvable: to.Ptr(true), - // Message: to.Ptr("lbywtdprdqdekl"), - // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), - // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), - // Source: to.Ptr("iy"), - // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), - // }}, - // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedEnableProtectionJob{ - // Name: to.Ptr("hvvolptulpcxwbnjdzky"), - // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("hjzgyxgdy"), - // ScenarioName: to.Ptr("fhz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("ljsixxmmcaq"), + // to.Ptr("fope"), + // }, + // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ + // { + // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), + // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), + // Category: to.Ptr("lcsdxrqxquke"), + // Severity: to.Ptr("wqxxiuaqjyagq"), + // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("djsmgrltruljo"), + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, + // Code: to.Ptr("dgxkefzmeukd"), + // HealthCategory: to.Ptr("itc"), + // Category: to.Ptr("leigw"), + // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), + // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), // }, - // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastFailedPlannedFailoverJob{ - // Name: to.Ptr("ofblltxwhwzhyr"), - // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("ndjurplurnkguwfxx"), - // ScenarioName: to.Ptr("ceksuyfiplxj"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("wpur"), - // }, - // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesLastTestFailoverJob{ - // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), - // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // ID: to.Ptr("cta"), - // ScenarioName: to.Ptr("dfuovvz"), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // State: to.Ptr("nhbzw"), - // }, - // PolicyName: to.Ptr("tjoeiynplt"), - // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), - // ProtectionStateDescription: to.Ptr("lp"), - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ReplicationExtensionName: to.Ptr("jwxdo"), - // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), - // ResyncRequired: to.Ptr(true), - // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), - // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), - // TargetDraID: to.Ptr("oscnhreunbyibimlpvsesu"), - // TargetFabricID: to.Ptr("fb"), - // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), - // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), - // TestFailoverStateDescription: to.Ptr("msjz"), - // }, - // SystemData: &armrecoveryservicesdatareplication.ProtectedItemModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // CreatedBy: to.Ptr("ghut"), - // CreatedByType: to.Ptr("tzczp"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), - // LastModifiedBy: to.Ptr("epo"), - // LastModifiedByType: to.Ptr("ekzmwexhjttb"), // }, - // }}, - // } + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/protectedItems/item1"), + // Name: to.Ptr("t"), + // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ghut"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastModifiedBy: to.Ptr("epo"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // }, + // }, + // }, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItem_PlannedFailover.json +// Generated from example definition: 2024-09-01/ProtectedItem_PlannedFailover.json func ExampleProtectedItemClient_BeginPlannedFailover() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewProtectedItemClient().BeginPlannedFailover(ctx, "rgrecoveryservicesdatareplication", "4", "d", &armrecoveryservicesdatareplication.ProtectedItemClientBeginPlannedFailoverOptions{Body: &armrecoveryservicesdatareplication.PlannedFailoverModel{ - Properties: &armrecoveryservicesdatareplication.PlannedFailoverModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.PlannedFailoverModelCustomProperties{ - InstanceType: to.Ptr("PlannedFailoverModelCustomProperties"), - }, - }, - }, - }) + poller, err := clientFactory.NewProtectedItemClient().BeginPlannedFailover(ctx, "rgrecoveryservicesdatareplication", "4", "d", armrecoveryservicesdatareplication.PlannedFailoverModel{ + Properties: &armrecoveryservicesdatareplication.PlannedFailoverModelProperties{}, + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -475,10 +466,145 @@ func ExampleProtectedItemClient_BeginPlannedFailover() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PlannedFailoverModel = armrecoveryservicesdatareplication.PlannedFailoverModel{ - // Properties: &armrecoveryservicesdatareplication.PlannedFailoverModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.PlannedFailoverModelCustomProperties{ - // InstanceType: to.Ptr("PlannedFailoverModelCustomProperties"), + // res = armrecoveryservicesdatareplication.ProtectedItemClientPlannedFailoverResponse{ + // PlannedFailoverModel: &armrecoveryservicesdatareplication.PlannedFailoverModel{ + // Properties: &armrecoveryservicesdatareplication.PlannedFailoverModelProperties{ + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/ProtectedItem_Update.json +func ExampleProtectedItemClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewProtectedItemClient().BeginUpdate(ctx, "rgswagger_2024-09-01", "4", "d", armrecoveryservicesdatareplication.ProtectedItemModelUpdate{ + Properties: &armrecoveryservicesdatareplication.ProtectedItemModelPropertiesUpdate{}, + }, 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 = armrecoveryservicesdatareplication.ProtectedItemClientUpdateResponse{ + // ProtectedItemModel: &armrecoveryservicesdatareplication.ProtectedItemModel{ + // Properties: &armrecoveryservicesdatareplication.ProtectedItemModelProperties{ + // PolicyName: to.Ptr("tjoeiynplt"), + // ReplicationExtensionName: to.Ptr("jwxdo"), + // CorrelationID: to.Ptr("mvxvtcqwgp"), + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ProtectionState: to.Ptr(armrecoveryservicesdatareplication.ProtectionStateUnprotectedStatesBegin), + // ProtectionStateDescription: to.Ptr("lp"), + // TestFailoverState: to.Ptr(armrecoveryservicesdatareplication.TestFailoverStateNone), + // TestFailoverStateDescription: to.Ptr("msjz"), + // ResynchronizationState: to.Ptr(armrecoveryservicesdatareplication.ResynchronizationStateNone), + // FabricObjectID: to.Ptr("kjcizdpahzqsrwyiywbhyzdxsufj"), + // FabricObjectName: to.Ptr("glrjwtvmejxuagjepcwaxhih"), + // SourceFabricProviderID: to.Ptr("srggkxaruzlegtpdalscio"), + // TargetFabricProviderID: to.Ptr("sutiqezfbeiewwjezflvcitqj"), + // FabricID: to.Ptr("ebsxoblmhlhqjzzjzdwo"), + // TargetFabricID: to.Ptr("fb"), + // FabricAgentID: to.Ptr("c"), + // TargetFabricAgentID: to.Ptr("tsekhcwafyaoujmijzawvexruifs"), + // ResyncRequired: to.Ptr(true), + // LastSuccessfulPlannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulUnplannedFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // LastSuccessfulTestFailoverTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // CurrentJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ljbnhbdmreowdqnlcqycvaramwuii"), + // ID: to.Ptr("bnmbzxzyfgwh"), + // Name: to.Ptr("kqtvbrfmqaxdgpttkbmzpwafjp"), + // DisplayName: to.Ptr("awutlqrisstqb"), + // State: to.Ptr("ztlpngveoqcdejpwaiudhrioskauqv"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // AllowedJobs: []*string{ + // to.Ptr("guryeoocjbvqvalfkrxecpxwynpxs"), + // }, + // LastFailedEnableProtectionJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("fhz"), + // ID: to.Ptr("hjzgyxgdy"), + // Name: to.Ptr("hvvolptulpcxwbnjdzky"), + // DisplayName: to.Ptr("zrqjbcozwiuypjjnvy"), + // State: to.Ptr("ljsixxmmcaq"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // LastFailedPlannedFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("ceksuyfiplxj"), + // ID: to.Ptr("ndjurplurnkguwfxx"), + // Name: to.Ptr("ofblltxwhwzhyr"), + // DisplayName: to.Ptr("whxsvbrzdhqsepbocfzsfx"), + // State: to.Ptr("wpur"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // LastTestFailoverJob: &armrecoveryservicesdatareplication.ProtectedItemJobProperties{ + // ScenarioName: to.Ptr("dfuovvz"), + // ID: to.Ptr("cta"), + // Name: to.Ptr("cedjijdtnznsnigghrxnsaz"), + // DisplayName: to.Ptr("lhkjfbonwdtxckwzfebfwdyu"), + // State: to.Ptr("nhbzw"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:55.456Z"); return t}()), + // }, + // ReplicationHealth: to.Ptr(armrecoveryservicesdatareplication.HealthStatusNormal), + // HealthErrors: []*armrecoveryservicesdatareplication.HealthErrorModel{ + // { + // AffectedResourceType: to.Ptr("scfniv"), + // AffectedResourceCorrelationIDs: []*string{ + // to.Ptr("fope"), + // }, + // ChildErrors: []*armrecoveryservicesdatareplication.InnerHealthErrorModel{ + // { + // Code: to.Ptr("yuxxpblihirpedwkigywgwjjrlzq"), + // HealthCategory: to.Ptr("mhdgfjqwbikhxmhtomkl"), + // Category: to.Ptr("lcsdxrqxquke"), + // Severity: to.Ptr("wqxxiuaqjyagq"), + // Source: to.Ptr("wevvftugwydzzw"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("djsmgrltruljo"), + // Message: to.Ptr("sskcei"), + // Causes: to.Ptr("kefaugkpxjkpulimjthjnl"), + // Recommendation: to.Ptr("kqybwaesqumywtjepi"), + // }, + // }, + // Code: to.Ptr("dgxkefzmeukd"), + // HealthCategory: to.Ptr("itc"), + // Category: to.Ptr("leigw"), + // Severity: to.Ptr("vvdajssdcypewdyechilxjmuijvdd"), + // Source: to.Ptr("iy"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:52.128Z"); return t}()), + // IsCustomerResolvable: to.Ptr(true), + // Summary: to.Ptr("jtooblbvaxxrvcwgscbobq"), + // Message: to.Ptr("lbywtdprdqdekl"), + // Causes: to.Ptr("xznphqrrmsdzm"), + // Recommendation: to.Ptr("gmssteizlhjtclyeoo"), + // }, + // }, + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/protectedItems/item1"), + // Name: to.Ptr("t"), + // Type: to.Ptr("xlyjashandpfwivuipoplgkgsnwoh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("ewufpudzcjrljhmmzhfnxoqdqwnya"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), + // LastModifiedBy: to.Ptr("rx"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:53.022Z"); return t}()), // }, // }, // } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client.go deleted file mode 100644 index 438e76551bad..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client.go +++ /dev/null @@ -1,119 +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 armrecoveryservicesdatareplication - -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" -) - -// ProtectedItemOperationStatusClient contains the methods for the ProtectedItemOperationStatus group. -// Don't use this type directly, use NewProtectedItemOperationStatusClient() instead. -type ProtectedItemOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewProtectedItemOperationStatusClient creates a new instance of ProtectedItemOperationStatusClient 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 NewProtectedItemOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProtectedItemOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ProtectedItemOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the protected item. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. -// - protectedItemName - The protected item name. -// - operationID - The ID of an ongoing async operation. -// - options - ProtectedItemOperationStatusClientGetOptions contains the optional parameters for the ProtectedItemOperationStatusClient.Get -// method. -func (client *ProtectedItemOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, operationID string, options *ProtectedItemOperationStatusClientGetOptions) (ProtectedItemOperationStatusClientGetResponse, error) { - var err error - const operationName = "ProtectedItemOperationStatusClient.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, vaultName, protectedItemName, operationID, options) - if err != nil { - return ProtectedItemOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ProtectedItemOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ProtectedItemOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ProtectedItemOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, operationID string, options *ProtectedItemOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/operations/{operationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if protectedItemName == "" { - return nil, errors.New("parameter protectedItemName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{protectedItemName}", url.PathEscape(protectedItemName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - 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-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ProtectedItemOperationStatusClient) getHandleResponse(resp *http.Response) (ProtectedItemOperationStatusClientGetResponse, error) { - result := ProtectedItemOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return ProtectedItemOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client_example_test.go deleted file mode 100644 index e9bd790c78c7..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/protecteditemoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ProtectedItemOperationStatus_Get.json -func ExampleProtectedItemOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewProtectedItemOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "d", "wdqacsc", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_client.go similarity index 66% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_client.go index 00a263937da7..7806167ec2f5 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_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 armrecoveryservicesdatareplication @@ -20,23 +16,23 @@ import ( "strings" ) -// RecoveryPointsClient contains the methods for the RecoveryPoints group. -// Don't use this type directly, use NewRecoveryPointsClient() instead. -type RecoveryPointsClient struct { +// RecoveryPointClient contains the methods for the RecoveryPoint group. +// Don't use this type directly, use NewRecoveryPointClient() instead. +type RecoveryPointClient struct { internal *arm.Client subscriptionID string } -// NewRecoveryPointsClient creates a new instance of RecoveryPointsClient with the specified values. +// NewRecoveryPointClient creates a new instance of RecoveryPointClient 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 NewRecoveryPointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecoveryPointsClient, error) { +func NewRecoveryPointClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RecoveryPointClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { return nil, err } - client := &RecoveryPointsClient{ + client := &RecoveryPointClient{ subscriptionID: subscriptionID, internal: cl, } @@ -46,36 +42,36 @@ func NewRecoveryPointsClient(subscriptionID string, credential azcore.TokenCrede // Get - Gets the details of the recovery point of a protected item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. // - recoveryPointName - The recovery point name. -// - options - RecoveryPointsClientGetOptions contains the optional parameters for the RecoveryPointsClient.Get method. -func (client *RecoveryPointsClient) Get(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *RecoveryPointsClientGetOptions) (RecoveryPointsClientGetResponse, error) { +// - options - RecoveryPointClientGetOptions contains the optional parameters for the RecoveryPointClient.Get method. +func (client *RecoveryPointClient) Get(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *RecoveryPointClientGetOptions) (RecoveryPointClientGetResponse, error) { var err error - const operationName = "RecoveryPointsClient.Get" + const operationName = "RecoveryPointClient.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, vaultName, protectedItemName, recoveryPointName, options) if err != nil { - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointClientGetResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointClientGetResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointClientGetResponse{}, err } resp, err := client.getHandleResponse(httpResp) return resp, err } // getCreateRequest creates the Get request. -func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, options *RecoveryPointsClientGetOptions) (*policy.Request, error) { +func (client *RecoveryPointClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, recoveryPointName string, _ *RecoveryPointClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -102,35 +98,35 @@ func (client *RecoveryPointsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 *RecoveryPointsClient) getHandleResponse(resp *http.Response) (RecoveryPointsClientGetResponse, error) { - result := RecoveryPointsClientGetResponse{} +func (client *RecoveryPointClient) getHandleResponse(resp *http.Response) (RecoveryPointClientGetResponse, error) { + result := RecoveryPointClientGetResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointModel); err != nil { - return RecoveryPointsClientGetResponse{}, err + return RecoveryPointClientGetResponse{}, err } return result, nil } // NewListPager - Gets the list of recovery points of the given protected item. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - protectedItemName - The protected item name. -// - options - RecoveryPointsClientListOptions contains the optional parameters for the RecoveryPointsClient.NewListPager method. -func (client *RecoveryPointsClient) NewListPager(resourceGroupName string, vaultName string, protectedItemName string, options *RecoveryPointsClientListOptions) *runtime.Pager[RecoveryPointsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[RecoveryPointsClientListResponse]{ - More: func(page RecoveryPointsClientListResponse) bool { +// - options - RecoveryPointClientListOptions contains the optional parameters for the RecoveryPointClient.NewListPager method. +func (client *RecoveryPointClient) NewListPager(resourceGroupName string, vaultName string, protectedItemName string, options *RecoveryPointClientListOptions) *runtime.Pager[RecoveryPointClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[RecoveryPointClientListResponse]{ + More: func(page RecoveryPointClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *RecoveryPointsClientListResponse) (RecoveryPointsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RecoveryPointsClient.NewListPager") + Fetcher: func(ctx context.Context, page *RecoveryPointClientListResponse) (RecoveryPointClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "RecoveryPointClient.NewListPager") nextLink := "" if page != nil { nextLink = *page.NextLink @@ -139,7 +135,7 @@ func (client *RecoveryPointsClient) NewListPager(resourceGroupName string, vault return client.listCreateRequest(ctx, resourceGroupName, vaultName, protectedItemName, options) }, nil) if err != nil { - return RecoveryPointsClientListResponse{}, err + return RecoveryPointClientListResponse{}, err } return client.listHandleResponse(resp) }, @@ -148,7 +144,7 @@ func (client *RecoveryPointsClient) NewListPager(resourceGroupName string, vault } // listCreateRequest creates the List request. -func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, options *RecoveryPointsClientListOptions) (*policy.Request, error) { +func (client *RecoveryPointClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, protectedItemName string, _ *RecoveryPointClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/protectedItems/{protectedItemName}/recoveryPoints" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -171,17 +167,17 @@ func (client *RecoveryPointsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 *RecoveryPointsClient) listHandleResponse(resp *http.Response) (RecoveryPointsClientListResponse, error) { - result := RecoveryPointsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointModelCollection); err != nil { - return RecoveryPointsClientListResponse{}, err +func (client *RecoveryPointClient) listHandleResponse(resp *http.Response) (RecoveryPointClientListResponse, error) { + result := RecoveryPointClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryPointModelListResult); err != nil { + return RecoveryPointClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_client_example_test.go new file mode 100644 index 000000000000..8d7535533dae --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoint_client_example_test.go @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft 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 armrecoveryservicesdatareplication_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" +) + +// Generated from example definition: 2024-09-01/RecoveryPoints_Get.json +func ExampleRecoveryPointClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewRecoveryPointClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "d", "1X", 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 = armrecoveryservicesdatareplication.RecoveryPointClientGetResponse{ + // RecoveryPointModel: &armrecoveryservicesdatareplication.RecoveryPointModel{ + // Properties: &armrecoveryservicesdatareplication.RecoveryPointModelProperties{ + // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), + // RecoveryPointType: to.Ptr(armrecoveryservicesdatareplication.RecoveryPointTypeApplicationConsistent), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/recoveryPoints/point1"), + // Name: to.Ptr("mfnjlwvvfnrsllcyyeslxxcchhvld"), + // Type: to.Ptr("zoeadplqxtonvqgwfqmeblh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("nykpygxolffv"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), + // LastModifiedBy: to.Ptr("tipxxgz"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.404Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-09-01/RecoveryPoints_List.json +func ExampleRecoveryPointClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewRecoveryPointClient().NewListPager("rgrecoveryservicesdatareplication", "4", "d", 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 = armrecoveryservicesdatareplication.RecoveryPointClientListResponse{ + // RecoveryPointModelListResult: armrecoveryservicesdatareplication.RecoveryPointModelListResult{ + // Value: []*armrecoveryservicesdatareplication.RecoveryPointModel{ + // { + // Properties: &armrecoveryservicesdatareplication.RecoveryPointModelProperties{ + // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), + // RecoveryPointType: to.Ptr(armrecoveryservicesdatareplication.RecoveryPointTypeApplicationConsistent), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/recoveryPoints/point1"), + // Name: to.Ptr("mfnjlwvvfnrsllcyyeslxxcchhvld"), + // Type: to.Ptr("zoeadplqxtonvqgwfqmeblh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("nykpygxolffv"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), + // LastModifiedBy: to.Ptr("tipxxgz"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.404Z"); return t}()), + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client_example_test.go deleted file mode 100644 index 45e9d3e92d8e..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/recoverypoints_client_example_test.go +++ /dev/null @@ -1,106 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/RecoveryPoints_Get.json -func ExampleRecoveryPointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewRecoveryPointsClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "d", "1X", 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.RecoveryPointModel = armrecoveryservicesdatareplication.RecoveryPointModel{ - // Name: to.Ptr("mfnjlwvvfnrsllcyyeslxxcchhvld"), - // Type: to.Ptr("zoeadplqxtonvqgwfqmeblh"), - // ID: to.Ptr("yrnzjckvljjffam"), - // Properties: &armrecoveryservicesdatareplication.RecoveryPointModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.RecoveryPointModelCustomProperties{ - // InstanceType: to.Ptr("RecoveryPointModelCustomProperties"), - // }, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), - // RecoveryPointType: to.Ptr(armrecoveryservicesdatareplication.RecoveryPointTypeApplicationConsistent), - // }, - // SystemData: &armrecoveryservicesdatareplication.RecoveryPointModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), - // CreatedBy: to.Ptr("nykpygxolffv"), - // CreatedByType: to.Ptr("agdgovroryjiwioytnnps"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.404Z"); return t}()), - // LastModifiedBy: to.Ptr("tipxxgz"), - // LastModifiedByType: to.Ptr("v"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/RecoveryPoints_List.json -func ExampleRecoveryPointsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewRecoveryPointsClient().NewListPager("rgrecoveryservicesdatareplication", "4", "d", 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.RecoveryPointModelCollection = armrecoveryservicesdatareplication.RecoveryPointModelCollection{ - // Value: []*armrecoveryservicesdatareplication.RecoveryPointModel{ - // { - // Name: to.Ptr("mfnjlwvvfnrsllcyyeslxxcchhvld"), - // Type: to.Ptr("zoeadplqxtonvqgwfqmeblh"), - // ID: to.Ptr("yrnzjckvljjffam"), - // Properties: &armrecoveryservicesdatareplication.RecoveryPointModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.RecoveryPointModelCustomProperties{ - // InstanceType: to.Ptr("RecoveryPointModelCustomProperties"), - // }, - // RecoveryPointTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), - // RecoveryPointType: to.Ptr(armrecoveryservicesdatareplication.RecoveryPointTypeApplicationConsistent), - // }, - // SystemData: &armrecoveryservicesdatareplication.RecoveryPointModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.403Z"); return t}()), - // CreatedBy: to.Ptr("nykpygxolffv"), - // CreatedByType: to.Ptr("agdgovroryjiwioytnnps"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.404Z"); return t}()), - // LastModifiedBy: to.Ptr("tipxxgz"), - // LastModifiedByType: to.Ptr("v"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client.go index 054f989c1c2b..a8bdbbf8ab57 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_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 armrecoveryservicesdatareplication @@ -46,22 +42,21 @@ func NewReplicationExtensionClient(subscriptionID string, credential azcore.Toke // BeginCreate - Creates the replication extension in the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - replicationExtensionName - The replication extension name. -// - body - Replication extension model. +// - resource - Replication extension model. // - options - ReplicationExtensionClientBeginCreateOptions contains the optional parameters for the ReplicationExtensionClient.BeginCreate // method. -func (client *ReplicationExtensionClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, body ReplicationExtensionModel, options *ReplicationExtensionClientBeginCreateOptions) (*runtime.Poller[ReplicationExtensionClientCreateResponse], error) { +func (client *ReplicationExtensionClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, resource ReplicationExtensionModel, options *ReplicationExtensionClientBeginCreateOptions) (*runtime.Poller[ReplicationExtensionClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, vaultName, replicationExtensionName, body, options) + resp, err := client.create(ctx, resourceGroupName, vaultName, replicationExtensionName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicationExtensionClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -74,14 +69,14 @@ func (client *ReplicationExtensionClient) BeginCreate(ctx context.Context, resou // Create - Creates the replication extension in the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *ReplicationExtensionClient) create(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, body ReplicationExtensionModel, options *ReplicationExtensionClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *ReplicationExtensionClient) create(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, resource ReplicationExtensionModel, options *ReplicationExtensionClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "ReplicationExtensionClient.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, vaultName, replicationExtensionName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, vaultName, replicationExtensionName, resource, options) if err != nil { return nil, err } @@ -97,7 +92,7 @@ func (client *ReplicationExtensionClient) create(ctx context.Context, resourceGr } // createCreateRequest creates the Create request. -func (client *ReplicationExtensionClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, body ReplicationExtensionModel, options *ReplicationExtensionClientBeginCreateOptions) (*policy.Request, error) { +func (client *ReplicationExtensionClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, resource ReplicationExtensionModel, _ *ReplicationExtensionClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -120,10 +115,11 @@ func (client *ReplicationExtensionClient) createCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 @@ -132,7 +128,7 @@ func (client *ReplicationExtensionClient) createCreateRequest(ctx context.Contex // BeginDelete - Deletes the replication extension in the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - replicationExtensionName - The replication extension name. @@ -145,8 +141,7 @@ func (client *ReplicationExtensionClient) BeginDelete(ctx context.Context, resou return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ReplicationExtensionClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -159,7 +154,7 @@ func (client *ReplicationExtensionClient) BeginDelete(ctx context.Context, resou // Delete - Deletes the replication extension in the given vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *ReplicationExtensionClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, options *ReplicationExtensionClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ReplicationExtensionClient.BeginDelete" @@ -182,7 +177,7 @@ func (client *ReplicationExtensionClient) deleteOperation(ctx context.Context, r } // deleteCreateRequest creates the Delete request. -func (client *ReplicationExtensionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, options *ReplicationExtensionClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ReplicationExtensionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, _ *ReplicationExtensionClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -205,7 +200,7 @@ func (client *ReplicationExtensionClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +209,7 @@ func (client *ReplicationExtensionClient) deleteCreateRequest(ctx context.Contex // Get - Gets the details of the replication extension. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - replicationExtensionName - The replication extension name. @@ -243,7 +238,7 @@ func (client *ReplicationExtensionClient) Get(ctx context.Context, resourceGroup } // getCreateRequest creates the Get request. -func (client *ReplicationExtensionClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, options *ReplicationExtensionClientGetOptions) (*policy.Request, error) { +func (client *ReplicationExtensionClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, _ *ReplicationExtensionClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -266,7 +261,7 @@ func (client *ReplicationExtensionClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -283,7 +278,7 @@ func (client *ReplicationExtensionClient) getHandleResponse(resp *http.Response) // NewListPager - Gets the list of replication extensions in the given vault. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - ReplicationExtensionClientListOptions contains the optional parameters for the ReplicationExtensionClient.NewListPager @@ -312,7 +307,7 @@ func (client *ReplicationExtensionClient) NewListPager(resourceGroupName string, } // listCreateRequest creates the List request. -func (client *ReplicationExtensionClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *ReplicationExtensionClientListOptions) (*policy.Request, error) { +func (client *ReplicationExtensionClient) listCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *ReplicationExtensionClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -331,7 +326,7 @@ func (client *ReplicationExtensionClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -340,7 +335,7 @@ func (client *ReplicationExtensionClient) listCreateRequest(ctx context.Context, // listHandleResponse handles the List response. func (client *ReplicationExtensionClient) listHandleResponse(resp *http.Response) (ReplicationExtensionClientListResponse, error) { result := ReplicationExtensionClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ReplicationExtensionModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ReplicationExtensionModelListResult); err != nil { return ReplicationExtensionClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client_example_test.go index cdaae3f83073..66e75e78ccb7 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextension_client_example_test.go @@ -1,140 +1,123 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// 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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Get.json -func ExampleReplicationExtensionClient_Get() { +// Generated from example definition: 2024-09-01/ReplicationExtension_Create.json +func ExampleReplicationExtensionClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewReplicationExtensionClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", nil) + poller, err := clientFactory.NewReplicationExtensionClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", armrecoveryservicesdatareplication.ReplicationExtensionModel{ + Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{}, + }, 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.ReplicationExtensionModel = armrecoveryservicesdatareplication.ReplicationExtensionModel{ - // Name: to.Ptr("xvjffbiecsd"), - // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), - // ID: to.Ptr("awu"), - // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.ReplicationExtensionModelCustomProperties{ - // InstanceType: to.Ptr("ReplicationExtensionModelCustomProperties"), + // res = armrecoveryservicesdatareplication.ReplicationExtensionClientCreateResponse{ + // ReplicationExtensionModel: &armrecoveryservicesdatareplication.ReplicationExtensionModel{ + // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/replicationExtensions/extension1"), + // Name: to.Ptr("xvjffbiecsd"), + // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), + // LastModifiedBy: to.Ptr("suwjpejlaya"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.ReplicationExtensionModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), - // CreatedByType: to.Ptr("dsqllpglanwztdmisrknjtqz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // LastModifiedBy: to.Ptr("suwjpejlaya"), - // LastModifiedByType: to.Ptr("nrfjuyghtbivwihr"), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Create.json -func ExampleReplicationExtensionClient_BeginCreate() { +// Generated from example definition: 2024-09-01/ReplicationExtension_Delete.json +func ExampleReplicationExtensionClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewReplicationExtensionClient().BeginCreate(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", armrecoveryservicesdatareplication.ReplicationExtensionModel{ - Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ - CustomProperties: &armrecoveryservicesdatareplication.ReplicationExtensionModelCustomProperties{ - InstanceType: to.Ptr("ReplicationExtensionModelCustomProperties"), - }, - }, - }, nil) + poller, err := clientFactory.NewReplicationExtensionClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", 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) } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ReplicationExtensionModel = armrecoveryservicesdatareplication.ReplicationExtensionModel{ - // Name: to.Ptr("xvjffbiecsd"), - // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), - // ID: to.Ptr("awu"), - // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.ReplicationExtensionModelCustomProperties{ - // InstanceType: to.Ptr("ReplicationExtensionModelCustomProperties"), - // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.ReplicationExtensionModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), - // CreatedByType: to.Ptr("dsqllpglanwztdmisrknjtqz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // LastModifiedBy: to.Ptr("suwjpejlaya"), - // LastModifiedByType: to.Ptr("nrfjuyghtbivwihr"), - // }, - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_Delete.json -func ExampleReplicationExtensionClient_BeginDelete() { +// Generated from example definition: 2024-09-01/ReplicationExtension_Get.json +func ExampleReplicationExtensionClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewReplicationExtensionClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", nil) + res, err := clientFactory.NewReplicationExtensionClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", 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) - } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armrecoveryservicesdatareplication.ReplicationExtensionClientGetResponse{ + // ReplicationExtensionModel: &armrecoveryservicesdatareplication.ReplicationExtensionModel{ + // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/replicationExtensions/extension1"), + // Name: to.Ptr("xvjffbiecsd"), + // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), + // LastModifiedBy: to.Ptr("suwjpejlaya"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtension_List.json +// Generated from example definition: 2024-09-01/ReplicationExtension_List.json func ExampleReplicationExtensionClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -149,27 +132,25 @@ func ExampleReplicationExtensionClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ReplicationExtensionModelCollection = armrecoveryservicesdatareplication.ReplicationExtensionModelCollection{ - // Value: []*armrecoveryservicesdatareplication.ReplicationExtensionModel{ - // { - // Name: to.Ptr("xvjffbiecsd"), - // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), - // ID: to.Ptr("awu"), - // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ - // CustomProperties: &armrecoveryservicesdatareplication.ReplicationExtensionModelCustomProperties{ - // InstanceType: to.Ptr("ReplicationExtensionModelCustomProperties"), + // page = armrecoveryservicesdatareplication.ReplicationExtensionClientListResponse{ + // ReplicationExtensionModelListResult: armrecoveryservicesdatareplication.ReplicationExtensionModelListResult{ + // Value: []*armrecoveryservicesdatareplication.ReplicationExtensionModel{ + // { + // Properties: &armrecoveryservicesdatareplication.ReplicationExtensionModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1/replicationExtensions/extension1"), + // Name: to.Ptr("xvjffbiecsd"), + // Type: to.Ptr("miadbgilpheilzfoonveznybthgdwh"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), + // LastModifiedBy: to.Ptr("suwjpejlaya"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), // }, - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // }, - // SystemData: &armrecoveryservicesdatareplication.ReplicationExtensionModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // CreatedBy: to.Ptr("lagtinqhksctfdxmfbpf"), - // CreatedByType: to.Ptr("dsqllpglanwztdmisrknjtqz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:56.732Z"); return t}()), - // LastModifiedBy: to.Ptr("suwjpejlaya"), - // LastModifiedByType: to.Ptr("nrfjuyghtbivwihr"), // }, - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client.go deleted file mode 100644 index 43840cb3a36b..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client.go +++ /dev/null @@ -1,119 +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 armrecoveryservicesdatareplication - -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" -) - -// ReplicationExtensionOperationStatusClient contains the methods for the ReplicationExtensionOperationStatus group. -// Don't use this type directly, use NewReplicationExtensionOperationStatusClient() instead. -type ReplicationExtensionOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewReplicationExtensionOperationStatusClient creates a new instance of ReplicationExtensionOperationStatusClient 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 NewReplicationExtensionOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ReplicationExtensionOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &ReplicationExtensionOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the replication extension. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. -// - replicationExtensionName - The replication extension name. -// - operationID - The ID of an ongoing async operation. -// - options - ReplicationExtensionOperationStatusClientGetOptions contains the optional parameters for the ReplicationExtensionOperationStatusClient.Get -// method. -func (client *ReplicationExtensionOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, operationID string, options *ReplicationExtensionOperationStatusClientGetOptions) (ReplicationExtensionOperationStatusClientGetResponse, error) { - var err error - const operationName = "ReplicationExtensionOperationStatusClient.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, vaultName, replicationExtensionName, operationID, options) - if err != nil { - return ReplicationExtensionOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ReplicationExtensionOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ReplicationExtensionOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ReplicationExtensionOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, replicationExtensionName string, operationID string, options *ReplicationExtensionOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/replicationExtensions/{replicationExtensionName}/operations/{operationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if replicationExtensionName == "" { - return nil, errors.New("parameter replicationExtensionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{replicationExtensionName}", url.PathEscape(replicationExtensionName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - 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-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ReplicationExtensionOperationStatusClient) getHandleResponse(resp *http.Response) (ReplicationExtensionOperationStatusClientGetResponse, error) { - result := ReplicationExtensionOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return ReplicationExtensionOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client_example_test.go deleted file mode 100644 index 1dbd0fffc7f6..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/replicationextensionoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/ReplicationExtensionOperationStatus_Get.json -func ExampleReplicationExtensionOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewReplicationExtensionOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "g16yjJ", "wqdqc", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/response_types.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/responses.go similarity index 51% rename from sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/response_types.go rename to sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/responses.go index 8d3e756a0220..f5c9755b4e85 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/response_types.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/responses.go @@ -1,54 +1,21 @@ -//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 armrecoveryservicesdatareplication -// AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse contains the response from method AzureSiteRecoveryManagementServiceAPIClient.CheckNameAvailability. -type AzureSiteRecoveryManagementServiceAPIClientCheckNameAvailabilityResponse struct { +// CheckNameAvailabilityClientPostResponse contains the response from method CheckNameAvailabilityClient.Post. +type CheckNameAvailabilityClientPostResponse struct { // Check name availability response model. CheckNameAvailabilityResponseModel } -// AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse contains the response from method AzureSiteRecoveryManagementServiceAPIClient.DeploymentPreflight. -type AzureSiteRecoveryManagementServiceAPIClientDeploymentPreflightResponse struct { +// DeploymentPreflightClientPostResponse contains the response from method DeploymentPreflightClient.Post. +type DeploymentPreflightClientPostResponse struct { // Deployment preflight model. DeploymentPreflightModel } -// DraClientCreateResponse contains the response from method DraClient.BeginCreate. -type DraClientCreateResponse struct { - // Dra model. - DraModel -} - -// DraClientDeleteResponse contains the response from method DraClient.BeginDelete. -type DraClientDeleteResponse struct { - // placeholder for future response values -} - -// DraClientGetResponse contains the response from method DraClient.Get. -type DraClientGetResponse struct { - // Dra model. - DraModel -} - -// DraClientListResponse contains the response from method DraClient.NewListPager. -type DraClientListResponse struct { - // Dra model collection. - DraModelCollection -} - -// DraOperationStatusClientGetResponse contains the response from method DraOperationStatusClient.Get. -type DraOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus -} - // EmailConfigurationClientCreateResponse contains the response from method EmailConfigurationClient.Create. type EmailConfigurationClientCreateResponse struct { // Email configuration model. @@ -63,8 +30,8 @@ type EmailConfigurationClientGetResponse struct { // EmailConfigurationClientListResponse contains the response from method EmailConfigurationClient.NewListPager. type EmailConfigurationClientListResponse struct { - // Email configuration model collection. - EmailConfigurationModelCollection + // The response of a EmailConfigurationModel list operation. + EmailConfigurationModelListResult } // EventClientGetResponse contains the response from method EventClient.Get. @@ -75,8 +42,31 @@ type EventClientGetResponse struct { // EventClientListResponse contains the response from method EventClient.NewListPager. type EventClientListResponse struct { - // Event model collection. - EventModelCollection + // The response of a EventModel list operation. + EventModelListResult +} + +// FabricAgentClientCreateResponse contains the response from method FabricAgentClient.BeginCreate. +type FabricAgentClientCreateResponse struct { + // Fabric agent model. + FabricAgentModel +} + +// FabricAgentClientDeleteResponse contains the response from method FabricAgentClient.BeginDelete. +type FabricAgentClientDeleteResponse struct { + // placeholder for future response values +} + +// FabricAgentClientGetResponse contains the response from method FabricAgentClient.Get. +type FabricAgentClientGetResponse struct { + // Fabric agent model. + FabricAgentModel +} + +// FabricAgentClientListResponse contains the response from method FabricAgentClient.NewListPager. +type FabricAgentClientListResponse struct { + // The response of a FabricAgentModel list operation. + FabricAgentModelListResult } // FabricClientCreateResponse contains the response from method FabricClient.BeginCreate. @@ -98,14 +88,14 @@ type FabricClientGetResponse struct { // FabricClientListBySubscriptionResponse contains the response from method FabricClient.NewListBySubscriptionPager. type FabricClientListBySubscriptionResponse struct { - // Fabric model collection. - FabricModelCollection + // The response of a FabricModel list operation. + FabricModelListResult } // FabricClientListResponse contains the response from method FabricClient.NewListPager. type FabricClientListResponse struct { - // Fabric model collection. - FabricModelCollection + // The response of a FabricModel list operation. + FabricModelListResult } // FabricClientUpdateResponse contains the response from method FabricClient.BeginUpdate. @@ -114,8 +104,20 @@ type FabricClientUpdateResponse struct { FabricModel } -// FabricOperationsStatusClientGetResponse contains the response from method FabricOperationsStatusClient.Get. -type FabricOperationsStatusClientGetResponse struct { +// JobClientGetResponse contains the response from method JobClient.Get. +type JobClientGetResponse struct { + // Job model. + JobModel +} + +// JobClientListResponse contains the response from method JobClient.NewListPager. +type JobClientListResponse struct { + // The response of a JobModel list operation. + JobModelListResult +} + +// OperationResultsClientGetResponse contains the response from method OperationResultsClient.Get. +type OperationResultsClientGetResponse struct { // Defines the operation status. OperationStatus } @@ -145,14 +147,72 @@ type PolicyClientGetResponse struct { // PolicyClientListResponse contains the response from method PolicyClient.NewListPager. type PolicyClientListResponse struct { - // Policy model collection. - PolicyModelCollection + // The response of a PolicyModel list operation. + PolicyModelListResult } -// PolicyOperationStatusClientGetResponse contains the response from method PolicyOperationStatusClient.Get. -type PolicyOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus +// PrivateEndpointConnectionProxiesClientCreateResponse contains the response from method PrivateEndpointConnectionProxiesClient.Create. +type PrivateEndpointConnectionProxiesClientCreateResponse struct { + // Represents private endpoint connection proxy request. + PrivateEndpointConnectionProxy +} + +// PrivateEndpointConnectionProxiesClientDeleteResponse contains the response from method PrivateEndpointConnectionProxiesClient.BeginDelete. +type PrivateEndpointConnectionProxiesClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionProxiesClientGetResponse contains the response from method PrivateEndpointConnectionProxiesClient.Get. +type PrivateEndpointConnectionProxiesClientGetResponse struct { + // Represents private endpoint connection proxy request. + PrivateEndpointConnectionProxy +} + +// PrivateEndpointConnectionProxiesClientListResponse contains the response from method PrivateEndpointConnectionProxiesClient.NewListPager. +type PrivateEndpointConnectionProxiesClientListResponse struct { + // The response of a PrivateEndpointConnectionProxy list operation. + PrivateEndpointConnectionProxyListResult +} + +// PrivateEndpointConnectionProxiesClientValidateResponse contains the response from method PrivateEndpointConnectionProxiesClient.Validate. +type PrivateEndpointConnectionProxiesClientValidateResponse struct { + // Represents private endpoint connection proxy request. + PrivateEndpointConnectionProxy +} + +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. +type PrivateEndpointConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. +type PrivateEndpointConnectionsClientGetResponse struct { + // Represents private endpoint connection. + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager. +type PrivateEndpointConnectionsClientListResponse struct { + // The response of a PrivateEndpointConnection list operation. + PrivateEndpointConnectionListResult +} + +// PrivateEndpointConnectionsClientUpdateResponse contains the response from method PrivateEndpointConnectionsClient.Update. +type PrivateEndpointConnectionsClientUpdateResponse struct { + // Represents private endpoint connection. + PrivateEndpointConnection +} + +// PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. +type PrivateLinkResourcesClientGetResponse struct { + // Represents private link resource. + PrivateLinkResource +} + +// PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.NewListPager. +type PrivateLinkResourcesClientListResponse struct { + // The response of a PrivateLinkResource list operation. + PrivateLinkResourceListResult } // ProtectedItemClientCreateResponse contains the response from method ProtectedItemClient.BeginCreate. @@ -174,8 +234,8 @@ type ProtectedItemClientGetResponse struct { // ProtectedItemClientListResponse contains the response from method ProtectedItemClient.NewListPager. type ProtectedItemClientListResponse struct { - // Protected item model collection. - ProtectedItemModelCollection + // The response of a ProtectedItemModel list operation. + ProtectedItemModelListResult } // ProtectedItemClientPlannedFailoverResponse contains the response from method ProtectedItemClient.BeginPlannedFailover. @@ -184,22 +244,22 @@ type ProtectedItemClientPlannedFailoverResponse struct { PlannedFailoverModel } -// ProtectedItemOperationStatusClientGetResponse contains the response from method ProtectedItemOperationStatusClient.Get. -type ProtectedItemOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus +// ProtectedItemClientUpdateResponse contains the response from method ProtectedItemClient.BeginUpdate. +type ProtectedItemClientUpdateResponse struct { + // Protected item model. + ProtectedItemModel } -// RecoveryPointsClientGetResponse contains the response from method RecoveryPointsClient.Get. -type RecoveryPointsClientGetResponse struct { +// RecoveryPointClientGetResponse contains the response from method RecoveryPointClient.Get. +type RecoveryPointClientGetResponse struct { // Recovery point model. RecoveryPointModel } -// RecoveryPointsClientListResponse contains the response from method RecoveryPointsClient.NewListPager. -type RecoveryPointsClientListResponse struct { - // Recovery point model collection. - RecoveryPointModelCollection +// RecoveryPointClientListResponse contains the response from method RecoveryPointClient.NewListPager. +type RecoveryPointClientListResponse struct { + // The response of a RecoveryPointModel list operation. + RecoveryPointModelListResult } // ReplicationExtensionClientCreateResponse contains the response from method ReplicationExtensionClient.BeginCreate. @@ -221,14 +281,8 @@ type ReplicationExtensionClientGetResponse struct { // ReplicationExtensionClientListResponse contains the response from method ReplicationExtensionClient.NewListPager. type ReplicationExtensionClientListResponse struct { - // Replication extension model collection. - ReplicationExtensionModelCollection -} - -// ReplicationExtensionOperationStatusClientGetResponse contains the response from method ReplicationExtensionOperationStatusClient.Get. -type ReplicationExtensionOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus + // The response of a ReplicationExtensionModel list operation. + ReplicationExtensionModelListResult } // VaultClientCreateResponse contains the response from method VaultClient.BeginCreate. @@ -250,14 +304,14 @@ type VaultClientGetResponse struct { // VaultClientListBySubscriptionResponse contains the response from method VaultClient.NewListBySubscriptionPager. type VaultClientListBySubscriptionResponse struct { - // Vault model collection. - VaultModelCollection + // The response of a VaultModel list operation. + VaultModelListResult } // VaultClientListResponse contains the response from method VaultClient.NewListPager. type VaultClientListResponse struct { - // Vault model collection. - VaultModelCollection + // The response of a VaultModel list operation. + VaultModelListResult } // VaultClientUpdateResponse contains the response from method VaultClient.BeginUpdate. @@ -265,27 +319,3 @@ type VaultClientUpdateResponse struct { // Vault model. VaultModel } - -// VaultOperationStatusClientGetResponse contains the response from method VaultOperationStatusClient.Get. -type VaultOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus -} - -// WorkflowClientGetResponse contains the response from method WorkflowClient.Get. -type WorkflowClientGetResponse struct { - // Workflow model. - WorkflowModel -} - -// WorkflowClientListResponse contains the response from method WorkflowClient.NewListPager. -type WorkflowClientListResponse struct { - // Workflow model collection. - WorkflowModelCollection -} - -// WorkflowOperationStatusClientGetResponse contains the response from method WorkflowOperationStatusClient.Get. -type WorkflowOperationStatusClientGetResponse struct { - // Defines the operation status. - OperationStatus -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/time_rfc3339.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/time_rfc3339.go index 228806e55873..a71a5208a431 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/time_rfc3339.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/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 armrecoveryservicesdatareplication @@ -19,12 +15,16 @@ import ( ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(Z|z|\+|-)(\d+:\d+)*"*$`) +var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) const ( - utcDateTimeJSON = `"2006-01-02T15:04:05.999999999"` - utcDateTime = "2006-01-02T15:04:05.999999999" - dateTimeJSON = `"` + time.RFC3339Nano + `"` + utcDateTime = "2006-01-02T15:04:05.999999999" + utcDateTimeJSON = `"` + utcDateTime + `"` + utcDateTimeNoT = "2006-01-02 15:04:05.999999999" + utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` + dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` + dateTimeJSON = `"` + time.RFC3339Nano + `"` + dateTimeJSONNoT = `"` + dateTimeNoT + `"` ) type dateTimeRFC3339 time.Time @@ -40,17 +40,36 @@ func (t dateTimeRFC3339) MarshalText() ([]byte, error) { } func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - layout := utcDateTimeJSON - if tzOffsetRegex.Match(data) { + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = dateTimeJSON + } else if tzOffset { + layout = dateTimeJSONNoT + } else if hasT { + layout = utcDateTimeJSON + } else { + layout = utcDateTimeJSONNoT } return t.Parse(layout, string(data)) } func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - layout := utcDateTime - if tzOffsetRegex.Match(data) { + if len(data) == 0 { + return nil + } + tzOffset := tzOffsetRegex.Match(data) + hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") + var layout string + if tzOffset && hasT { layout = time.RFC3339Nano + } else if tzOffset { + layout = dateTimeNoT + } else if hasT { + layout = utcDateTime + } else { + layout = utcDateTimeNoT } return t.Parse(layout, string(data)) } @@ -61,6 +80,10 @@ func (t *dateTimeRFC3339) Parse(layout, value string) error { return err } +func (t dateTimeRFC3339) String() string { + return time.Time(t).Format(time.RFC3339Nano) +} + func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { if t == nil { return @@ -74,7 +97,7 @@ func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { } func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || strings.EqualFold(string(data), "null") { + if data == nil || string(data) == "null" { return nil } var aux dateTimeRFC3339 diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/tsp-location.yaml b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/tsp-location.yaml new file mode 100644 index 000000000000..71f996279f17 --- /dev/null +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/recoveryservicesdatareplication/DataReplication.Management +commit: 676334a284e5136f0a0721d6ae844bb04332f579 +repo: Azure/azure-rest-api-specs +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client.go index 260141445348..c8e592a9a84c 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_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 armrecoveryservicesdatareplication @@ -46,20 +42,19 @@ func NewVaultClient(subscriptionID string, credential azcore.TokenCredential, op // BeginCreate - Creates the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. -// - body - Vault properties. +// - resource - Vault properties. // - options - VaultClientBeginCreateOptions contains the optional parameters for the VaultClient.BeginCreate method. -func (client *VaultClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, body VaultModel, options *VaultClientBeginCreateOptions) (*runtime.Poller[VaultClientCreateResponse], error) { +func (client *VaultClient) BeginCreate(ctx context.Context, resourceGroupName string, vaultName string, resource VaultModel, options *VaultClientBeginCreateOptions) (*runtime.Poller[VaultClientCreateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.create(ctx, resourceGroupName, vaultName, body, options) + resp, err := client.create(ctx, resourceGroupName, vaultName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VaultClientCreateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -72,14 +67,14 @@ func (client *VaultClient) BeginCreate(ctx context.Context, resourceGroupName st // Create - Creates the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *VaultClient) create(ctx context.Context, resourceGroupName string, vaultName string, body VaultModel, options *VaultClientBeginCreateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *VaultClient) create(ctx context.Context, resourceGroupName string, vaultName string, resource VaultModel, options *VaultClientBeginCreateOptions) (*http.Response, error) { var err error const operationName = "VaultClient.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, vaultName, body, options) + req, err := client.createCreateRequest(ctx, resourceGroupName, vaultName, resource, options) if err != nil { return nil, err } @@ -95,7 +90,7 @@ func (client *VaultClient) create(ctx context.Context, resourceGroupName string, } // createCreateRequest creates the Create request. -func (client *VaultClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, body VaultModel, options *VaultClientBeginCreateOptions) (*policy.Request, error) { +func (client *VaultClient) createCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, resource VaultModel, _ *VaultClientBeginCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -114,10 +109,11 @@ func (client *VaultClient) createCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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 @@ -126,7 +122,7 @@ func (client *VaultClient) createCreateRequest(ctx context.Context, resourceGrou // BeginDelete - Removes the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - VaultClientBeginDeleteOptions contains the optional parameters for the VaultClient.BeginDelete method. @@ -137,8 +133,7 @@ func (client *VaultClient) BeginDelete(ctx context.Context, resourceGroupName st return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VaultClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -151,7 +146,7 @@ func (client *VaultClient) BeginDelete(ctx context.Context, resourceGroupName st // Delete - Removes the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 func (client *VaultClient) deleteOperation(ctx context.Context, resourceGroupName string, vaultName string, options *VaultClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VaultClient.BeginDelete" @@ -174,7 +169,7 @@ func (client *VaultClient) deleteOperation(ctx context.Context, resourceGroupNam } // deleteCreateRequest creates the Delete request. -func (client *VaultClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *VaultClientBeginDeleteOptions) (*policy.Request, error) { +func (client *VaultClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *VaultClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -193,7 +188,7 @@ func (client *VaultClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -202,7 +197,7 @@ func (client *VaultClient) deleteCreateRequest(ctx context.Context, resourceGrou // Get - Gets the details of the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. // - options - VaultClientGetOptions contains the optional parameters for the VaultClient.Get method. @@ -229,7 +224,7 @@ func (client *VaultClient) Get(ctx context.Context, resourceGroupName string, va } // getCreateRequest creates the Get request. -func (client *VaultClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, options *VaultClientGetOptions) (*policy.Request, error) { +func (client *VaultClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, _ *VaultClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -248,7 +243,7 @@ func (client *VaultClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -265,7 +260,7 @@ func (client *VaultClient) getHandleResponse(resp *http.Response) (VaultClientGe // NewListPager - Gets the list of vaults in the given subscription and resource group. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - VaultClientListOptions contains the optional parameters for the VaultClient.NewListPager method. func (client *VaultClient) NewListPager(resourceGroupName string, options *VaultClientListOptions) *runtime.Pager[VaultClientListResponse] { @@ -307,10 +302,10 @@ func (client *VaultClient) listCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-09-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } - reqQP.Set("api-version", "2021-02-16-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -319,7 +314,7 @@ func (client *VaultClient) listCreateRequest(ctx context.Context, resourceGroupN // listHandleResponse handles the List response. func (client *VaultClient) listHandleResponse(resp *http.Response) (VaultClientListResponse, error) { result := VaultClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.VaultModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.VaultModelListResult); err != nil { return VaultClientListResponse{}, err } return result, nil @@ -327,7 +322,7 @@ func (client *VaultClient) listHandleResponse(resp *http.Response) (VaultClientL // NewListBySubscriptionPager - Gets the list of vaults in the given subscription. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - options - VaultClientListBySubscriptionOptions contains the optional parameters for the VaultClient.NewListBySubscriptionPager // method. func (client *VaultClient) NewListBySubscriptionPager(options *VaultClientListBySubscriptionOptions) *runtime.Pager[VaultClientListBySubscriptionResponse] { @@ -354,7 +349,7 @@ func (client *VaultClient) NewListBySubscriptionPager(options *VaultClientListBy } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *VaultClient) listBySubscriptionCreateRequest(ctx context.Context, options *VaultClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *VaultClient) listBySubscriptionCreateRequest(ctx context.Context, _ *VaultClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DataReplication/replicationVaults" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -365,10 +360,7 @@ func (client *VaultClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - if options != nil && options.ContinuationToken != nil { - reqQP.Set("continuationToken", *options.ContinuationToken) - } - reqQP.Set("api-version", "2021-02-16-preview") + reqQP.Set("api-version", "2024-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -377,7 +369,7 @@ func (client *VaultClient) listBySubscriptionCreateRequest(ctx context.Context, // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *VaultClient) listBySubscriptionHandleResponse(resp *http.Response) (VaultClientListBySubscriptionResponse, error) { result := VaultClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.VaultModelCollection); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.VaultModelListResult); err != nil { return VaultClientListBySubscriptionResponse{}, err } return result, nil @@ -386,20 +378,19 @@ func (client *VaultClient) listBySubscriptionHandleResponse(resp *http.Response) // BeginUpdate - Performs update on the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview +// Generated from API version 2024-09-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - vaultName - The vault name. -// - body - Vault properties. +// - properties - Vault properties. // - options - VaultClientBeginUpdateOptions contains the optional parameters for the VaultClient.BeginUpdate method. -func (client *VaultClient) BeginUpdate(ctx context.Context, resourceGroupName string, vaultName string, body VaultModelUpdate, options *VaultClientBeginUpdateOptions) (*runtime.Poller[VaultClientUpdateResponse], error) { +func (client *VaultClient) BeginUpdate(ctx context.Context, resourceGroupName string, vaultName string, properties VaultModelUpdate, options *VaultClientBeginUpdateOptions) (*runtime.Poller[VaultClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, vaultName, body, options) + resp, err := client.update(ctx, resourceGroupName, vaultName, properties, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VaultClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -412,14 +403,14 @@ func (client *VaultClient) BeginUpdate(ctx context.Context, resourceGroupName st // Update - Performs update on the vault. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-02-16-preview -func (client *VaultClient) update(ctx context.Context, resourceGroupName string, vaultName string, body VaultModelUpdate, options *VaultClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2024-09-01 +func (client *VaultClient) update(ctx context.Context, resourceGroupName string, vaultName string, properties VaultModelUpdate, options *VaultClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "VaultClient.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, vaultName, body, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, vaultName, properties, options) if err != nil { return nil, err } @@ -435,7 +426,7 @@ func (client *VaultClient) update(ctx context.Context, resourceGroupName string, } // updateCreateRequest creates the Update request. -func (client *VaultClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, body VaultModelUpdate, options *VaultClientBeginUpdateOptions) (*policy.Request, error) { +func (client *VaultClient) updateCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, properties VaultModelUpdate, _ *VaultClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -454,10 +445,11 @@ func (client *VaultClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-02-16-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/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client_example_test.go index f58f7c6cee70..e7ca77a87bf3 100644 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client_example_test.go +++ b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/vault_client_example_test.go @@ -1,73 +1,25 @@ -//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 armrecoveryservicesdatareplication_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/recoveryservicesdatareplication/armrecoveryservicesdatareplication" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Get.json -func ExampleVaultClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVaultClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", 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.VaultModel = armrecoveryservicesdatareplication.VaultModel{ - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Create.json +// Generated from example definition: 2024-09-01/Vault_Create.json func ExampleVaultClient_BeginCreate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -90,116 +42,106 @@ func ExampleVaultClient_BeginCreate() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VaultModel = armrecoveryservicesdatareplication.VaultModel{ - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // res = armrecoveryservicesdatareplication.VaultClientCreateResponse{ + // VaultModel: &armrecoveryservicesdatareplication.VaultModel{ + // Location: to.Ptr("eck"), + // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), + // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), + // Type: to.Ptr("xtcicpcmjvocohaznrk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("rm"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // LastModifiedBy: to.Ptr("gkojzu"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Update.json -func ExampleVaultClient_BeginUpdate() { +// Generated from example definition: 2024-09-01/Vault_Delete.json +func ExampleVaultClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewVaultClient().BeginUpdate(ctx, "rgrecoveryservicesdatareplication", "4", armrecoveryservicesdatareplication.VaultModelUpdate{ - Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - }, - Tags: map[string]*string{ - "key8872": to.Ptr("pvtc"), - }, - }, nil) + poller, err := clientFactory.NewVaultClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", 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) } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.VaultModel = armrecoveryservicesdatareplication.VaultModel{ - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), - // }, - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_Delete.json -func ExampleVaultClient_BeginDelete() { +// Generated from example definition: 2024-09-01/Vault_Get.json +func ExampleVaultClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewVaultClient().BeginDelete(ctx, "rgrecoveryservicesdatareplication", "4", nil) + res, err := clientFactory.NewVaultClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", 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) - } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armrecoveryservicesdatareplication.VaultClientGetResponse{ + // VaultModel: &armrecoveryservicesdatareplication.VaultModel{ + // Location: to.Ptr("eck"), + // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), + // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), + // Type: to.Ptr("xtcicpcmjvocohaznrk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("rm"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // LastModifiedBy: to.Ptr("gkojzu"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_ListBySubscription.json -func ExampleVaultClient_NewListBySubscriptionPager() { +// Generated from example definition: 2024-09-01/Vault_List.json +func ExampleVaultClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewVaultClient().NewListBySubscriptionPager(&armrecoveryservicesdatareplication.VaultClientListBySubscriptionOptions{ContinuationToken: to.Ptr("dqsjhseyugyexxrlrln")}) + pager := clientFactory.NewVaultClient().NewListPager("rgrecoveryservicesdatareplication", &VaultClientListOptions{ + continuationToken: to.Ptr("mwculdaqndp")}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -210,46 +152,47 @@ func ExampleVaultClient_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.VaultModelCollection = armrecoveryservicesdatareplication.VaultModelCollection{ - // Value: []*armrecoveryservicesdatareplication.VaultModel{ - // { - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + // page = armrecoveryservicesdatareplication.VaultClientListResponse{ + // VaultModelListResult: armrecoveryservicesdatareplication.VaultModelListResult{ + // Value: []*armrecoveryservicesdatareplication.VaultModel{ + // { + // Location: to.Ptr("eck"), + // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), + // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), + // Type: to.Ptr("xtcicpcmjvocohaznrk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("rm"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // LastModifiedBy: to.Ptr("gkojzu"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // }, // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), - // }, - // }}, + // }, + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/Vault_List.json -func ExampleVaultClient_NewListPager() { +// Generated from example definition: 2024-09-01/Vault_ListBySubscription.json +func ExampleVaultClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewVaultClient().NewListPager("rgrecoveryservicesdatareplication", &armrecoveryservicesdatareplication.VaultClientListOptions{ContinuationToken: to.Ptr("mwculdaqndp")}) + pager := clientFactory.NewVaultClient().NewListBySubscriptionPager(nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -260,30 +203,84 @@ func ExampleVaultClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.VaultModelCollection = armrecoveryservicesdatareplication.VaultModelCollection{ - // Value: []*armrecoveryservicesdatareplication.VaultModel{ - // { - // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), - // Type: to.Ptr("xtcicpcmjvocohaznrk"), - // ID: to.Ptr("hbccseewgiagaxsjozxgwydjgy"), - // Location: to.Ptr("eck"), - // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ - // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateSucceeded), - // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), - // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), - // }, - // SystemData: &armrecoveryservicesdatareplication.VaultModelSystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // CreatedBy: to.Ptr("rm"), - // CreatedByType: to.Ptr("uojlfokjrhzgqoodsvgz"), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), - // LastModifiedBy: to.Ptr("gkojzu"), - // LastModifiedByType: to.Ptr("jua"), - // }, - // Tags: map[string]*string{ - // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // page = armrecoveryservicesdatareplication.VaultClientListBySubscriptionResponse{ + // VaultModelListResult: armrecoveryservicesdatareplication.VaultModelListResult{ + // Value: []*armrecoveryservicesdatareplication.VaultModel{ + // { + // Location: to.Ptr("eck"), + // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), + // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), + // Type: to.Ptr("xtcicpcmjvocohaznrk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("rm"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // LastModifiedBy: to.Ptr("gkojzu"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // }, // }, - // }}, + // }, + // }, // } } } + +// Generated from example definition: 2024-09-01/Vault_Update.json +func ExampleVaultClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("930CEC23-4430-4513-B855-DBA237E2F3BF", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewVaultClient().BeginUpdate(ctx, "rgrecoveryservicesdatareplication", "4", armrecoveryservicesdatareplication.VaultModelUpdate{ + Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ + VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + }, + Tags: map[string]*string{ + "key8872": to.Ptr("pvtc"), + }, + }, 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 = armrecoveryservicesdatareplication.VaultClientUpdateResponse{ + // VaultModel: &armrecoveryservicesdatareplication.VaultModel{ + // Location: to.Ptr("eck"), + // Properties: &armrecoveryservicesdatareplication.VaultModelProperties{ + // ProvisioningState: to.Ptr(armrecoveryservicesdatareplication.ProvisioningStateCanceled), + // ServiceResourceID: to.Ptr("mksumcmksgdsghojszxq"), + // VaultType: to.Ptr(armrecoveryservicesdatareplication.ReplicationVaultTypeDisasterRecovery), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.DataReplication/replicationVaults/vault1"), + // Name: to.Ptr("bqgyqxmnlgwqxbmajddqwtao"), + // Type: to.Ptr("xtcicpcmjvocohaznrk"), + // SystemData: &armrecoveryservicesdatareplication.SystemData{ + // CreatedBy: to.Ptr("rm"), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // LastModifiedBy: to.Ptr("gkojzu"), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-08-25T00:28:58.092Z"); return t}()), + // }, + // Tags: map[string]*string{ + // "key5359": to.Ptr("ljfilxolxzuxrauopwtyxghrp"), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client.go deleted file mode 100644 index 169e213fbda4..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client.go +++ /dev/null @@ -1,119 +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 armrecoveryservicesdatareplication - -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" -) - -// WorkflowOperationStatusClient contains the methods for the WorkflowOperationStatus group. -// Don't use this type directly, use NewWorkflowOperationStatusClient() instead. -type WorkflowOperationStatusClient struct { - internal *arm.Client - subscriptionID string -} - -// NewWorkflowOperationStatusClient creates a new instance of WorkflowOperationStatusClient 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 NewWorkflowOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkflowOperationStatusClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &WorkflowOperationStatusClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Tracks the results of an asynchronous operation on the job. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2021-02-16-preview -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - vaultName - The vault name. -// - jobName - The job (workflow) name. -// - operationID - The ID of an ongoing async operation. -// - options - WorkflowOperationStatusClientGetOptions contains the optional parameters for the WorkflowOperationStatusClient.Get -// method. -func (client *WorkflowOperationStatusClient) Get(ctx context.Context, resourceGroupName string, vaultName string, jobName string, operationID string, options *WorkflowOperationStatusClientGetOptions) (WorkflowOperationStatusClientGetResponse, error) { - var err error - const operationName = "WorkflowOperationStatusClient.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, vaultName, jobName, operationID, options) - if err != nil { - return WorkflowOperationStatusClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return WorkflowOperationStatusClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return WorkflowOperationStatusClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *WorkflowOperationStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, vaultName string, jobName string, operationID string, options *WorkflowOperationStatusClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DataReplication/replicationVaults/{vaultName}/jobs/{jobName}/operations/{operationId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if vaultName == "" { - return nil, errors.New("parameter vaultName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{vaultName}", url.PathEscape(vaultName)) - if jobName == "" { - return nil, errors.New("parameter jobName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{jobName}", url.PathEscape(jobName)) - if operationID == "" { - return nil, errors.New("parameter operationID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) - 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-02-16-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *WorkflowOperationStatusClient) getHandleResponse(resp *http.Response) (WorkflowOperationStatusClientGetResponse, error) { - result := WorkflowOperationStatusClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return WorkflowOperationStatusClientGetResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client_example_test.go b/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client_example_test.go deleted file mode 100644 index 1ce990863bc7..000000000000 --- a/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication/workflowoperationstatus_client_example_test.go +++ /dev/null @@ -1,45 +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 armrecoveryservicesdatareplication_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservicesdatareplication/armrecoveryservicesdatareplication" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/3066a973f4baf2e2bf072a013b585a820bb10146/specification/recoveryservicesdatareplication/resource-manager/Microsoft.DataReplication/preview/2021-02-16-preview/examples/WorkflowOperationStatus_Get.json -func ExampleWorkflowOperationStatusClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armrecoveryservicesdatareplication.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWorkflowOperationStatusClient().Get(ctx, "rgrecoveryservicesdatareplication", "4", "ZGH4y", "wdqcxc", 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.OperationStatus = armrecoveryservicesdatareplication.OperationStatus{ - // Name: to.Ptr("wzdasptnwlxgobklayoqapjcgcf"), - // EndTime: to.Ptr("nauyrfh"), - // ID: to.Ptr("sf"), - // StartTime: to.Ptr("xuzwmfrhluafmwwsmzqxsytyehsh"), - // Status: to.Ptr("plbnngzfppdram"), - // } -} diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md b/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md index 84c95f41c398..5c07f36ddfa5 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.1.1 (2025-02-27) +### Other Changes + + ## 1.1.0 (2025-01-23) ### Features Added diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go index c31aa76192f1..36cb201ffa17 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go @@ -6,7 +6,7 @@ package armservicenetworking const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicenetworking/armservicenetworking" - moduleVersion = "v1.1.0" + moduleVersion = "v1.1.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/tsp-location.yaml b/sdk/resourcemanager/servicenetworking/armservicenetworking/tsp-location.yaml index 8ebd24797a45..5e634ddeed87 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/tsp-location.yaml +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/servicenetworking/ServiceNetworking.Management -commit: 508a12f060dc46c5dcfabd0cd98a913b44b24e47 +commit: 676334a284e5136f0a0721d6ae844bb04332f579 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..6ffd90b32c8e 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md +++ b/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2025-02-27) +### 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/models.go b/sdk/resourcemanager/standbypool/armstandbypool/models.go index aaf9ef0d79b8..277ff453c0e5 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/models.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/models.go @@ -33,12 +33,12 @@ type ContainerGroupProperties struct { // 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. + // Localized display information for this particular operation. Display *OperationDisplay + // READ-ONLY; Extensible 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 Azure // Resource Manager/control-plane operations. IsDataAction *bool @@ -315,10 +315,8 @@ type StandbyVirtualMachinePoolRuntimeViewResourceListResult struct { // StandbyPool resource provider. type StandbyVirtualMachinePoolRuntimeViewResourceProperties struct { // READ-ONLY; A list containing the counts of virtual machines in each possible power state for each zone if enabled, as known - // by the StandbyPool resource provider. - // If zones are not enabled on the attached VMSS, the list will contain a single entry with null zone values. - // Note: any updates to pool resources outside of StandbyPoolRP (i.e deleting a VM through portal) are not reflected here. - // Note: any resources in the Running state may still be installing extensions / not fully provisioned. + // by the StandbyPool resource provider. If zones are not enabled on the attached VMSS, the list will contain a single entry + // without zone values. Note: any resources in the Running state may still be installing extensions / not fully provisioned. InstanceCountSummary []*VirtualMachineInstanceCountSummary // READ-ONLY; Displays the provisioning state of the standby pool @@ -390,9 +388,8 @@ type SystemData struct { } // VirtualMachineInstanceCountSummary - Contains the counts of VMs in each power state in a given zone, fault domain, as known -// by the StandbyPool resource provider. -// Note: any updates to pool resources outside of StandbyPoolRP (i.e deleting a VM through portal) are not reflected here. -// Note: any resources in the Running state may still be installing extensions / not fully provisioned. +// by the StandbyPool resource provider. Note: any resources in the Running state may still be installing extensions / not +// fully provisioned. type VirtualMachineInstanceCountSummary struct { // REQUIRED; The count of pooled resources in each state for the given zone. InstanceCountsByState []*PoolResourceStateCount diff --git a/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachines_client_example_test.go b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachines_client_example_test.go index 54a13581096c..c2ddec6d77a3 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachines_client_example_test.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/standbyvirtualmachines_client_example_test.go @@ -32,7 +32,7 @@ func ExampleStandbyVirtualMachinesClient_Get() { // res = armstandbypool.StandbyVirtualMachinesClientGetResponse{ // StandbyVirtualMachineResource: &armstandbypool.StandbyVirtualMachineResource{ // Properties: &armstandbypool.StandbyVirtualMachineResourceProperties{ - // VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/provider/Microsoft.Compute/virtualMachines/virtualMachine"), + // VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachines/virtualMachine"), // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), // }, // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool/standbyVirtualMachines/virtualMachine"), @@ -77,7 +77,7 @@ func ExampleStandbyVirtualMachinesClient_NewListByStandbyVirtualMachinePoolResou // Value: []*armstandbypool.StandbyVirtualMachineResource{ // { // Properties: &armstandbypool.StandbyVirtualMachineResourceProperties{ - // VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/provider/Microsoft.Compute/virtualMachines/virtualMachine"), + // VirtualMachineResourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.Compute/virtualMachines/virtualMachine"), // ProvisioningState: to.Ptr(armstandbypool.ProvisioningStateSucceeded), // }, // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000009/resourceGroups/rgstandbypool/providers/Microsoft.StandbyPool/standbyVirtualMachinePools/pool/standbyVirtualMachines/virtualMachine"), diff --git a/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml b/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml index 10840906cfb3..17bd045f7652 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: 676334a284e5136f0a0721d6ae844bb04332f579 repo: Azure/azure-rest-api-specs -additionalDirectories: +additionalDirectories: \ No newline at end of file diff --git a/sdk/resourcemanager/terraform/armterraform/CHANGELOG.md b/sdk/resourcemanager/terraform/armterraform/CHANGELOG.md index 683baba6e17a..0e02a019b243 100644 --- a/sdk/resourcemanager/terraform/armterraform/CHANGELOG.md +++ b/sdk/resourcemanager/terraform/armterraform/CHANGELOG.md @@ -1,5 +1,13 @@ # Release History +## 0.2.0 (2025-02-27) +### Features Added + +- New enum type `AuthorizationScopeFilter` with values `AuthorizationScopeFilterAtScopeAboveAndBelow`, `AuthorizationScopeFilterAtScopeAndAbove`, `AuthorizationScopeFilterAtScopeAndBelow`, `AuthorizationScopeFilterAtScopeExact` +- New field `AuthorizationScopeFilter`, `Table` in struct `ExportQuery` +- New field `Import` in struct `ExportResult` + + ## 0.1.0 (2024-11-20) ### Other Changes diff --git a/sdk/resourcemanager/terraform/armterraform/constants.go b/sdk/resourcemanager/terraform/armterraform/constants.go index d0c99ec10c13..5023bbbf3567 100644 --- a/sdk/resourcemanager/terraform/armterraform/constants.go +++ b/sdk/resourcemanager/terraform/armterraform/constants.go @@ -6,7 +6,7 @@ package armterraform const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/terraform/armterraform" - 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. @@ -24,6 +24,32 @@ func PossibleActionTypeValues() []ActionType { } } +// AuthorizationScopeFilter - The Azure Resource Graph Authorization Scope Filter parameter +type AuthorizationScopeFilter string + +const ( + // AuthorizationScopeFilterAtScopeAboveAndBelow - Returns assignments for the given scope, all parent scopes, and all child + // scopes. + AuthorizationScopeFilterAtScopeAboveAndBelow AuthorizationScopeFilter = "AtScopeAboveAndBelow" + // AuthorizationScopeFilterAtScopeAndAbove - Returns assignments for the given scope and all parent scopes, but not child + // scopes. + AuthorizationScopeFilterAtScopeAndAbove AuthorizationScopeFilter = "AtScopeAndAbove" + // AuthorizationScopeFilterAtScopeAndBelow - Returns assignments for the given scope and all child scopes. + AuthorizationScopeFilterAtScopeAndBelow AuthorizationScopeFilter = "AtScopeAndBelow" + // AuthorizationScopeFilterAtScopeExact - Returns assignments only for the given scope; no parent or child scopes are included. + AuthorizationScopeFilterAtScopeExact AuthorizationScopeFilter = "AtScopeExact" +) + +// PossibleAuthorizationScopeFilterValues returns the possible values for the AuthorizationScopeFilter const type. +func PossibleAuthorizationScopeFilterValues() []AuthorizationScopeFilter { + return []AuthorizationScopeFilter{ + AuthorizationScopeFilterAtScopeAboveAndBelow, + AuthorizationScopeFilterAtScopeAndAbove, + AuthorizationScopeFilterAtScopeAndBelow, + AuthorizationScopeFilterAtScopeExact, + } +} + // 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 diff --git a/sdk/resourcemanager/terraform/armterraform/models.go b/sdk/resourcemanager/terraform/armterraform/models.go index 96e615ca4de8..490bf151ec61 100644 --- a/sdk/resourcemanager/terraform/armterraform/models.go +++ b/sdk/resourcemanager/terraform/armterraform/models.go @@ -65,6 +65,9 @@ type ExportQuery struct { // Field has constant value TypeExportQuery, any specified value is ignored. Type *Type + // The ARG Scope Filter parameter + AuthorizationScopeFilter *AuthorizationScopeFilter + // Whether to output all non-computed properties in the generated Terraform configuration? This probably needs manual modifications // to make it valid FullProperties *bool @@ -78,6 +81,9 @@ type ExportQuery struct { // Whether to recursively list child resources of the query result Recursive *bool + // The ARG table name + Table *string + // The target Azure Terraform Provider TargetProvider *TargetProvider } @@ -172,18 +178,21 @@ type ExportResult struct { // A list of errors derived during exporting each resource Errors []*ErrorDetail + // The Terraform import blocks for the current export, which users can use to run "terraform plan" with to import the resources + Import *string + // A list of Azure resources which are not exported to Terraform due to there is no corresponding resources in Terraform SkippedResources []*string } // Operation - Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - ActionType *ActionType - - // READ-ONLY; Localized display information for this particular operation. + // Localized display information for this particular operation. Display *OperationDisplay + // READ-ONLY; Extensible 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 Azure // Resource Manager/control-plane operations. IsDataAction *bool diff --git a/sdk/resourcemanager/terraform/armterraform/models_serde.go b/sdk/resourcemanager/terraform/armterraform/models_serde.go index 4841989a5a45..70e13fcd3534 100644 --- a/sdk/resourcemanager/terraform/armterraform/models_serde.go +++ b/sdk/resourcemanager/terraform/armterraform/models_serde.go @@ -127,11 +127,13 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ExportQuery. func (e ExportQuery) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "authorizationScopeFilter", e.AuthorizationScopeFilter) populate(objectMap, "fullProperties", e.FullProperties) populate(objectMap, "maskSensitive", e.MaskSensitive) populate(objectMap, "namePattern", e.NamePattern) populate(objectMap, "query", e.Query) populate(objectMap, "recursive", e.Recursive) + populate(objectMap, "table", e.Table) populate(objectMap, "targetProvider", e.TargetProvider) objectMap["type"] = TypeExportQuery return json.Marshal(objectMap) @@ -146,6 +148,9 @@ func (e *ExportQuery) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "authorizationScopeFilter": + err = unpopulate(val, "AuthorizationScopeFilter", &e.AuthorizationScopeFilter) + delete(rawMsg, key) case "fullProperties": err = unpopulate(val, "FullProperties", &e.FullProperties) delete(rawMsg, key) @@ -161,6 +166,9 @@ func (e *ExportQuery) UnmarshalJSON(data []byte) error { case "recursive": err = unpopulate(val, "Recursive", &e.Recursive) delete(rawMsg, key) + case "table": + err = unpopulate(val, "Table", &e.Table) + delete(rawMsg, key) case "targetProvider": err = unpopulate(val, "TargetProvider", &e.TargetProvider) delete(rawMsg, key) @@ -282,6 +290,7 @@ func (e ExportResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "configuration", e.Configuration) populate(objectMap, "errors", e.Errors) + populate(objectMap, "import", e.Import) populate(objectMap, "skippedResources", e.SkippedResources) return json.Marshal(objectMap) } @@ -301,6 +310,9 @@ func (e *ExportResult) UnmarshalJSON(data []byte) error { case "errors": err = unpopulate(val, "Errors", &e.Errors) delete(rawMsg, key) + case "import": + err = unpopulate(val, "Import", &e.Import) + delete(rawMsg, key) case "skippedResources": err = unpopulate(val, "SkippedResources", &e.SkippedResources) delete(rawMsg, key) diff --git a/sdk/resourcemanager/terraform/armterraform/terraform_client_example_test.go b/sdk/resourcemanager/terraform/armterraform/terraform_client_example_test.go index 2f9c447ca7e9..a6fb7ee92d0d 100644 --- a/sdk/resourcemanager/terraform/armterraform/terraform_client_example_test.go +++ b/sdk/resourcemanager/terraform/armterraform/terraform_client_example_test.go @@ -6,7 +6,7 @@ package armterraform_test import ( "context" - // "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/terraform/armterraform" "log" @@ -23,12 +23,10 @@ func ExampleTerraformClient_BeginExportTerraform() { if err != nil { log.Fatalf("failed to create client: %v", err) } - // armterraform.ExportResourceGroup{ - // Type: to.Ptr(armterraform.TypeExportResourceGroup), - // ResourceGroupName: to.Ptr("rg1"), - // } - var b armterraform.BaseExportModelClassification - poller, err := clientFactory.NewTerraformClient().BeginExportTerraform(ctx, b, nil) + poller, err := clientFactory.NewTerraformClient().BeginExportTerraform(ctx, armterraform.ExportResourceGroup{ + Type: to.Ptr(armterraform.TypeExportResourceGroup), + ResourceGroupName: to.Ptr("rg1"), + }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/terraform/armterraform/tsp-location.yaml b/sdk/resourcemanager/terraform/armterraform/tsp-location.yaml index 3d2afc909690..f6afcde04a79 100644 --- a/sdk/resourcemanager/terraform/armterraform/tsp-location.yaml +++ b/sdk/resourcemanager/terraform/armterraform/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/terraform/Microsoft.AzureTerraform.Management -commit: d477c7caa09bf82e22c419be0a99d170552b5892 +commit: 676334a284e5136f0a0721d6ae844bb04332f579 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..8571d188162a 100644 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md +++ b/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md @@ -1,5 +1,17 @@ # Release History +## 0.2.0 (2025-02-27) +### 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/models.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go index cfb89b3234d0..0f26f0fd32b8 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. @@ -205,12 +187,12 @@ type CodeSigningAccountProperties struct { // 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. + // Localized display information for this particular operation. Display *OperationDisplay + // READ-ONLY; Extensible 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 Azure // Resource Manager/control-plane operations. IsDataAction *bool 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..11d0c4063543 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: 676334a284e5136f0a0721d6ae844bb04332f579 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..6587a42053cb 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/CHANGELOG.md +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/CHANGELOG.md @@ -1,5 +1,81 @@ # Release History +## 1.0.0 (2025-02-27) +### 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 `ConfigurationType` has been removed +- Enum `ManagedServiceIdentityType` has been removed +- Function `*ClientFactory.NewSAPCentralInstancesClient` has been removed +- Function `*ClientFactory.NewWorkloadsClient` 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 `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 field `ResourceID` in struct `OperationStatusResult` +- 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..750a53c4eaea 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) { @@ -51,9 +47,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 +70,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..0d5a498238cf 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/constants.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/constants.go @@ -1,22 +1,19 @@ -//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" + moduleVersion = "v1.0.0" ) -// ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +// 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" ) @@ -31,8 +28,11 @@ func PossibleActionTypeValues() []ActionType { 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 +49,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 +78,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 +106,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 +139,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 +153,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 +192,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 +211,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" ) @@ -218,8 +230,11 @@ func PossibleOSTypeValues() []OSType { type Origin string const ( - OriginSystem Origin = "system" - OriginUser Origin = "user" + // 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" ) @@ -236,9 +251,12 @@ func PossibleOriginValues() []Origin { 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 +272,7 @@ func PossibleSAPConfigurationTypeValues() []SAPConfigurationType { type SAPDatabaseScaleMethod string const ( + // SAPDatabaseScaleMethodScaleUp - ScaleUp Hana Database deployment type SAPDatabaseScaleMethodScaleUp SAPDatabaseScaleMethod = "ScaleUp" ) @@ -268,7 +287,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 +305,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 +323,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 +341,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 +365,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 +383,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 +404,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 +421,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 +495,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 +528,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/operations_server.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/operations_server.go index 1848d7f7e300..bf0a103eae45 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/operations_server.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/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 @@ -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) { @@ -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/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..8ac4cb3857c5 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,20 @@ import ( // ServerFactory is a fake server for instances of the armworkloadssapvirtualinstance.ClientFactory type. type ServerFactory struct { - OperationsServer OperationsServer + // OperationsServer contains the fakes for client OperationsClient + 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. @@ -43,10 +47,9 @@ type ServerFactoryTransport struct { 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. @@ -70,11 +73,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { 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 +88,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/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..992b9af95da6 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://learn.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,32 +576,22 @@ 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://learn.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://learn.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. @@ -612,11 +603,11 @@ 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. + // READ-ONLY; Extensible 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. + // 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", @@ -628,7 +619,7 @@ type Operation struct { Origin *Origin } -// OperationDisplay - Localized display information for this particular operation. +// 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 @@ -649,11 +640,11 @@ type OperationDisplay struct { // OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to // get the next set of results. type OperationListResult struct { - // READ-ONLY; URL to get the next set of operation list results (if there are any). - NextLink *string - - // READ-ONLY; List of operations supported by the resource provider + // REQUIRED; The Operation items on this page Value []*Operation + + // The link to the next page of items + NextLink *string } // OperationStatusResult - The current status of an async operation. @@ -677,10 +668,13 @@ 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 + + // READ-ONLY; Fully qualified ID of the resource against which the original async operation was started. + ResourceID *string } // OsSapConfiguration - Defines the OS and SAP Configurations for Deployment @@ -697,18 +691,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 +710,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 +797,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 +821,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 +877,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 +889,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 +908,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 +994,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 +1044,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 +1097,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 +1112,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 +1125,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 + + // The identities assigned to this resource by the user. + UserAssignedIdentities map[string]*UserAssignedIdentity +} - // Gets the list of Virtual Instances for SAP solutions resources. +// 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 +1159,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 +1187,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://learn.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). type SSHKeyPair struct { // SSH private key. PrivateKey *string @@ -1197,8 +1200,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://learn.microsoft.com/azure/virtual-machines/linux/create-ssh-keys-detailed). KeyData *string } @@ -1216,7 +1218,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 +1246,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 +1285,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 +1297,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 +1314,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 +1331,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 +1345,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 +1364,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 +1378,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 +1404,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 +1418,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 +1458,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 +1486,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 +1533,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 +1563,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 +1578,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 +1591,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..123da85382e6 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) } @@ -1537,6 +1533,7 @@ func (o OperationStatusResult) MarshalJSON() ([]byte, error) { populate(objectMap, "name", o.Name) populate(objectMap, "operations", o.Operations) populate(objectMap, "percentComplete", o.PercentComplete) + populate(objectMap, "resourceId", o.ResourceID) populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) populate(objectMap, "status", o.Status) return json.Marshal(objectMap) @@ -1569,6 +1566,9 @@ func (o *OperationStatusResult) UnmarshalJSON(data []byte) error { case "percentComplete": err = unpopulate(val, "PercentComplete", &o.PercentComplete) delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &o.ResourceID) + delete(rawMsg, key) case "startTime": err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) delete(rawMsg, key) @@ -1665,16 +1665,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 +1876,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 +1927,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 +2040,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 +2115,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 +2415,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 +2630,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 +2980,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 +3069,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 +3096,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 +3341,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 +3633,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 +3748,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.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client.go index b8bc3adcba32..3bc79af74b05 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -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-09-01 // - 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) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Workloads/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-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client_example_test.go b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client_example_test.go index 5d08b8a4c4be..6552b7d20fed 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client_example_test.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/operations_client_example_test.go @@ -1,30 +1,24 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package 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" + "log" ) -// 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 +// Generated from example definition: 2024-09-01/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) + clientFactory, err := armworkloadssapvirtualinstance.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,278 +33,1101 @@ func ExampleOperationsClient_NewListPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationListResult = 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), + // page = armworkloadssapvirtualinstance.OperationsClientListResponse{ + // OperationListResult: armworkloadssapvirtualinstance.OperationListResult{ + // Value: []*armworkloadssapvirtualinstance.Operation{ + // { + // Name: to.Ptr("Microsoft.Workloads/RegisteredSubscriptions/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("RegisteredSubscriptions"), + // Operation: to.Ptr("Gets/Lists registered subscriptions"), + // Description: to.Ptr("Reads registered subscriptions"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/wordpressInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("phpWorkloads/wordpressInstances"), + // Operation: to.Ptr("WordpressInstances_List"), + // Description: to.Ptr("Lists WordpressInstances resources under a phpWorkload resource"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/wordpressInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("phpWorkloads/wordpressInstances"), + // Operation: to.Ptr("WordpressInstances_Get"), + // Description: to.Ptr("Gets a WordpressInstances resource"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/wordpressInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("phpWorkloads/wordpressInstances"), + // Operation: to.Ptr("WordpressInstances_CreateOrUpdate"), + // Description: to.Ptr("Create or updated WordpressInstances resource"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/wordpressInstances/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("phpWorkloads/wordpressInstances"), + // Operation: to.Ptr("WordpressInstances_Delete"), + // Description: to.Ptr("Delete WordpressInstances resource"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/skus/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("Skus"), + // Operation: to.Ptr("Gets the list of Microsoft.Workloads SKUs available for your Subscription"), + // Description: to.Ptr("Gets the list of Microsoft.Workloads SKUs available for your Subscription"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/Operations/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("Operations"), + // Operation: to.Ptr("read_Operations"), + // Description: to.Ptr("read Operations"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/register/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("Microsoft.Workloads"), + // Operation: to.Ptr("Register the Microsoft.Workloads"), + // Description: to.Ptr("Register the subscription for Microsoft.Workloads"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/unregister/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("Microsoft.Workloads"), + // Operation: to.Ptr("Unregister the Microsoft.Workloads"), + // Description: to.Ptr("Unregister the subscription for Microsoft.Workloads"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/Locations/OperationStatuses/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("Locations/OperationStatuses"), + // Operation: to.Ptr("read_OperationStatuses"), + // Description: to.Ptr("read OperationStatuses"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/Locations/OperationStatuses/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("Locations/OperationStatuses"), + // Operation: to.Ptr("write_OperationStatuses"), + // Description: to.Ptr("write OperationStatuses"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("phpWorkloads"), + // Operation: to.Ptr("PhpWorkloads_ListBySubscription"), + // Description: to.Ptr("Lists phpWorkload resources in a subscription"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("phpWorkloads"), + // Operation: to.Ptr("PhpWorkloads_ListByResourceGroup"), + // Description: to.Ptr("Lists phpWorkload resources in a resource group"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("phpWorkloads"), + // Operation: to.Ptr("PhpWorkloads_Get"), + // Description: to.Ptr("Gets a phpWorkload resource"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("phpWorkloads"), + // Operation: to.Ptr("PhpWorkloads_CreateOrUpdate"), + // Description: to.Ptr("Create or updated phpWorkloads resource"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("phpWorkloads"), + // Operation: to.Ptr("PhpWorkloads_Delete"), + // Description: to.Ptr("Delete phpWorkloads resource"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/phpWorkloads/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("phpWorkloads"), + // Operation: to.Ptr("PhpWorkloads_Update"), + // Description: to.Ptr("Update PHP workload resource."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), + // Operation: to.Ptr("SAPApplicationServerInstances_Get"), + // Description: to.Ptr("Gets the SAP Application Server Instance."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), + // Operation: to.Ptr("SAPApplicationServerInstances_Create"), + // Description: to.Ptr("Puts the SAP Application Server Instance."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), + // Operation: to.Ptr("SAPApplicationServerInstances_Delete"), + // Description: to.Ptr("Deletes the SAP Application Server Instance.

This operation will be used by service only. Delete by end user will return a Bad Request error."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), + // Operation: to.Ptr("SAPApplicationServerInstances_Update"), + // Description: to.Ptr("Puts the SAP Application Server Instance."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), + // Operation: to.Ptr("SAPApplicationServerInstances_List"), + // Description: to.Ptr("Lists the SAP Application server Instances in an SVI."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/start/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), + // Operation: to.Ptr("SAPApplicationServerInstances_StartInstance"), + // Description: to.Ptr("Starts the SAP Application server Instance in an SVI."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/applicationInstances/stop/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/applicationInstances"), + // Operation: to.Ptr("SAPApplicationServerInstances_StopInstance"), + // Description: to.Ptr("Stops the SAP Application server Instance in an SVI."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/centralInstances"), + // Operation: to.Ptr("SAPCentralInstances_Get"), + // Description: to.Ptr("Gets the SAP Central Instance."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/centralInstances"), + // Operation: to.Ptr("SAPCentralInstances_Create"), + // Description: to.Ptr("Puts the SAP Central Instance.

This will be used by service only. PUT by end user will return a Bad Request error."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/centralInstances"), + // Operation: to.Ptr("SAPCentralInstances_Delete"), + // Description: to.Ptr("Deletes the SAP Central Instance.

This will be used by service only. Delete by end user will return a Bad Request error."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/centralInstances"), + // Operation: to.Ptr("SAPCentralInstances_Update"), + // Description: to.Ptr("Updates the SAP Central Instance.

This can be used to update tags."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/centralInstances"), + // Operation: to.Ptr("SAPCentralInstances_List"), + // Description: to.Ptr("Lists the SAP Central Instances in an SVI."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/start/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/centralInstances"), + // Operation: to.Ptr("SAPCentralInstances_StartInstance"), + // Description: to.Ptr("Starts the SAP Central server Instance in an SVI."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/centralInstances/stop/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/centralInstances"), + // Operation: to.Ptr("SAPCentralInstances_StopInstance"), + // Description: to.Ptr("Stops the SAP Central server Instance in an SVI."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), + // Operation: to.Ptr("SAPDatabaseInstances_Get"), + // Description: to.Ptr("Gets the SAP Database Instance."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), + // Operation: to.Ptr("SAPDatabaseInstances_Create"), + // Description: to.Ptr("Puts the SAP Database Instance."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), + // Operation: to.Ptr("SAPDatabaseInstances_Delete"), + // Description: to.Ptr("Deletes the SAP Database Instance.

This will be used by service only. Delete by end user will return a Bad Request error."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), + // Operation: to.Ptr("SAPDatabaseInstances_Update"), + // Description: to.Ptr("Puts the SAP Database Instance."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), + // Operation: to.Ptr("SAPDatabaseInstances_List"), + // Description: to.Ptr("Lists the SAP Database Instances in an SVI."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/start/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), + // Operation: to.Ptr("SAPDatabaseInstances_StartInstance"), + // Description: to.Ptr("Starts the database instance of the SAP system."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/databaseInstances/stop/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances/databaseInstances"), + // Operation: to.Ptr("SAPDatabaseInstances_StopInstance"), + // Description: to.Ptr("Stops the database instance of the SAP system."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors"), + // Operation: to.Ptr("monitors_List"), + // Description: to.Ptr("Gets a list of SAP monitors in the specified subscription. The operations returns various properties of each SAP monitor."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors"), + // Operation: to.Ptr("monitors_ListByResourceGroup"), + // Description: to.Ptr("Gets a list of SAP monitors in the specified resource group."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors"), + // Operation: to.Ptr("monitors_Get"), + // Description: to.Ptr("Gets properties of a SAP monitor for the specified subscription, resource group, and resource name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors"), + // Operation: to.Ptr("monitors_Create"), + // Description: to.Ptr("Creates a SAP monitor for the specified subscription, resource group, and resource name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors"), + // Operation: to.Ptr("monitors_Delete"), + // Description: to.Ptr("Deletes a SAP monitor with the specified subscription, resource group, and monitor name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors"), + // Operation: to.Ptr("monitors_Update"), + // Description: to.Ptr("Patches the Tags field of a SAP monitor for the specified subscription, resource group, and monitor name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/providerInstances"), + // Operation: to.Ptr("ProviderInstances_List"), + // Description: to.Ptr("Gets a list of provider instances in the specified SAP monitor. The operations returns various properties of each provider instances."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/providerInstances"), + // Operation: to.Ptr("ProviderInstances_Get"), + // Description: to.Ptr("Gets properties of a provider instance for the specified subscription, resource group, Monitor name, and resource name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/providerInstances"), + // Operation: to.Ptr("ProviderInstances_Create"), + // Description: to.Ptr("Creates a provider instance for the specified subscription, resource group, Monitor name, and resource name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/providerInstances/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/providerInstances"), + // Operation: to.Ptr("ProviderInstances_Delete"), + // Description: to.Ptr("Deletes a provider instance for the specified subscription, resource group, Monitor name, and resource name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/alerts/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/alerts"), + // Operation: to.Ptr("Alerts_List"), + // Description: to.Ptr("Gets a list of alert instances in the specified SAP monitor. The operations returns various properties of each provider instances."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/alerts/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/alerts"), + // Operation: to.Ptr("Alerts_Get"), + // Description: to.Ptr("Gets properties of a alert for the specified subscription, resource group, Monitor name, and resource name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/alerts/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/alerts"), + // Operation: to.Ptr("Alerts_Create"), + // Description: to.Ptr("Creates a alert for the specified subscription, resource group, Monitor name, and resource name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/alerts/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/alerts"), + // Operation: to.Ptr("Alerts_Delete"), + // Description: to.Ptr("Deletes a alert for the specified subscription, resource group, Monitor name, and resource name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/alertTemplates/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/alertTemplates"), + // Operation: to.Ptr("AlertTemplates_List"), + // Description: to.Ptr("Gets properties of an alert template for the specified subscription, resource group, SAP monitor name, and resource name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/alertTemplates/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/alertTemplates"), + // Operation: to.Ptr("AlertTemplates_Get"), + // Description: to.Ptr("Gets properties of a alert for the specified subscription, resource group, Monitor name, and resource name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/sapLandscapeMonitor"), + // Operation: to.Ptr("SapLandscapeMonitor_List"), + // Description: to.Ptr("Gets a list of properties of a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/sapLandscapeMonitor"), + // Operation: to.Ptr("SapLandscapeMonitor_Get"), + // Description: to.Ptr("Gets properties of a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/sapLandscapeMonitor"), + // Operation: to.Ptr("SapLandscapeMonitor_Create"), + // Description: to.Ptr("Creates a SAP Landscape monitor configuration for the specified subscription, resource group, and resource name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/monitors/sapLandscapeMonitor/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("monitors/sapLandscapeMonitor"), + // Operation: to.Ptr("SapLandscapeMonitor_Delete"), + // Description: to.Ptr("Deletes a SAP Landscape monitor configuration with the specified subscription, resource group, and monitor name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances"), + // Operation: to.Ptr("SAPVirtualInstances_Get"), + // Description: to.Ptr("Gets an SAP Virtual Instance."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances"), + // Operation: to.Ptr("SAPVirtualInstances_Create"), + // Description: to.Ptr("Creates an SAP Virtual Instance."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances"), + // Operation: to.Ptr("SAPVirtualInstances_Delete"), + // Description: to.Ptr("Deletes an SAP Virtual Instance."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances"), + // Operation: to.Ptr("SAPVirtualInstances_Update"), + // Description: to.Ptr("Updates an SAP Virtual Instance."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances"), + // Operation: to.Ptr("SAPVirtualInstances_ListByResourceGroup"), + // Description: to.Ptr("Gets all SAP Virtual Instances in a resource group."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances"), + // Operation: to.Ptr("SAPVirtualInstances_ListBySubscription"), + // Description: to.Ptr("Gets all SAP Virtual Instances in the subscription."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/start/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances"), + // Operation: to.Ptr("SAPVirtualInstances_Start"), + // Description: to.Ptr("Starts the SAP System."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapVirtualInstances/stop/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapVirtualInstances"), + // Operation: to.Ptr("SAPVirtualInstances_Stop"), + // Description: to.Ptr("Stops the SAP System."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/locations/sapVirtualInstanceMetadata/getSizingRecommendations/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("locations/sapVirtualInstanceMetadata"), + // Operation: to.Ptr("SAPSizingRecommendations"), + // Description: to.Ptr("Get SAP sizing recommendations."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/locations/sapVirtualInstanceMetadata/getSapSupportedSku/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("locations/sapVirtualInstanceMetadata"), + // Operation: to.Ptr("SAPSupportedSku"), + // Description: to.Ptr("Get SAP supported SKUs."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/locations/sapVirtualInstanceMetadata/getDiskConfigurations/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("locations/sapVirtualInstanceMetadata"), + // Operation: to.Ptr("SAPDiskConfigurations"), + // Description: to.Ptr("Get SAP Disk Configurations."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/locations/sapVirtualInstanceMetadata/getAvailabilityZoneDetails/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("locations/sapVirtualInstanceMetadata"), + // Operation: to.Ptr("SAPAvailabilityZoneDetails"), + // Description: to.Ptr("Get SAP Availability Zone Details."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors"), + // Operation: to.Ptr("Connectors_Get"), + // Description: to.Ptr("Gets a connector resource"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors"), + // Operation: to.Ptr("Connectors_Create"), + // Description: to.Ptr("Creates a connector resource"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors"), + // Operation: to.Ptr("Connectors_Delete"), + // Description: to.Ptr("Deletes a connector resource and its child resources, which are the associated connection resources. All the child resources have to be deleted before deleting the connector resource."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors"), + // Operation: to.Ptr("Connectors_Update"), + // Description: to.Ptr("Updates a connector resource"), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors"), + // Operation: to.Ptr("Connectors_ListByResourceGroup"), + // Description: to.Ptr("Gets all connector resources in a Resource Group."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors"), + // Operation: to.Ptr("Connectors_ListBySubscription"), + // Description: to.Ptr("Gets all connector resources in a Subscription."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors/acssBackups"), + // Operation: to.Ptr("ACSSBackupConnections_Get"), + // Description: to.Ptr("Gets the backup connection resource of virtual instance for SAP."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors/acssBackups"), + // Operation: to.Ptr("ACSSBackupConnections_Create"), + // Description: to.Ptr("Creates the backup connection resource of virtual instance for SAP."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors/acssBackups"), + // Operation: to.Ptr("ACSSBackupConnections_Delete"), + // Description: to.Ptr("Deletes the backup connection resource of virtual instance for SAP."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors/acssBackups"), + // Operation: to.Ptr("ACSSBackupConnections_Update"), + // Description: to.Ptr("Updates the backup connection resource of virtual instance for SAP.

This can be used to update tags on the resource."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/acssBackups/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors/acssBackups"), + // Operation: to.Ptr("ACSSBackupConnections_List"), + // Description: to.Ptr("Lists the backup connection resources of virtual instance for SAP under the given connector resource."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/sapVirtualInstanceMonitors/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors/sapVirtualInstanceMonitors"), + // Operation: to.Ptr("SapVirtualInstanceMonitorConnections_Get"), + // Description: to.Ptr("Gets the monitor connection resource of virtual instance for SAP."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/sapVirtualInstanceMonitors/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors/sapVirtualInstanceMonitors"), + // Operation: to.Ptr("SapVirtualInstanceMonitorConnections_Create"), + // Description: to.Ptr("Creates the monitor connection resource of virtual instance for SAP."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/sapVirtualInstanceMonitors/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors/sapVirtualInstanceMonitors"), + // Operation: to.Ptr("SapVirtualInstanceMonitorConnections_Delete"), + // Description: to.Ptr("Deletes the monitor connection resource of virtual instance for SAP."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/sapVirtualInstanceMonitors/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors/sapVirtualInstanceMonitors"), + // Operation: to.Ptr("SapVirtualInstanceMonitorConnections_Update"), + // Description: to.Ptr("Updates the monitor connection resource of virtual instance for SAP.

This can be used to update tags on the resource."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/connectors/sapVirtualInstanceMonitors/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("connectors/sapVirtualInstanceMonitors"), + // Operation: to.Ptr("SapVirtualInstanceMonitorConnections_List"), + // Description: to.Ptr("Lists the monitor connection resources of virtual instance for SAP under the given connector resource."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/insights/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("insights"), + // Operation: to.Ptr("Insights_Get"), + // Description: to.Ptr("Gets properties of Workloads Insights instance for the specified subscription, resource group and instance name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/insights/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("insights"), + // Operation: to.Ptr("Insights_ListByResourceGroup"), + // Description: to.Ptr("Gets a list of Workloads Insight instances in the specified subscription and resource group. The operations returns various properties of each instance."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/insights/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("insights"), + // Operation: to.Ptr("Insights_List"), + // Description: to.Ptr("Gets a list of Workloads Insight instances in the specified subscription. The operations returns various properties of each instance."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/insights/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("insights"), + // Operation: to.Ptr("Insights_Create"), + // Description: to.Ptr("Creates a Workloads Insights instance for the specified subscription, resource group, and instance name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/insights/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("insights"), + // Operation: to.Ptr("Insights_Delete"), + // Description: to.Ptr("Deletes a Workloads Insights instance for the specified subscription, resource group and instance name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/insights/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("insights"), + // Operation: to.Ptr("Insights_Update"), + // Description: to.Ptr("Patches the Workload Insights instance for the specified subscription, resource group, and instance name."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites"), + // Operation: to.Ptr("SAPDiscoverySites_Get"), + // Description: to.Ptr("Gets a SAP Migration discovery site resource."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites"), + // Operation: to.Ptr("SAPDiscoverySites_Create"), + // Description: to.Ptr("Creates a discovery site for SAP Migration."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites"), + // Operation: to.Ptr("SAPDiscoverySites_Delete"), + // Description: to.Ptr("Deletes a SAP Migration discovery site resource and its child resources, that is the associated SAP Instances and Server Instances."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites"), + // Operation: to.Ptr("SAPDiscoverySites_Update"), + // Description: to.Ptr("SAPDiscoverySites_Update."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites"), + // Operation: to.Ptr("SAPDiscoverySites_ListByResourceGroup"), + // Description: to.Ptr("Gets all SAP Migration discovery site resources in a Resource Group."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites"), + // Operation: to.Ptr("SAPDiscoverySites_ListBySubscription"), + // Description: to.Ptr("Gets all SAP Migration discovery site resources in a Subscription."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/importEntities/action"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites"), + // Operation: to.Ptr("SAPDiscoverySites_ImportEntities"), + // Description: to.Ptr("Import a SAP Migration discovery site resource and it's child resources, that is the SAP instances and Server instances."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites/sapInstances"), + // Operation: to.Ptr("SAPInstances_Get"), + // Description: to.Ptr("Gets the SAP Instance resource."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites/sapInstances"), + // Operation: to.Ptr("SAPInstances_Create"), + // Description: to.Ptr("Creates the SAP Instance resource.

This will be used by service only. PUT operation on this resource by end user will return a Bad Request error."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites/sapInstances"), + // Operation: to.Ptr("SAPInstances_Delete"), + // Description: to.Ptr("Deletes the SAP 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 SAP Migration discovery site resource, using the delete operation on it."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites/sapInstances"), + // Operation: to.Ptr("SAPInstances_Update"), + // Description: to.Ptr("Updates the SAP Instance resource."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites/sapInstances"), + // Operation: to.Ptr("SAPInstances_List"), + // Description: to.Ptr("Lists the SAP Instance resources for the given SAP Migration discovery site resource."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/serverInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites/sapInstances/serverInstances"), + // Operation: to.Ptr("ServerInstances_Get"), + // Description: to.Ptr("Gets the Server Instance resource."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/serverInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites/sapInstances/serverInstances"), + // Operation: to.Ptr("ServerInstances_Create"), + // Description: to.Ptr("Creates the Server Instance resource.

This will be used by service only. PUT operation on this resource by end user will return a Bad Request error."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/serverInstances/delete"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites/sapInstances/serverInstances"), + // Operation: to.Ptr("ServerInstances_Delete"), + // Description: to.Ptr("Deletes the Server 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 SAP Migration discovery site resource, using the delete operation on it."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/serverInstances/write"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites/sapInstances/serverInstances"), + // Operation: to.Ptr("ServerInstances_Update"), + // Description: to.Ptr("Updates the Server Instance resource. This operation on a resource by end user will return a Bad Request error."), + // }, + // }, + // { + // Name: to.Ptr("Microsoft.Workloads/sapDiscoverySites/sapInstances/serverInstances/read"), + // IsDataAction: to.Ptr(false), + // Display: &armworkloadssapvirtualinstance.OperationDisplay{ + // Provider: to.Ptr("Microsoft.Workloads"), + // Resource: to.Ptr("sapDiscoverySites/sapInstances/serverInstances"), + // Operation: to.Ptr("ServerInstances_List"), + // Description: to.Ptr("Lists the Server Instance resources for the given SAP Instance resource."), + // }, + // }, // }, - // { - // 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..11124bbe7472 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/options.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/options.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -16,35 +12,35 @@ type OperationsClientListOptions struct { // 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 +61,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 +166,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..5c7e0824ceb5 100644 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses.go +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/responses.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armworkloadssapvirtualinstance @@ -33,18 +29,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 +51,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 +111,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 +144,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 +203,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..ae244e1f60fe --- /dev/null +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/workloads/Workloads.SAPVirtualInstance.Management +commit: 676334a284e5136f0a0721d6ae844bb04332f579 +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), - // }}, - // } -}