From 52e8f6a72a53e9e3ee9a5c5bd5ce49167cea681e Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 13 May 2025 10:16:14 +0000 Subject: [PATCH] CodeGen from PR 34270 in Azure/azure-rest-api-specs Merge c5c31b0506df39bc9e78f53a9678914719c1964d into a19648565889eaae019e531c15f3045d1244c7ce --- .../azonlineexperimentation/CHANGELOG.md | 8 + .../azonlineexperimentation/LICENSE.txt | 21 + .../azonlineexperimentation/README.md | 90 + sdk/analytics/azonlineexperimentation/ci.yml | 27 + .../azonlineexperimentation/client.go | 391 + .../azonlineexperimentation/constants.go | 107 + .../azonlineexperimentation/fake/internal.go | 92 + .../azonlineexperimentation/fake/server.go | 401 + sdk/analytics/azonlineexperimentation/go.mod | 13 + sdk/analytics/azonlineexperimentation/go.sum | 16 + .../azonlineexperimentation/interfaces.go | 15 + .../azonlineexperimentation/models.go | 234 + .../azonlineexperimentation/models_serde.go | 506 + .../azonlineexperimentation/options.go | 82 + .../polymorphic_helpers.go | 40 + .../azonlineexperimentation/responses.go | 53 + .../azonlineexperimentation}/time_rfc3339.go | 2 +- .../azonlineexperimentation/tsp-location.yaml | 4 + .../eventgrid/aznamespaces/CHANGELOG.md | 71 + .../eventgrid/aznamespaces/README.md | 20 +- sdk/messaging/eventgrid/aznamespaces/build.go | 9 - sdk/messaging/eventgrid/aznamespaces/go.mod | 3 +- sdk/messaging/eventgrid/aznamespaces/go.sum | 2 + .../eventgrid/aznamespaces/models.go | 108 +- .../eventgrid/aznamespaces/models_serde.go | 165 +- .../eventgrid/aznamespaces/options.go | 28 +- .../eventgrid/aznamespaces/receiver_client.go | 99 +- .../aznamespaces/receiver_client_custom.go | 140 - .../eventgrid/aznamespaces/responses.go | 42 +- .../eventgrid/aznamespaces/sender_client.go | 44 +- .../aznamespaces/sender_client_custom.go | 96 - .../eventgrid/aznamespaces/time_rfc3339.go | 3 +- .../eventgrid/aznamespaces/tsp-location.yaml | 3 +- .../eventgrid/azsystemevents/CHANGELOG.md | 64 + .../eventgrid/azsystemevents/build.go | 12 - .../eventgrid/azsystemevents/constants.go | 27 + .../eventgrid/azsystemevents/models.go | 733 +- .../eventgrid/azsystemevents/models_serde.go | 1470 +- .../eventgrid/azsystemevents/time_rfc1123.go | 74 - .../eventgrid/azsystemevents/time_rfc3339.go | 3 +- .../azsystemevents/tsp-location.yaml | 3 +- .../armagricultureplatform/CHANGELOG.md | 8 + .../armagricultureplatform/LICENSE.txt | 21 + .../armagricultureplatform/README.md | 90 + .../agriservice_client.go | 520 + .../agriservice_client_example_test.go | 638 + .../armagricultureplatform/ci.yml | 27 + .../armagricultureplatform/client_factory.go | 48 + .../armagricultureplatform/constants.go | 171 + .../fake/agriservice_server.go | 413 + .../armagricultureplatform/fake/internal.go | 65 + .../fake/operations_server.go | 117 + .../fake/server_factory.go | 79 + .../armagricultureplatform/go.mod | 23 + .../armagricultureplatform/go.sum | 33 + .../armagricultureplatform/models.go | 347 + .../armagricultureplatform/models_serde.go | 886 ++ .../operations_client.go | 84 + .../operations_client_example_test.go | 56 + .../armagricultureplatform/options.go | 52 + .../armagricultureplatform/responses.go | 52 + .../armagricultureplatform}/time_rfc3339.go | 2 +- .../armagricultureplatform/tsp-location.yaml | 4 + .../armarizeaiobservabilityeval/CHANGELOG.md | 4 + .../armarizeaiobservabilityeval/constants.go | 2 +- .../fake/organizations_server.go | 12 +- .../armarizeaiobservabilityeval/models.go | 10 +- .../operations_client.go | 4 +- .../operations_client_example_test.go | 4 +- .../organizations_client.go | 28 +- .../organizations_client_example_test.go | 12 +- .../tsp-location.yaml | 4 +- .../armcarbonoptimization/CHANGELOG.md | 4 + .../carbonservice_client_example_test.go | 40 +- .../armcarbonoptimization/constants.go | 2 +- .../armcarbonoptimization/fake/date_type.go | 54 - .../armcarbonoptimization/models.go | 4 +- .../armcarbonoptimization/tsp-location.yaml | 4 +- .../chaos/armchaos/CHANGELOG.md | 45 + sdk/resourcemanager/chaos/armchaos/README.md | 2 +- .../chaos/armchaos/autorest.md | 13 - sdk/resourcemanager/chaos/armchaos/build.go | 7 - .../chaos/armchaos/capabilities_client.go | 75 +- .../capabilities_client_example_test.go | 191 +- .../chaos/armchaos/capabilities_live_test.go | 2 +- .../chaos/armchaos/capabilitytypes_client.go | 48 +- .../capabilitytypes_client_example_test.go | 152 +- .../armchaos/capabilitytypes_live_test.go | 2 +- .../chaos/armchaos/client_factory.go | 16 +- .../chaos/armchaos/constants.go | 114 +- .../armchaos/experimentexecutions_client.go | 245 + ...xperimentexecutions_client_example_test.go | 169 + .../chaos/armchaos/experiments_client.go | 326 +- .../experiments_client_example_test.go | 817 +- .../chaos/armchaos/experiments_live_test.go | 2 +- .../armchaos/fake/capabilities_server.go | 91 +- .../armchaos/fake/capabilitytypes_server.go | 81 +- .../fake/experimentexecutions_server.go | 220 + .../chaos/armchaos/fake/experiments_server.go | 298 +- .../chaos/armchaos/fake/internal.go | 11 +- .../chaos/armchaos/fake/operations_server.go | 95 +- .../armchaos/fake/operationstatuses_server.go | 69 +- .../chaos/armchaos/fake/server_factory.go | 58 +- .../chaos/armchaos/fake/targets_server.go | 85 +- .../chaos/armchaos/fake/targettypes_server.go | 81 +- .../chaos/armchaos/fake/time_rfc3339.go | 110 - sdk/resourcemanager/chaos/armchaos/go.mod | 2 +- .../chaos/armchaos/interfaces.go | 6 +- sdk/resourcemanager/chaos/armchaos/models.go | 318 +- .../chaos/armchaos/models_serde.go | 302 +- .../chaos/armchaos/operations_client.go | 42 +- .../operations_client_example_test.go | 55 + .../chaos/armchaos/operations_live_test.go | 2 +- .../armchaos/operationstatuses_client.go | 44 +- .../operationstatuses_client_example_test.go | 31 +- sdk/resourcemanager/chaos/armchaos/options.go | 54 +- .../chaos/armchaos/polymorphic_helpers.go | 12 +- .../chaos/armchaos/responses.go | 50 +- .../chaos/armchaos/targets_client.go | 73 +- .../armchaos/targets_client_example_test.go | 206 +- .../chaos/armchaos/targets_live_test.go | 2 +- .../chaos/armchaos/targettypes_client.go | 48 +- .../targettypes_client_example_test.go | 124 +- .../chaos/armchaos/targettypes_live_test.go | 2 +- .../chaos/armchaos/time_rfc3339.go | 9 +- .../chaos/armchaos/tsp-location.yaml | 4 + .../computefleet/armcomputefleet/CHANGELOG.md | 10 + .../computefleet/armcomputefleet/README.md | 2 +- .../computefleet/armcomputefleet/constants.go | 20 +- .../armcomputefleet/fake/fleets_server.go | 93 +- .../armcomputefleet/fake/internal.go | 5 + .../armcomputefleet/fake/operations_server.go | 45 +- .../fleets_client_example_test.go | 12 +- .../computefleet/armcomputefleet/go.mod | 2 +- .../computefleet/armcomputefleet/models.go | 61 +- .../operations_client_example_test.go | 2 +- .../armcomputefleet/tsp-location.yaml | 2 +- .../armcomputeschedule/CHANGELOG.md | 16 + .../armcomputeschedule/autorest.md | 13 - .../armcomputeschedule/build.go | 7 - .../armcomputeschedule/client_factory.go | 6 +- .../armcomputeschedule/constants.go | 20 +- .../armcomputeschedule/fake/internal.go | 11 +- .../fake/operations_server.go | 55 +- .../fake/scheduledactions_server.go | 261 +- .../armcomputeschedule/fake/server_factory.go | 11 +- .../armcomputeschedule/fake/time_rfc3339.go | 110 - .../armcomputeschedule/models.go | 131 +- .../armcomputeschedule/models_serde.go | 279 +- .../armcomputeschedule/operations_client.go | 12 +- .../operations_client_example_test.go | 75 +- .../armcomputeschedule/options.go | 30 +- .../armcomputeschedule/responses.go | 30 +- .../scheduledactions_client.go | 333 +- .../scheduledactions_client_example_test.go | 1416 +- .../armcomputeschedule/time_rfc3339.go | 9 +- .../armcomputeschedule/tsp-location.yaml | 4 + .../contoso/armcontoso/CHANGELOG.md | 8 + .../contoso/armcontoso/LICENSE.txt | 21 + .../contoso/armcontoso/README.md | 90 + sdk/resourcemanager/contoso/armcontoso/ci.yml | 27 + .../contoso/armcontoso/client_factory.go | 48 + .../contoso/armcontoso/constants.go | 104 + .../contoso/armcontoso/employees_client.go | 444 + .../employees_client_example_test.go | 302 + .../armcontoso/fake/employees_server.go | 361 + .../contoso/armcontoso/fake/internal.go | 65 + .../armcontoso/fake/operations_server.go | 117 + .../contoso/armcontoso/fake/server_factory.go | 79 + sdk/resourcemanager/contoso/armcontoso/go.mod | 23 + sdk/resourcemanager/contoso/armcontoso/go.sum | 33 + .../contoso/armcontoso/models.go | 127 + .../contoso/armcontoso/models_serde.go | 328 + .../contoso/armcontoso/operations_client.go | 84 + .../operations_client_example_test.go | 56 + .../contoso/armcontoso/options.go | 45 + .../contoso/armcontoso/responses.go | 46 + .../armcontoso}/time_rfc3339.go | 2 +- .../contoso/armcontoso/tsp-location.yaml | 4 + .../armdatabasefleetmanager/CHANGELOG.md | 8 + .../armdatabasefleetmanager/LICENSE.txt | 21 + .../armdatabasefleetmanager/README.md | 90 + .../armdatabasefleetmanager/ci.yml | 27 + .../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 + .../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 | 23 + .../armdatabasefleetmanager/go.sum | 33 + .../armdatabasefleetmanager/models.go | 453 + .../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 | 2 +- .../armdatabasefleetmanager/tsp-location.yaml | 4 + .../armdatabasewatcher/CHANGELOG.md | 4 + .../armdatabasewatcher/constants.go | 2 +- .../fake/alertruleresources_server.go | 8 +- .../fake/healthvalidations_server.go | 6 +- .../fake/sharedprivatelinkresources_server.go | 8 +- .../armdatabasewatcher/fake/targets_server.go | 8 +- .../fake/watchers_server.go | 16 +- .../healthvalidations_client_example_test.go | 1 + .../armdatabasewatcher/models.go | 4 +- ...rivatelinkresources_client_example_test.go | 3 + .../armdatabasewatcher/tsp-location.yaml | 4 +- .../watchers_client_example_test.go | 14 + .../armdependencymap/CHANGELOG.md | 4 + .../armdependencymap/constants.go | 2 +- .../fake/discoverysources_server.go | 10 +- .../armdependencymap/fake/maps_server.go | 20 +- .../dependencymap/armdependencymap/models.go | 4 +- .../armdependencymap/tsp-location.yaml | 4 +- .../armdeviceregistry/CHANGELOG.md | 4 + .../armdeviceregistry/constants.go | 2 +- .../fake/assetendpointprofiles_server.go | 12 +- .../armdeviceregistry/fake/assets_server.go | 12 +- .../fake/billingcontainers_server.go | 4 +- .../fake/operationstatus_server.go | 2 +- .../armdeviceregistry/fake/time_rfc3339.go | 109 - .../armdeviceregistry/models.go | 4 +- .../armdeviceregistry/tsp-location.yaml | 4 +- .../armdevopsinfrastructure/CHANGELOG.md | 16 + .../armdevopsinfrastructure/constants.go | 92 +- .../fake/imageversions_server.go | 2 +- .../fake/pools_server.go | 47 +- .../fake/resourcedetails_server.go | 2 +- .../fake/sku_server.go | 2 +- .../fake/subscriptionusages_server.go | 2 +- .../fake/time_rfc3339.go | 109 - .../imageversions_client.go | 4 +- .../imageversions_client_example_test.go | 2 +- .../armdevopsinfrastructure/models.go | 45 +- .../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 | 2 +- .../durabletask/armdurabletask/CHANGELOG.md | 4 + .../durabletask/armdurabletask/constants.go | 4 +- .../fake/retentionpolicies_server.go | 10 +- .../armdurabletask/fake/schedulers_server.go | 12 +- .../armdurabletask/fake/taskhubs_server.go | 8 +- .../armdurabletask/fake/time_rfc3339.go | 109 - .../durabletask/armdurabletask/models.go | 4 +- .../armdurabletask/tsp-location.yaml | 4 +- .../edgezones/armedgezones/CHANGELOG.md | 4 + .../edgezones/armedgezones/constants.go | 2 +- .../extendedzones_client_example_test.go | 199 + .../armedgezones/fake/extendedzones_server.go | 67 +- .../edgezones/armedgezones/fake/internal.go | 5 + .../armedgezones/fake/operations_server.go | 43 +- .../armedgezones/fake/time_rfc3339.go | 109 - .../edgezones/armedgezones/go.mod | 2 +- .../edgezones/armedgezones/models.go | 22 +- .../operations_client_example_test.go | 51 + .../edgezones/armedgezones/tsp-location.yaml | 6 +- .../fabric/armfabric/CHANGELOG.md | 9 + .../fabric/armfabric/capacities_client.go | 116 +- .../capacities_client_example_test.go | 62 +- .../fabric/armfabric/constants.go | 2 +- .../armfabric/fake/capacities_server.go | 172 +- .../fabric/armfabric/fake/internal.go | 5 + .../armfabric/fake/operations_server.go | 43 +- .../fabric/armfabric/fake/time_rfc3339.go | 109 - .../fabric/armfabric/models.go | 45 +- .../fabric/armfabric/models_serde.go | 101 + .../fabric/armfabric/operations_client.go | 4 +- .../operations_client_example_test.go | 2 +- .../fabric/armfabric/options.go | 5 + .../fabric/armfabric/responses.go | 6 + .../fabric/armfabric/tsp-location.yaml | 2 +- .../armhealthdataaiservices/CHANGELOG.md | 4 + .../armhealthdataaiservices/constants.go | 4 +- .../fake/deidservices_server.go | 12 +- .../fake/privateendpointconnections_server.go | 8 +- .../fake/privatelinks_server.go | 2 +- .../fake/time_rfc3339.go | 109 - .../armhealthdataaiservices/models.go | 16 +- .../armhealthdataaiservices/tsp-location.yaml | 2 +- .../armhybridconnectivity/CHANGELOG.md | 70 + .../armhybridconnectivity/README.md | 6 +- .../armhybridconnectivity/constants.go | 2 +- .../endpoints_client_example_test.go | 20 +- .../fake/endpoints_server.go | 18 +- .../fake/generateawstemplate_server.go | 6 +- .../fake/inventory_server.go | 6 +- .../fake/operations_server.go | 2 +- .../fake/publiccloudconnectors_server.go | 20 +- .../fake/serviceconfigurations_server.go | 12 +- .../fake/solutionconfigurations_server.go | 18 +- .../fake/solutiontypes_server.go | 8 +- .../fake/time_rfc3339.go | 109 - .../generateawstemplate_client.go | 2 +- ...generateawstemplate_client_example_test.go | 4 +- .../armhybridconnectivity/go.mod | 2 +- .../inventory_client_example_test.go | 2 +- .../armhybridconnectivity/models.go | 71 +- .../armhybridconnectivity/models_serde.go | 175 + .../operations_client_example_test.go | 2 +- .../publiccloudconnectors_client.go | 4 +- ...bliccloudconnectors_client_example_test.go | 8 +- .../armhybridconnectivity/responses.go | 3 +- ...rviceconfigurations_client_example_test.go | 8 +- .../solutionconfigurations_client.go | 4 +- ...utionconfigurations_client_example_test.go | 8 +- .../solutiontypes_client_example_test.go | 2 +- .../armhybridconnectivity/tsp-location.yaml | 4 +- .../armimpactreporting/CHANGELOG.md | 7 + .../armimpactreporting/constants.go | 2 +- .../fake/connectors_server.go | 10 +- .../fake/impactcategories_server.go | 4 +- .../fake/insights_server.go | 8 +- .../armimpactreporting/fake/time_rfc3339.go | 109 - .../fake/workloadimpacts_server.go | 8 +- .../armimpactreporting/models.go | 9 +- .../armimpactreporting/tsp-location.yaml | 4 +- .../workloadimpacts_client_example_test.go | 6 +- .../armiotoperations/CHANGELOG.md | 8 + .../armiotoperations/broker_client.go | 20 +- .../broker_client_example_test.go | 14 +- .../brokerauthentication_client.go | 20 +- ...rokerauthentication_client_example_test.go | 10 +- .../brokerauthorization_client.go | 20 +- ...brokerauthorization_client_example_test.go | 12 +- .../armiotoperations/brokerlistener_client.go | 20 +- .../brokerlistener_client_example_test.go | 12 +- .../armiotoperations/constants.go | 23 +- .../armiotoperations/dataflow_client.go | 20 +- .../dataflow_client_example_test.go | 18 +- .../dataflowendpoint_client.go | 20 +- .../dataflowendpoint_client_example_test.go | 220 +- .../dataflowprofile_client.go | 20 +- .../dataflowprofile_client_example_test.go | 12 +- .../armiotoperations/fake/broker_server.go | 8 +- .../fake/brokerauthentication_server.go | 8 +- .../fake/brokerauthorization_server.go | 8 +- .../fake/brokerlistener_server.go | 8 +- .../armiotoperations/fake/dataflow_server.go | 8 +- .../fake/dataflowendpoint_server.go | 8 +- .../fake/dataflowprofile_server.go | 8 +- .../armiotoperations/fake/instance_server.go | 12 +- .../armiotoperations/fake/time_rfc3339.go | 109 - .../armiotoperations/instance_client.go | 28 +- .../instance_client_example_test.go | 25 +- .../iotoperations/armiotoperations/models.go | 24 +- .../armiotoperations/models_serde.go | 35 + .../armiotoperations/operations_client.go | 4 +- .../operations_client_example_test.go | 2 +- .../armiotoperations/tsp-location.yaml | 2 +- .../mongocluster/armmongocluster/CHANGELOG.md | 9 + .../mongocluster/armmongocluster/constants.go | 22 +- .../fake/firewallrules_server.go | 69 +- .../armmongocluster/fake/internal.go | 5 + .../fake/mongoclusters_server.go | 109 +- .../armmongocluster/fake/operations_server.go | 43 +- .../fake/privateendpointconnections_server.go | 69 +- .../fake/privatelinks_server.go | 45 +- .../armmongocluster/fake/replicas_server.go | 45 +- .../armmongocluster/fake/time_rfc3339.go | 109 - .../armmongocluster/firewallrules_client.go | 20 +- .../firewallrules_client_example_test.go | 8 +- .../mongocluster/armmongocluster/models.go | 28 +- .../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 | 2 +- .../neonpostgres/armneonpostgres/CHANGELOG.md | 23 + .../neonpostgres/armneonpostgres/README.md | 2 +- .../armneonpostgres/branches_client.go | 90 - .../branches_client_example_test.go | 222 +- .../armneonpostgres/computes_client.go | 339 - .../computes_client_example_test.go | 216 +- .../neonpostgres/armneonpostgres/constants.go | 2 +- .../armneonpostgres/endpoints_client.go | 339 - .../endpoints_client_example_test.go | 211 +- .../armneonpostgres/fake/branches_server.go | 74 +- .../armneonpostgres/fake/computes_server.go | 251 +- .../armneonpostgres/fake/endpoints_server.go | 251 +- .../fake/neondatabases_server.go | 251 +- .../armneonpostgres/fake/neonroles_server.go | 251 +- .../armneonpostgres/fake/operations_server.go | 2 +- .../fake/organizations_server.go | 16 +- .../armneonpostgres/fake/projects_server.go | 72 +- .../armneonpostgres/fake/time_rfc3339.go | 109 - .../neonpostgres/armneonpostgres/go.mod | 2 +- .../neonpostgres/armneonpostgres/models.go | 4 +- .../armneonpostgres/neondatabases_client.go | 340 - .../neondatabases_client_example_test.go | 206 +- .../armneonpostgres/neonpostgres_live_test.go | 2 +- .../armneonpostgres/neonroles_client.go | 339 - .../neonroles_client_example_test.go | 221 +- .../operations_client_example_test.go | 8 +- .../neonpostgres/armneonpostgres/options.go | 103 - .../organizations_client_example_test.go | 289 +- .../armneonpostgres/projects_client.go | 85 - .../projects_client_example_test.go | 408 +- .../neonpostgres/armneonpostgres/responses.go | 104 - .../armneonpostgres/tsp-location.yaml | 4 +- .../armonlineexperimentation/CHANGELOG.md | 2 +- .../armonlineexperimentation/README.md | 10 +- .../armonlineexperimentation/models.go | 4 +- .../tsp-location.yaml | 4 +- .../armoracledatabase/CHANGELOG.md | 113 + .../armoracledatabase/README.md | 2 +- .../autonomousdatabasebackups_client.go | 87 +- ...mousdatabasebackups_client_example_test.go | 221 +- .../autonomousdatabasecharactersets_client.go | 20 +- ...tabasecharactersets_client_example_test.go | 87 - ...ousdatabasenationalcharactersets_client.go | 20 +- ...tionalcharactersets_client_example_test.go | 80 - .../autonomousdatabases_client.go | 194 +- ...autonomousdatabases_client_example_test.go | 867 +- .../autonomousdatabaseversions_client.go | 20 +- ...ousdatabaseversions_client_example_test.go | 80 - .../armoracledatabase/autorest.md | 13 - .../oracledatabase/armoracledatabase/build.go | 7 - .../armoracledatabase/client_factory.go | 46 +- .../cloudexadatainfrastructures_client.go | 70 +- ...datainfrastructures_client_example_test.go | 646 +- .../cloudvmclusters_client.go | 92 +- .../cloudvmclusters_client_example_test.go | 850 +- .../armoracledatabase/constants.go | 195 +- .../armoracledatabase/dbnodes_client.go | 60 +- .../dbnodes_client_example_test.go | 171 +- .../armoracledatabase/dbservers_client.go | 48 +- .../dbservers_client_example_test.go | 112 - .../dbsystemshapes_client.go | 21 +- .../dbsystemshapes_client_example_test.go | 120 +- .../dnsprivateviews_client.go | 20 +- .../dnsprivateviews_client_example_test.go | 105 - .../dnsprivatezones_client.go | 20 +- .../dnsprivatezones_client_example_test.go | 111 - .../exadbvmclusters_client.go | 538 + .../exadbvmclusters_client_example_test.go | 145 + .../exascaledbnodes_client.go | 260 + .../exascaledbnodes_client_example_test.go | 104 + .../exascaledbstoragevaults_client.go | 458 + ...caledbstoragevaults_client_example_test.go | 394 + .../fake/autonomousdatabasebackups_server.go | 143 +- .../autonomousdatabasecharactersets_server.go | 65 +- ...ousdatabasenationalcharactersets_server.go | 65 +- .../fake/autonomousdatabases_server.go | 213 +- .../fake/autonomousdatabaseversions_server.go | 65 +- .../cloudexadatainfrastructures_server.go | 103 +- .../fake/cloudvmclusters_server.go | 117 +- .../armoracledatabase/fake/dbnodes_server.go | 113 +- .../fake/dbservers_server.go | 103 +- .../fake/dbsystemshapes_server.go | 79 +- .../fake/dnsprivateviews_server.go | 65 +- .../fake/dnsprivatezones_server.go | 65 +- .../fake/exadbvmclusters_server.go | 430 + .../fake/exascaledbnodes_server.go | 237 + .../fake/exascaledbstoragevaults_server.go | 374 + .../fake/flexcomponents_server.go | 181 + .../fake/giminorversions_server.go | 195 + .../fake/giversions_server.go | 85 +- .../armoracledatabase/fake/internal.go | 19 +- .../fake/operations_server.go | 57 +- .../fake/oraclesubscriptions_server.go | 165 +- .../armoracledatabase/fake/server_factory.go | 116 +- .../fake/systemversions_server.go | 65 +- .../armoracledatabase/fake/time_rfc3339.go | 110 - .../fake/virtualnetworkaddresses_server.go | 129 +- .../flexcomponents_client.go | 167 + .../flexcomponents_client_example_test.go | 118 + .../giminorversions_client.go | 180 + .../giminorversions_client_example_test.go | 102 + .../armoracledatabase/giversions_client.go | 24 +- .../giversions_client_example_test.go | 90 +- .../oracledatabase/armoracledatabase/go.mod | 2 +- .../armoracledatabase/interfaces.go | 9 +- .../armoracledatabase/models.go | 3046 ++-- .../armoracledatabase/models_serde.go | 4969 +++++-- .../armoracledatabase/operations_client.go | 12 +- .../operations_client_example_test.go | 41 +- .../armoracledatabase/options.go | 226 +- .../oraclesubscriptions_client.go | 157 +- ...oraclesubscriptions_client_example_test.go | 242 +- .../armoracledatabase/polymorphic_helpers.go | 14 +- .../armoracledatabase/responses.go | 163 +- .../systemversions_client.go | 20 +- .../systemversions_client_example_test.go | 78 - .../armoracledatabase/time_rfc3339.go | 9 +- .../armoracledatabase/tsp-location.yaml | 5 + .../virtualnetworkaddresses_client.go | 71 +- ...ualnetworkaddresses_client_example_test.go | 159 - .../armpineconevectordb/CHANGELOG.md | 4 + .../armpineconevectordb/constants.go | 2 +- .../fake/organizations_server.go | 12 +- .../armpineconevectordb/fake/time_rfc3339.go | 109 - .../armpineconevectordb/models.go | 6 +- .../armpineconevectordb/tsp-location.yaml | 4 +- .../armservicenetworking/CHANGELOG.md | 4 + .../armservicenetworking/constants.go | 2 +- .../fake/associationsinterface_server.go | 10 +- .../fake/frontendsinterface_server.go | 10 +- .../fake/securitypoliciesinterface_server.go | 10 +- .../armservicenetworking/fake/time_rfc3339.go | 109 - .../fake/trafficcontrollerinterface_server.go | 12 +- .../armservicenetworking/models.go | 4 +- .../armservicenetworking/tsp-location.yaml | 4 +- .../standbypool/armstandbypool/CHANGELOG.md | 4 + .../standbypool/armstandbypool/constants.go | 2 +- ...bycontainergrouppoolruntimeviews_server.go | 4 +- .../fake/standbycontainergrouppools_server.go | 12 +- ...byvirtualmachinepoolruntimeviews_server.go | 4 +- .../fake/standbyvirtualmachinepools_server.go | 12 +- .../fake/standbyvirtualmachines_server.go | 4 +- .../armstandbypool/fake/time_rfc3339.go | 109 - .../standbypool/armstandbypool/models.go | 4 +- .../armstandbypool/tsp-location.yaml | 4 +- .../terraform/armterraform/CHANGELOG.md | 8 + .../terraform/armterraform/constants.go | 28 +- .../armterraform/fake/terraform_server.go | 2 +- .../armterraform/fake/time_rfc3339.go | 109 - .../terraform/armterraform/models.go | 21 +- .../terraform/armterraform/models_serde.go | 12 + .../terraform_client_example_test.go | 12 +- .../terraform/armterraform/tsp-location.yaml | 2 +- .../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 | 75 +- .../fake/codesigningaccounts_server.go | 91 +- .../armtrustedsigning/fake/internal.go | 5 + .../fake/operations_server.go | 43 +- .../armtrustedsigning/fake/time_rfc3339.go | 109 - .../armtrustedsigning/models.go | 56 +- .../armtrustedsigning/models_serde.go | 67 +- .../armtrustedsigning/operations_client.go | 4 +- .../operations_client_example_test.go | 2 +- .../armtrustedsigning/tsp-location.yaml | 2 +- .../armweightsandbiases/CHANGELOG.md | 4 + .../armweightsandbiases/constants.go | 2 +- .../fake/instances_server.go | 12 +- .../armweightsandbiases/fake/time_rfc3339.go | 109 - .../armweightsandbiases/instances_client.go | 28 +- .../instances_client_example_test.go | 16 +- .../armweightsandbiases/models.go | 10 +- .../armweightsandbiases/operations_client.go | 4 +- .../operations_client_example_test.go | 4 +- .../armweightsandbiases/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 | 193 +- ...go => sapcentralserverinstances_server.go} | 243 +- .../fake/sapdatabaseinstances_server.go | 193 +- .../fake/sapvirtualinstances_server.go | 267 +- .../fake/server_factory.go | 38 +- .../fake/time_rfc3339.go | 110 - .../fake/workloads_server.go | 242 - .../interfaces.go | 6 +- .../armworkloadssapvirtualinstance/models.go | 355 +- .../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 | 12162 +++++++++------- .../time_rfc3339.go | 9 +- .../tsp-location.yaml | 4 + .../workloads_client.go | 309 - .../workloads_client_example_test.go | 1194 -- .../keyvault/azcertificates/CHANGELOG.md | 26 + sdk/security/keyvault/azcertificates/build.go | 8 - .../keyvault/azcertificates/client.go | 29 +- .../keyvault/azcertificates/constants.go | 55 +- .../keyvault/azcertificates/models.go | 37 +- .../keyvault/azcertificates/models_serde.go | 38 +- .../keyvault/azcertificates/options.go | 12 +- .../keyvault/azcertificates/time_unix.go | 3 +- .../keyvault/azcertificates/tsp-location.yaml | 5 +- sdk/security/keyvault/azkeys/CHANGELOG.md | 20 + sdk/security/keyvault/azkeys/build.go | 8 - sdk/security/keyvault/azkeys/client.go | 47 +- sdk/security/keyvault/azkeys/constants.go | 68 +- sdk/security/keyvault/azkeys/models.go | 36 +- sdk/security/keyvault/azkeys/models_serde.go | 3 +- sdk/security/keyvault/azkeys/options.go | 9 +- sdk/security/keyvault/azkeys/responses.go | 4 +- sdk/security/keyvault/azkeys/time_unix.go | 3 +- .../keyvault/azkeys/tsp-location.yaml | 4 +- sdk/security/keyvault/azsecrets/CHANGELOG.md | 19 + sdk/security/keyvault/azsecrets/build.go | 9 - sdk/security/keyvault/azsecrets/client.go | 23 +- sdk/security/keyvault/azsecrets/constants.go | 58 + sdk/security/keyvault/azsecrets/models.go | 14 +- .../keyvault/azsecrets/models_serde.go | 3 +- sdk/security/keyvault/azsecrets/options.go | 9 +- sdk/security/keyvault/azsecrets/time_unix.go | 3 +- .../keyvault/azsecrets/tsp-location.yaml | 4 +- 645 files changed, 53027 insertions(+), 28560 deletions(-) create mode 100644 sdk/analytics/azonlineexperimentation/CHANGELOG.md create mode 100644 sdk/analytics/azonlineexperimentation/LICENSE.txt create mode 100644 sdk/analytics/azonlineexperimentation/README.md create mode 100644 sdk/analytics/azonlineexperimentation/ci.yml create mode 100644 sdk/analytics/azonlineexperimentation/client.go create mode 100644 sdk/analytics/azonlineexperimentation/constants.go create mode 100644 sdk/analytics/azonlineexperimentation/fake/internal.go create mode 100644 sdk/analytics/azonlineexperimentation/fake/server.go create mode 100644 sdk/analytics/azonlineexperimentation/go.mod create mode 100644 sdk/analytics/azonlineexperimentation/go.sum create mode 100644 sdk/analytics/azonlineexperimentation/interfaces.go create mode 100644 sdk/analytics/azonlineexperimentation/models.go create mode 100644 sdk/analytics/azonlineexperimentation/models_serde.go create mode 100644 sdk/analytics/azonlineexperimentation/options.go create mode 100644 sdk/analytics/azonlineexperimentation/polymorphic_helpers.go create mode 100644 sdk/analytics/azonlineexperimentation/responses.go rename sdk/{resourcemanager/computefleet/armcomputefleet/fake => analytics/azonlineexperimentation}/time_rfc3339.go (98%) create mode 100644 sdk/analytics/azonlineexperimentation/tsp-location.yaml delete mode 100644 sdk/messaging/eventgrid/aznamespaces/build.go delete mode 100644 sdk/messaging/eventgrid/aznamespaces/receiver_client_custom.go delete mode 100644 sdk/messaging/eventgrid/aznamespaces/sender_client_custom.go delete mode 100644 sdk/messaging/eventgrid/azsystemevents/build.go delete mode 100644 sdk/messaging/eventgrid/azsystemevents/time_rfc1123.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/CHANGELOG.md create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/LICENSE.txt create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/README.md create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/agriservice_client.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/agriservice_client_example_test.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/ci.yml create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/client_factory.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/constants.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/fake/agriservice_server.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/fake/internal.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/fake/operations_server.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/fake/server_factory.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/go.mod create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/go.sum create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/models.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/models_serde.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/operations_client.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/operations_client_example_test.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/options.go create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/responses.go rename sdk/resourcemanager/{arizeaiobservabilityeval/armarizeaiobservabilityeval/fake => agricultureplatform/armagricultureplatform}/time_rfc3339.go (98%) create mode 100644 sdk/resourcemanager/agricultureplatform/armagricultureplatform/tsp-location.yaml delete mode 100644 sdk/resourcemanager/carbonoptimization/armcarbonoptimization/fake/date_type.go delete mode 100644 sdk/resourcemanager/chaos/armchaos/autorest.md delete mode 100644 sdk/resourcemanager/chaos/armchaos/build.go create mode 100644 sdk/resourcemanager/chaos/armchaos/experimentexecutions_client.go create mode 100644 sdk/resourcemanager/chaos/armchaos/experimentexecutions_client_example_test.go create mode 100644 sdk/resourcemanager/chaos/armchaos/fake/experimentexecutions_server.go delete mode 100644 sdk/resourcemanager/chaos/armchaos/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/chaos/armchaos/operations_client_example_test.go create mode 100644 sdk/resourcemanager/chaos/armchaos/tsp-location.yaml delete mode 100644 sdk/resourcemanager/computeschedule/armcomputeschedule/autorest.md delete mode 100644 sdk/resourcemanager/computeschedule/armcomputeschedule/build.go delete mode 100644 sdk/resourcemanager/computeschedule/armcomputeschedule/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/computeschedule/armcomputeschedule/tsp-location.yaml create mode 100644 sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md create mode 100644 sdk/resourcemanager/contoso/armcontoso/LICENSE.txt create mode 100644 sdk/resourcemanager/contoso/armcontoso/README.md create mode 100644 sdk/resourcemanager/contoso/armcontoso/ci.yml create mode 100644 sdk/resourcemanager/contoso/armcontoso/client_factory.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/constants.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/employees_client.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/fake/internal.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/fake/operations_server.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/fake/server_factory.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/go.mod create mode 100644 sdk/resourcemanager/contoso/armcontoso/go.sum create mode 100644 sdk/resourcemanager/contoso/armcontoso/models.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/models_serde.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/operations_client.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/operations_client_example_test.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/options.go create mode 100644 sdk/resourcemanager/contoso/armcontoso/responses.go rename sdk/resourcemanager/{databasewatcher/armdatabasewatcher/fake => contoso/armcontoso}/time_rfc3339.go (99%) create mode 100644 sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml 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/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 rename sdk/resourcemanager/{dependencymap/armdependencymap/fake => databasefleetmanager/armdatabasefleetmanager}/time_rfc3339.go (98%) create mode 100644 sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/tsp-location.yaml delete mode 100644 sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/durabletask/armdurabletask/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go delete mode 100644 sdk/resourcemanager/edgezones/armedgezones/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go delete mode 100644 sdk/resourcemanager/fabric/armfabric/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/impactreporting/armimpactreporting/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/iotoperations/armiotoperations/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/mongocluster/armmongocluster/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client_example_test.go delete mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client_example_test.go delete mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client_example_test.go delete mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/autorest.md delete mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/build.go delete mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client_example_test.go delete mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client_example_test.go delete mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client_example_test.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/exadbvmclusters_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/exadbvmclusters_client_example_test.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbnodes_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbnodes_client_example_test.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbstoragevaults_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbstoragevaults_client_example_test.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/exadbvmclusters_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/exascaledbnodes_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/exascaledbstoragevaults_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/flexcomponents_server.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/giminorversions_server.go delete mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/flexcomponents_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/flexcomponents_client_example_test.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/giminorversions_client.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/giminorversions_client_example_test.go delete mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client_example_test.go create mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/tsp-location.yaml delete mode 100644 sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client_example_test.go delete mode 100644 sdk/resourcemanager/pineconevectordb/armpineconevectordb/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/servicenetworking/armservicenetworking/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/standbypool/armstandbypool/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/terraform/armterraform/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/time_rfc3339.go delete mode 100644 sdk/resourcemanager/weightsandbiases/armweightsandbiases/fake/time_rfc3339.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} (59%) delete mode 100644 sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/time_rfc3339.go 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 delete mode 100644 sdk/security/keyvault/azcertificates/build.go delete mode 100644 sdk/security/keyvault/azkeys/build.go delete mode 100644 sdk/security/keyvault/azsecrets/build.go create mode 100644 sdk/security/keyvault/azsecrets/constants.go diff --git a/sdk/analytics/azonlineexperimentation/CHANGELOG.md b/sdk/analytics/azonlineexperimentation/CHANGELOG.md new file mode 100644 index 000000000000..28b28f0de78a --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2025-05-13) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/analytics/azonlineexperimentation` 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/analytics/azonlineexperimentation/LICENSE.txt b/sdk/analytics/azonlineexperimentation/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/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/analytics/azonlineexperimentation/README.md b/sdk/analytics/azonlineexperimentation/README.md new file mode 100644 index 000000000000..5e7f07376029 --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/README.md @@ -0,0 +1,90 @@ +# Azure Analytics Module for Go + +The `azonlineexperimentation` module provides operations for working with Azure Analytics. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/analytics/azonlineexperimentation) + +# 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 Analytics module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/analytics/azonlineexperimentation +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Analytics. 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 Analytics 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 := azonlineexperimentation.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 := azonlineexperimentation.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Analytics` 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/analytics/azonlineexperimentation/ci.yml b/sdk/analytics/azonlineexperimentation/ci.yml new file mode 100644 index 000000000000..55ddc4b6adeb --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/ci.yml @@ -0,0 +1,27 @@ +# 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/analytics/azonlineexperimentation/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/analytics/azonlineexperimentation/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'analytics/azonlineexperimentation' diff --git a/sdk/analytics/azonlineexperimentation/client.go b/sdk/analytics/azonlineexperimentation/client.go new file mode 100644 index 000000000000..0f235ebbfe62 --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/client.go @@ -0,0 +1,391 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package azonlineexperimentation + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "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" + "time" +) + +// Client contains the methods for the group. +// Don't use this type directly, use a constructor function instead. +type Client struct { + internal *azcore.Client + endpoint string +} + +// CreateOrUpdateMetric - Creates or updates an experiment metric. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-05-31-preview +// - experimentMetricID - Identifier for this experiment metric. Must start with a lowercase letter and contain only lowercase +// letters, numbers, and underscores. +// - resource - The resource instance. +// - options - CreateOrUpdateMetricOptions contains the optional parameters for the Client.CreateOrUpdateMetric method. +func (client *Client) CreateOrUpdateMetric(ctx context.Context, experimentMetricID string, resource ExperimentMetric, options *CreateOrUpdateMetricOptions) (CreateOrUpdateMetricResponse, error) { + var err error + const operationName = "Client.CreateOrUpdateMetric" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateMetricCreateRequest(ctx, experimentMetricID, resource, options) + if err != nil { + return CreateOrUpdateMetricResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CreateOrUpdateMetricResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return CreateOrUpdateMetricResponse{}, err + } + resp, err := client.createOrUpdateMetricHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateMetricCreateRequest creates the CreateOrUpdateMetric request. +func (client *Client) createOrUpdateMetricCreateRequest(ctx context.Context, experimentMetricID string, resource ExperimentMetric, options *CreateOrUpdateMetricOptions) (*policy.Request, error) { + host := "{endpoint}" + host = strings.ReplaceAll(host, "{endpoint}", client.endpoint) + urlPath := "/experiment-metrics/{experimentMetricId}" + if experimentMetricID == "" { + return nil, errors.New("parameter experimentMetricID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{experimentMetricId}", url.PathEscape(experimentMetricID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-05-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + if options != nil && options.IfModifiedSince != nil { + req.Raw().Header["If-Modified-Since"] = []string{options.IfModifiedSince.Format(time.RFC1123)} + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} + } + if options != nil && options.IfUnmodifiedSince != nil { + req.Raw().Header["If-Unmodified-Since"] = []string{options.IfUnmodifiedSince.Format(time.RFC1123)} + } + if options != nil && options.ClientRequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.ClientRequestID} + } + req.Raw().Header["Content-Type"] = []string{"application/merge-patch+json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateMetricHandleResponse handles the CreateOrUpdateMetric response. +func (client *Client) createOrUpdateMetricHandleResponse(resp *http.Response) (CreateOrUpdateMetricResponse, error) { + result := CreateOrUpdateMetricResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.XMSClientRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentMetric); err != nil { + return CreateOrUpdateMetricResponse{}, err + } + return result, nil +} + +// DeleteMetric - Deletes an experiment metric. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-05-31-preview +// - experimentMetricID - Identifier for this experiment metric. Must start with a lowercase letter and contain only lowercase +// letters, numbers, and underscores. +// - options - DeleteMetricOptions contains the optional parameters for the Client.DeleteMetric method. +func (client *Client) DeleteMetric(ctx context.Context, experimentMetricID string, options *DeleteMetricOptions) (DeleteMetricResponse, error) { + var err error + const operationName = "Client.DeleteMetric" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteMetricCreateRequest(ctx, experimentMetricID, options) + if err != nil { + return DeleteMetricResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DeleteMetricResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return DeleteMetricResponse{}, err + } + resp, err := client.deleteMetricHandleResponse(httpResp) + return resp, err +} + +// deleteMetricCreateRequest creates the DeleteMetric request. +func (client *Client) deleteMetricCreateRequest(ctx context.Context, experimentMetricID string, options *DeleteMetricOptions) (*policy.Request, error) { + host := "{endpoint}" + host = strings.ReplaceAll(host, "{endpoint}", client.endpoint) + urlPath := "/experiment-metrics/{experimentMetricId}" + if experimentMetricID == "" { + return nil, errors.New("parameter experimentMetricID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{experimentMetricId}", url.PathEscape(experimentMetricID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-05-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + if options != nil && options.IfModifiedSince != nil { + req.Raw().Header["If-Modified-Since"] = []string{options.IfModifiedSince.Format(time.RFC1123)} + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} + } + if options != nil && options.IfUnmodifiedSince != nil { + req.Raw().Header["If-Unmodified-Since"] = []string{options.IfUnmodifiedSince.Format(time.RFC1123)} + } + if options != nil && options.ClientRequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.ClientRequestID} + } + return req, nil +} + +// deleteMetricHandleResponse handles the DeleteMetric response. +func (client *Client) deleteMetricHandleResponse(resp *http.Response) (DeleteMetricResponse, error) { + result := DeleteMetricResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.XMSClientRequestID = &val + } + return result, nil +} + +// GetMetric - Fetches an experiment metric by ID. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-05-31-preview +// - experimentMetricID - Identifier for this experiment metric. Must start with a lowercase letter and contain only lowercase +// letters, numbers, and underscores. +// - options - GetMetricOptions contains the optional parameters for the Client.GetMetric method. +func (client *Client) GetMetric(ctx context.Context, experimentMetricID string, options *GetMetricOptions) (GetMetricResponse, error) { + var err error + const operationName = "Client.GetMetric" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getMetricCreateRequest(ctx, experimentMetricID, options) + if err != nil { + return GetMetricResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GetMetricResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GetMetricResponse{}, err + } + resp, err := client.getMetricHandleResponse(httpResp) + return resp, err +} + +// getMetricCreateRequest creates the GetMetric request. +func (client *Client) getMetricCreateRequest(ctx context.Context, experimentMetricID string, options *GetMetricOptions) (*policy.Request, error) { + host := "{endpoint}" + host = strings.ReplaceAll(host, "{endpoint}", client.endpoint) + urlPath := "/experiment-metrics/{experimentMetricId}" + if experimentMetricID == "" { + return nil, errors.New("parameter experimentMetricID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{experimentMetricId}", url.PathEscape(experimentMetricID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-05-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.IfMatch != nil { + req.Raw().Header["If-Match"] = []string{*options.IfMatch} + } + if options != nil && options.IfModifiedSince != nil { + req.Raw().Header["If-Modified-Since"] = []string{options.IfModifiedSince.Format(time.RFC1123)} + } + if options != nil && options.IfNoneMatch != nil { + req.Raw().Header["If-None-Match"] = []string{*options.IfNoneMatch} + } + if options != nil && options.IfUnmodifiedSince != nil { + req.Raw().Header["If-Unmodified-Since"] = []string{options.IfUnmodifiedSince.Format(time.RFC1123)} + } + if options != nil && options.ClientRequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.ClientRequestID} + } + return req, nil +} + +// getMetricHandleResponse handles the GetMetric response. +func (client *Client) getMetricHandleResponse(resp *http.Response) (GetMetricResponse, error) { + result := GetMetricResponse{} + if val := resp.Header.Get("ETag"); val != "" { + result.ETag = &val + } + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.XMSClientRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentMetric); err != nil { + return GetMetricResponse{}, err + } + return result, nil +} + +// NewListMetricsPager - Lists experiment metrics. +// +// Generated from API version 2025-05-31-preview +// - options - ListMetricsOptions contains the optional parameters for the Client.NewListMetricsPager method. +func (client *Client) NewListMetricsPager(options *ListMetricsOptions) *runtime.Pager[ListMetricsResponse] { + return runtime.NewPager(runtime.PagingHandler[ListMetricsResponse]{ + More: func(page ListMetricsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ListMetricsResponse) (ListMetricsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "Client.NewListMetricsPager") + 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.listMetricsCreateRequest(ctx, options) + }, nil) + if err != nil { + return ListMetricsResponse{}, err + } + return client.listMetricsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listMetricsCreateRequest creates the ListMetrics request. +func (client *Client) listMetricsCreateRequest(ctx context.Context, options *ListMetricsOptions) (*policy.Request, error) { + host := "{endpoint}" + host = strings.ReplaceAll(host, "{endpoint}", client.endpoint) + urlPath := "/experiment-metrics" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-05-31-preview") + if options != nil && options.Maxpagesize != nil { + reqQP.Set("maxpagesize", strconv.FormatInt(int64(*options.Maxpagesize), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.Top != nil { + reqQP.Set("top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.ClientRequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.ClientRequestID} + } + return req, nil +} + +// listMetricsHandleResponse handles the ListMetrics response. +func (client *Client) listMetricsHandleResponse(resp *http.Response) (ListMetricsResponse, error) { + result := ListMetricsResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.XMSClientRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.PagedExperimentMetric); err != nil { + return ListMetricsResponse{}, err + } + return result, nil +} + +// ValidateMetric - Validates an experiment metric definition. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-05-31-preview +// - body - Experiment metric input to validate +// - options - ValidateMetricOptions contains the optional parameters for the Client.ValidateMetric method. +func (client *Client) ValidateMetric(ctx context.Context, body ExperimentMetric, options *ValidateMetricOptions) (ValidateMetricResponse, error) { + var err error + const operationName = "Client.ValidateMetric" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.validateMetricCreateRequest(ctx, body, options) + if err != nil { + return ValidateMetricResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ValidateMetricResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ValidateMetricResponse{}, err + } + resp, err := client.validateMetricHandleResponse(httpResp) + return resp, err +} + +// validateMetricCreateRequest creates the ValidateMetric request. +func (client *Client) validateMetricCreateRequest(ctx context.Context, body ExperimentMetric, options *ValidateMetricOptions) (*policy.Request, error) { + host := "{endpoint}" + host = strings.ReplaceAll(host, "{endpoint}", client.endpoint) + urlPath := "/experiment-metrics:validate" + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-05-31-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.ClientRequestID != nil { + req.Raw().Header["x-ms-client-request-id"] = []string{*options.ClientRequestID} + } + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// validateMetricHandleResponse handles the ValidateMetric response. +func (client *Client) validateMetricHandleResponse(resp *http.Response) (ValidateMetricResponse, error) { + result := ValidateMetricResponse{} + if val := resp.Header.Get("x-ms-client-request-id"); val != "" { + result.XMSClientRequestID = &val + } + if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentMetricValidationResult); err != nil { + return ValidateMetricResponse{}, err + } + return result, nil +} diff --git a/sdk/analytics/azonlineexperimentation/constants.go b/sdk/analytics/azonlineexperimentation/constants.go new file mode 100644 index 000000000000..4f020c4960bb --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/constants.go @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package azonlineexperimentation + +// DesiredDirection - Desired direction for an experiment metric value. +type DesiredDirection string + +const ( + // DesiredDirectionDecrease - A decrease to the metric value is desired. E.g., Error rate, Latency. + DesiredDirectionDecrease DesiredDirection = "Decrease" + // DesiredDirectionIncrease - An increase to the metric value is desired. E.g., Success rate, Total revenue. + DesiredDirectionIncrease DesiredDirection = "Increase" + // DesiredDirectionNeutral - Neither an increase nor a decrease to the metric value is desired, or the desired direction depends + // on other factors. E.g., Number of video play attempts, Number of user feedbacks + DesiredDirectionNeutral DesiredDirection = "Neutral" +) + +// PossibleDesiredDirectionValues returns the possible values for the DesiredDirection const type. +func PossibleDesiredDirectionValues() []DesiredDirection { + return []DesiredDirection{ + DesiredDirectionDecrease, + DesiredDirectionIncrease, + DesiredDirectionNeutral, + } +} + +// DiagnosticCode - The diagnostic error codes. +type DiagnosticCode string + +const ( + // DiagnosticCodeFailedSchemaValidation - The metric definition does not conform to the required schema. + DiagnosticCodeFailedSchemaValidation DiagnosticCode = "FailedSchemaValidation" + // DiagnosticCodeInvalidEventCondition - The filter condition is invalid. + DiagnosticCodeInvalidEventCondition DiagnosticCode = "InvalidEventCondition" + // DiagnosticCodeInvalidExperimentMetricDefinition - The provided metric definition is invalid. + // For example, defining a metric to calculate the average of a numeric property but + // including a filter condition that compares it to a string value creates a type mismatch. + DiagnosticCodeInvalidExperimentMetricDefinition DiagnosticCode = "InvalidExperimentMetricDefinition" + // DiagnosticCodeUnsupportedEventCondition - The filter condition is valid but not currently supported. + DiagnosticCodeUnsupportedEventCondition DiagnosticCode = "UnsupportedEventCondition" +) + +// PossibleDiagnosticCodeValues returns the possible values for the DiagnosticCode const type. +func PossibleDiagnosticCodeValues() []DiagnosticCode { + return []DiagnosticCode{ + DiagnosticCodeFailedSchemaValidation, + DiagnosticCodeInvalidEventCondition, + DiagnosticCodeInvalidExperimentMetricDefinition, + DiagnosticCodeUnsupportedEventCondition, + } +} + +// ExperimentMetricType - How the metric definition calculates metric values from event data. +type ExperimentMetricType string + +const ( + // ExperimentMetricTypeAverage - Calculates the average value of a specified event property. + ExperimentMetricTypeAverage ExperimentMetricType = "Average" + // ExperimentMetricTypeEventCount - Counts the occurrences of an event. Experiment analysis accounts for unequal traffic allocation. + ExperimentMetricTypeEventCount ExperimentMetricType = "EventCount" + // ExperimentMetricTypeEventRate - Calculates the percentage of events that satisfy a specified condition. + ExperimentMetricTypeEventRate ExperimentMetricType = "EventRate" + // ExperimentMetricTypePercentile - Calculates a specified percentile of an event property. + ExperimentMetricTypePercentile ExperimentMetricType = "Percentile" + // ExperimentMetricTypeSum - Calculates the sum of a specified event property. Experiment analysis accounts for unequal traffic + // allocation. + ExperimentMetricTypeSum ExperimentMetricType = "Sum" + // ExperimentMetricTypeUserCount - Counts the number of unique users who encounter an event. Experiment analysis accounts + // for unequal traffic allocation. + ExperimentMetricTypeUserCount ExperimentMetricType = "UserCount" + // ExperimentMetricTypeUserRate - Calculates the percentage of users who encounter a start event and subsequently encounter + // an end event. Users must encounter the start event before the end event to be counted. + ExperimentMetricTypeUserRate ExperimentMetricType = "UserRate" +) + +// PossibleExperimentMetricTypeValues returns the possible values for the ExperimentMetricType const type. +func PossibleExperimentMetricTypeValues() []ExperimentMetricType { + return []ExperimentMetricType{ + ExperimentMetricTypeAverage, + ExperimentMetricTypeEventCount, + ExperimentMetricTypeEventRate, + ExperimentMetricTypePercentile, + ExperimentMetricTypeSum, + ExperimentMetricTypeUserCount, + ExperimentMetricTypeUserRate, + } +} + +// LifecycleStage - Lifecycle stages of an experiment metric, determining whether the metric is included in experiment analysis. +type LifecycleStage string + +const ( + // LifecycleStageActive - The metric is included in experiment analysis. + LifecycleStageActive LifecycleStage = "Active" + // LifecycleStageInactive - The metric is excluded from experiment analysis but remains available for future use. + LifecycleStageInactive LifecycleStage = "Inactive" +) + +// PossibleLifecycleStageValues returns the possible values for the LifecycleStage const type. +func PossibleLifecycleStageValues() []LifecycleStage { + return []LifecycleStage{ + LifecycleStageActive, + LifecycleStageInactive, + } +} diff --git a/sdk/analytics/azonlineexperimentation/fake/internal.go b/sdk/analytics/azonlineexperimentation/fake/internal.go new file mode 100644 index 000000000000..d46bc9665f2e --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/fake/internal.go @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the 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 getHeaderValue(h http.Header, k string) string { + v := h[k] + if len(v) == 0 { + return "" + } + return v[0] +} + +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/analytics/azonlineexperimentation/fake/server.go b/sdk/analytics/azonlineexperimentation/fake/server.go new file mode 100644 index 000000000000..7844310fe71a --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/fake/server.go @@ -0,0 +1,401 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the 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" + "github.com/Azure/azure-sdk-for-go/sdk/analytics/azonlineexperimentation" + 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" + "net/http" + "net/url" + "regexp" + "strconv" + "time" +) + +// Server is a fake server for instances of the azonlineexperimentation.Client type. +type Server struct { + // CreateOrUpdateMetric is the fake for method Client.CreateOrUpdateMetric + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdateMetric func(ctx context.Context, experimentMetricID string, resource azonlineexperimentation.ExperimentMetric, options *azonlineexperimentation.CreateOrUpdateMetricOptions) (resp azfake.Responder[azonlineexperimentation.CreateOrUpdateMetricResponse], errResp azfake.ErrorResponder) + + // DeleteMetric is the fake for method Client.DeleteMetric + // HTTP status codes to indicate success: http.StatusNoContent + DeleteMetric func(ctx context.Context, experimentMetricID string, options *azonlineexperimentation.DeleteMetricOptions) (resp azfake.Responder[azonlineexperimentation.DeleteMetricResponse], errResp azfake.ErrorResponder) + + // GetMetric is the fake for method Client.GetMetric + // HTTP status codes to indicate success: http.StatusOK + GetMetric func(ctx context.Context, experimentMetricID string, options *azonlineexperimentation.GetMetricOptions) (resp azfake.Responder[azonlineexperimentation.GetMetricResponse], errResp azfake.ErrorResponder) + + // NewListMetricsPager is the fake for method Client.NewListMetricsPager + // HTTP status codes to indicate success: http.StatusOK + NewListMetricsPager func(options *azonlineexperimentation.ListMetricsOptions) (resp azfake.PagerResponder[azonlineexperimentation.ListMetricsResponse]) + + // ValidateMetric is the fake for method Client.ValidateMetric + // HTTP status codes to indicate success: http.StatusOK + ValidateMetric func(ctx context.Context, body azonlineexperimentation.ExperimentMetric, options *azonlineexperimentation.ValidateMetricOptions) (resp azfake.Responder[azonlineexperimentation.ValidateMetricResponse], errResp azfake.ErrorResponder) +} + +// NewServerTransport creates a new instance of ServerTransport with the provided implementation. +// The returned ServerTransport instance is connected to an instance of azonlineexperimentation.Client via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerTransport(srv *Server) *ServerTransport { + return &ServerTransport{ + srv: srv, + newListMetricsPager: newTracker[azfake.PagerResponder[azonlineexperimentation.ListMetricsResponse]](), + } +} + +// ServerTransport connects instances of azonlineexperimentation.Client to instances of Server. +// Don't use this type directly, use NewServerTransport instead. +type ServerTransport struct { + srv *Server + newListMetricsPager *tracker[azfake.PagerResponder[azonlineexperimentation.ListMetricsResponse]] +} + +// Do implements the policy.Transporter interface for ServerTransport. +func (s *ServerTransport) 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 *ServerTransport) 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 serverTransportInterceptor != nil { + res.resp, res.err, intercepted = serverTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "Client.CreateOrUpdateMetric": + res.resp, res.err = s.dispatchCreateOrUpdateMetric(req) + case "Client.DeleteMetric": + res.resp, res.err = s.dispatchDeleteMetric(req) + case "Client.GetMetric": + res.resp, res.err = s.dispatchGetMetric(req) + case "Client.NewListMetricsPager": + res.resp, res.err = s.dispatchNewListMetricsPager(req) + case "Client.ValidateMetric": + res.resp, res.err = s.dispatchValidateMetric(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 *ServerTransport) dispatchCreateOrUpdateMetric(req *http.Request) (*http.Response, error) { + if s.srv.CreateOrUpdateMetric == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdateMetric not implemented")} + } + const regexStr = `/experiment-metrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[azonlineexperimentation.ExperimentMetric](req) + if err != nil { + return nil, err + } + experimentMetricIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("experimentMetricId")]) + if err != nil { + return nil, err + } + ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) + ifNoneMatchParam := getOptional(getHeaderValue(req.Header, "If-None-Match")) + ifUnmodifiedSinceParam, err := parseOptional(getHeaderValue(req.Header, "If-Unmodified-Since"), func(v string) (time.Time, error) { return time.Parse(time.RFC1123, v) }) + if err != nil { + return nil, err + } + ifModifiedSinceParam, err := parseOptional(getHeaderValue(req.Header, "If-Modified-Since"), func(v string) (time.Time, error) { return time.Parse(time.RFC1123, v) }) + if err != nil { + return nil, err + } + clientRequestIDParam := getOptional(getHeaderValue(req.Header, "x-ms-client-request-id")) + var options *azonlineexperimentation.CreateOrUpdateMetricOptions + if ifMatchParam != nil || ifNoneMatchParam != nil || ifUnmodifiedSinceParam != nil || ifModifiedSinceParam != nil || clientRequestIDParam != nil { + options = &azonlineexperimentation.CreateOrUpdateMetricOptions{ + IfMatch: ifMatchParam, + IfNoneMatch: ifNoneMatchParam, + IfUnmodifiedSince: ifUnmodifiedSinceParam, + IfModifiedSince: ifModifiedSinceParam, + ClientRequestID: clientRequestIDParam, + } + } + respr, errRespr := s.srv.CreateOrUpdateMetric(req.Context(), experimentMetricIDParam, body, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ExperimentMetric, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).ETag; val != nil { + resp.Header.Set("ETag", *val) + } + if val := server.GetResponse(respr).XMSClientRequestID; val != nil { + resp.Header.Set("x-ms-client-request-id", *val) + } + return resp, nil +} + +func (s *ServerTransport) dispatchDeleteMetric(req *http.Request) (*http.Response, error) { + if s.srv.DeleteMetric == nil { + return nil, &nonRetriableError{errors.New("fake for method DeleteMetric not implemented")} + } + const regexStr = `/experiment-metrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + experimentMetricIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("experimentMetricId")]) + if err != nil { + return nil, err + } + ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) + ifNoneMatchParam := getOptional(getHeaderValue(req.Header, "If-None-Match")) + ifUnmodifiedSinceParam, err := parseOptional(getHeaderValue(req.Header, "If-Unmodified-Since"), func(v string) (time.Time, error) { return time.Parse(time.RFC1123, v) }) + if err != nil { + return nil, err + } + ifModifiedSinceParam, err := parseOptional(getHeaderValue(req.Header, "If-Modified-Since"), func(v string) (time.Time, error) { return time.Parse(time.RFC1123, v) }) + if err != nil { + return nil, err + } + clientRequestIDParam := getOptional(getHeaderValue(req.Header, "x-ms-client-request-id")) + var options *azonlineexperimentation.DeleteMetricOptions + if ifMatchParam != nil || ifNoneMatchParam != nil || ifUnmodifiedSinceParam != nil || ifModifiedSinceParam != nil || clientRequestIDParam != nil { + options = &azonlineexperimentation.DeleteMetricOptions{ + IfMatch: ifMatchParam, + IfNoneMatch: ifNoneMatchParam, + IfUnmodifiedSince: ifUnmodifiedSinceParam, + IfModifiedSince: ifModifiedSinceParam, + ClientRequestID: clientRequestIDParam, + } + } + respr, errRespr := s.srv.DeleteMetric(req.Context(), experimentMetricIDParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).XMSClientRequestID; val != nil { + resp.Header.Set("x-ms-client-request-id", *val) + } + return resp, nil +} + +func (s *ServerTransport) dispatchGetMetric(req *http.Request) (*http.Response, error) { + if s.srv.GetMetric == nil { + return nil, &nonRetriableError{errors.New("fake for method GetMetric not implemented")} + } + const regexStr = `/experiment-metrics/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + experimentMetricIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("experimentMetricId")]) + if err != nil { + return nil, err + } + ifMatchParam := getOptional(getHeaderValue(req.Header, "If-Match")) + ifNoneMatchParam := getOptional(getHeaderValue(req.Header, "If-None-Match")) + ifUnmodifiedSinceParam, err := parseOptional(getHeaderValue(req.Header, "If-Unmodified-Since"), func(v string) (time.Time, error) { return time.Parse(time.RFC1123, v) }) + if err != nil { + return nil, err + } + ifModifiedSinceParam, err := parseOptional(getHeaderValue(req.Header, "If-Modified-Since"), func(v string) (time.Time, error) { return time.Parse(time.RFC1123, v) }) + if err != nil { + return nil, err + } + clientRequestIDParam := getOptional(getHeaderValue(req.Header, "x-ms-client-request-id")) + var options *azonlineexperimentation.GetMetricOptions + if ifMatchParam != nil || ifNoneMatchParam != nil || ifUnmodifiedSinceParam != nil || ifModifiedSinceParam != nil || clientRequestIDParam != nil { + options = &azonlineexperimentation.GetMetricOptions{ + IfMatch: ifMatchParam, + IfNoneMatch: ifNoneMatchParam, + IfUnmodifiedSince: ifUnmodifiedSinceParam, + IfModifiedSince: ifModifiedSinceParam, + ClientRequestID: clientRequestIDParam, + } + } + respr, errRespr := s.srv.GetMetric(req.Context(), experimentMetricIDParam, 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).ExperimentMetric, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).ETag; val != nil { + resp.Header.Set("ETag", *val) + } + if val := server.GetResponse(respr).XMSClientRequestID; val != nil { + resp.Header.Set("x-ms-client-request-id", *val) + } + return resp, nil +} + +func (s *ServerTransport) dispatchNewListMetricsPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListMetricsPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListMetricsPager not implemented")} + } + newListMetricsPager := s.newListMetricsPager.get(req) + if newListMetricsPager == nil { + qp := req.URL.Query() + topUnescaped, err := url.QueryUnescape(qp.Get("top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, 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 + } + maxpagesizeUnescaped, err := url.QueryUnescape(qp.Get("maxpagesize")) + if err != nil { + return nil, err + } + maxpagesizeParam, err := parseOptional(maxpagesizeUnescaped, 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 + } + clientRequestIDParam := getOptional(getHeaderValue(req.Header, "x-ms-client-request-id")) + var options *azonlineexperimentation.ListMetricsOptions + if topParam != nil || skipParam != nil || maxpagesizeParam != nil || clientRequestIDParam != nil { + options = &azonlineexperimentation.ListMetricsOptions{ + Top: topParam, + Skip: skipParam, + Maxpagesize: maxpagesizeParam, + ClientRequestID: clientRequestIDParam, + } + } + resp := s.srv.NewListMetricsPager(options) + newListMetricsPager = &resp + s.newListMetricsPager.add(req, newListMetricsPager) + server.PagerResponderInjectNextLinks(newListMetricsPager, req, func(page *azonlineexperimentation.ListMetricsResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListMetricsPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListMetricsPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListMetricsPager) { + s.newListMetricsPager.remove(req) + } + return resp, nil +} + +func (s *ServerTransport) dispatchValidateMetric(req *http.Request) (*http.Response, error) { + if s.srv.ValidateMetric == nil { + return nil, &nonRetriableError{errors.New("fake for method ValidateMetric not implemented")} + } + body, err := server.UnmarshalRequestAsJSON[azonlineexperimentation.ExperimentMetric](req) + if err != nil { + return nil, err + } + clientRequestIDParam := getOptional(getHeaderValue(req.Header, "x-ms-client-request-id")) + var options *azonlineexperimentation.ValidateMetricOptions + if clientRequestIDParam != nil { + options = &azonlineexperimentation.ValidateMetricOptions{ + ClientRequestID: clientRequestIDParam, + } + } + respr, errRespr := s.srv.ValidateMetric(req.Context(), body, 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).ExperimentMetricValidationResult, req) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).XMSClientRequestID; val != nil { + resp.Header.Set("x-ms-client-request-id", *val) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ServerTransport +var serverTransportInterceptor 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/analytics/azonlineexperimentation/go.mod b/sdk/analytics/azonlineexperimentation/go.mod new file mode 100644 index 000000000000..791515df35ed --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/go.mod @@ -0,0 +1,13 @@ +module github.com/Azure/azure-sdk-for-go/sdk/analytics/azonlineexperimentation + +go 1.23.0 + +toolchain go1.23.8 + +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect + golang.org/x/net v0.37.0 // indirect + golang.org/x/text v0.23.0 // indirect +) diff --git a/sdk/analytics/azonlineexperimentation/go.sum b/sdk/analytics/azonlineexperimentation/go.sum new file mode 100644 index 000000000000..cfff861c9769 --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/go.sum @@ -0,0 +1,16 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= +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/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/analytics/azonlineexperimentation/interfaces.go b/sdk/analytics/azonlineexperimentation/interfaces.go new file mode 100644 index 000000000000..12054bbbc5aa --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/interfaces.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 azonlineexperimentation + +// ExperimentMetricDefinitionClassification provides polymorphic access to related types. +// Call the interface's GetExperimentMetricDefinition() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AverageMetricDefinition, *EventCountMetricDefinition, *EventRateMetricDefinition, *ExperimentMetricDefinition, *PercentileMetricDefinition, +// - *SumMetricDefinition, *UserCountMetricDefinition, *UserRateMetricDefinition +type ExperimentMetricDefinitionClassification interface { + // GetExperimentMetricDefinition returns the ExperimentMetricDefinition content of the underlying type. + GetExperimentMetricDefinition() *ExperimentMetricDefinition +} diff --git a/sdk/analytics/azonlineexperimentation/models.go b/sdk/analytics/azonlineexperimentation/models.go new file mode 100644 index 000000000000..af3b303eb7cc --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/models.go @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package azonlineexperimentation + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "time" +) + +// AggregatedValue - An event property value aggregated by a metric. +type AggregatedValue struct { + // REQUIRED; The name of the event. + EventName *string + + // REQUIRED; The key of the event property to aggregate. + EventProperty *string + + // [Optional] A condition to filter events. + Filter *string +} + +// AverageMetricDefinition - The definition of an Average metric definition. Calculates the average value of a specified event +// property. +type AverageMetricDefinition struct { + // CONSTANT; The type of metric. + // Field has constant value ExperimentMetricTypeAverage, any specified value is ignored. + Type *ExperimentMetricType + + // REQUIRED; The value to aggregate. + Value *AggregatedValue +} + +// GetExperimentMetricDefinition implements the ExperimentMetricDefinitionClassification interface for type AverageMetricDefinition. +func (a *AverageMetricDefinition) GetExperimentMetricDefinition() *ExperimentMetricDefinition { + return &ExperimentMetricDefinition{ + Type: a.Type, + } +} + +// DiagnosticDetail - Diagnostic details for validation errors. +type DiagnosticDetail struct { + // READ-ONLY; The diagnostic error code. + Code *DiagnosticCode + + // READ-ONLY; A human-readable error message. + Message *string +} + +// EventCountMetricDefinition - The definition of an EventCount metric definition. Counts the occurrences of a specified event. +type EventCountMetricDefinition struct { + // REQUIRED; Event to observe. + Event *ObservedEvent + + // CONSTANT; The type of metric. + // Field has constant value ExperimentMetricTypeEventCount, any specified value is ignored. + Type *ExperimentMetricType +} + +// GetExperimentMetricDefinition implements the ExperimentMetricDefinitionClassification interface for type EventCountMetricDefinition. +func (e *EventCountMetricDefinition) GetExperimentMetricDefinition() *ExperimentMetricDefinition { + return &ExperimentMetricDefinition{ + Type: e.Type, + } +} + +// EventRateMetricDefinition - The definition of an EventRate metric definition. Calculates the percentage of events satisfying +// a specified condition. +type EventRateMetricDefinition struct { + // REQUIRED; Event to observe as the rate denominator. + Event *ObservedEvent + + // REQUIRED; The event contributes to the rate numerator if it satisfies this condition. + RateCondition *string + + // CONSTANT; The type of metric. + // Field has constant value ExperimentMetricTypeEventRate, any specified value is ignored. + Type *ExperimentMetricType +} + +// GetExperimentMetricDefinition implements the ExperimentMetricDefinitionClassification interface for type EventRateMetricDefinition. +func (e *EventRateMetricDefinition) GetExperimentMetricDefinition() *ExperimentMetricDefinition { + return &ExperimentMetricDefinition{ + Type: e.Type, + } +} + +// ExperimentMetric - Defines experiment metric metadata and computation details. +type ExperimentMetric struct { + // REQUIRED; Categories associated with the experiment metric. Used for organizing and filtering metrics. + Categories []string + + // REQUIRED; The metric definition specifying how the metric value is calculated from event data. + Definition ExperimentMetricDefinitionClassification + + // REQUIRED; A detailed description of the experiment metric. + Description *string + + // REQUIRED; The desired direction for changes in the metric value. + DesiredDirection *DesiredDirection + + // REQUIRED; A user-friendly display name for the experiment metric shown in reports and dashboards. + DisplayName *string + + // REQUIRED; Determines whether it is included in experiment analysis. + Lifecycle *LifecycleStage + + // READ-ONLY; ETag of the experiment metric. + ETag *azcore.ETag + + // READ-ONLY; Identifier for this experiment metric. Must start with a lowercase letter and contain only lowercase letters, + // numbers, and underscores. + ID *string + + // READ-ONLY; The timestamp (UTC) of the last modification to the experiment metric resource. + LastModifiedAt *time.Time +} + +// ExperimentMetricDefinition - The metric definition, which determines how the metric value is calculated from event data. +type ExperimentMetricDefinition struct { + // REQUIRED; Discriminator property for ExperimentMetricDefinition. + Type *ExperimentMetricType +} + +// GetExperimentMetricDefinition implements the ExperimentMetricDefinitionClassification interface for type ExperimentMetricDefinition. +func (e *ExperimentMetricDefinition) GetExperimentMetricDefinition() *ExperimentMetricDefinition { + return e +} + +// ExperimentMetricValidationResult - The result of validating an experiment metric. +type ExperimentMetricValidationResult struct { + // REQUIRED; Indicates whether the experiment metric is valid. + IsValid *bool + + // READ-ONLY; Diagnostic details from the validation process. + Diagnostics []DiagnosticDetail +} + +// ObservedEvent - An event observed by a metric. +type ObservedEvent struct { + // REQUIRED; The name of the event. + EventName *string + + // [Optional] A condition to filter events. + Filter *string +} + +// PagedExperimentMetric - Paged collection of ExperimentMetric items +type PagedExperimentMetric struct { + // REQUIRED; The ExperimentMetric items on this page + Value []ExperimentMetric + + // The link to the next page of items + NextLink *string +} + +// PercentileMetricDefinition - The definition of a Percentile metric definition. Calculates a specified percentile of an +// event property. +type PercentileMetricDefinition struct { + // REQUIRED; The percentile to measure. + Percentile *float64 + + // CONSTANT; The type of metric. + // Field has constant value ExperimentMetricTypePercentile, any specified value is ignored. + Type *ExperimentMetricType + + // REQUIRED; The value to aggregate, including the event name and property to measure. + Value *AggregatedValue +} + +// GetExperimentMetricDefinition implements the ExperimentMetricDefinitionClassification interface for type PercentileMetricDefinition. +func (p *PercentileMetricDefinition) GetExperimentMetricDefinition() *ExperimentMetricDefinition { + return &ExperimentMetricDefinition{ + Type: p.Type, + } +} + +// SumMetricDefinition - The definition of a Sum metric definition. Calculates the sum of a specified event property. Experiment +// analysis accounts for unequal traffic allocation. +type SumMetricDefinition struct { + // CONSTANT; The type of metric. + // Field has constant value ExperimentMetricTypeSum, any specified value is ignored. + Type *ExperimentMetricType + + // REQUIRED; The value to aggregate. + Value *AggregatedValue +} + +// GetExperimentMetricDefinition implements the ExperimentMetricDefinitionClassification interface for type SumMetricDefinition. +func (s *SumMetricDefinition) GetExperimentMetricDefinition() *ExperimentMetricDefinition { + return &ExperimentMetricDefinition{ + Type: s.Type, + } +} + +// UserCountMetricDefinition - The definition of a UserCount metric definition. Counts unique users who encounter a specified +// event. +type UserCountMetricDefinition struct { + // REQUIRED; Event to observe. + Event *ObservedEvent + + // CONSTANT; The type of metric. + // Field has constant value ExperimentMetricTypeUserCount, any specified value is ignored. + Type *ExperimentMetricType +} + +// GetExperimentMetricDefinition implements the ExperimentMetricDefinitionClassification interface for type UserCountMetricDefinition. +func (u *UserCountMetricDefinition) GetExperimentMetricDefinition() *ExperimentMetricDefinition { + return &ExperimentMetricDefinition{ + Type: u.Type, + } +} + +// UserRateMetricDefinition - The definition of a UserRate metric definition. Calculates the percentage of users who encounter +// a start event and subsequently an end event. Users must encounter events in the specified order. +type UserRateMetricDefinition struct { + // REQUIRED; The end event to observe, which is a condition for the rate numerator. + EndEvent *ObservedEvent + + // REQUIRED; The start event to observe as the rate denominator. + StartEvent *ObservedEvent + + // CONSTANT; The type of metric. + // Field has constant value ExperimentMetricTypeUserRate, any specified value is ignored. + Type *ExperimentMetricType +} + +// GetExperimentMetricDefinition implements the ExperimentMetricDefinitionClassification interface for type UserRateMetricDefinition. +func (u *UserRateMetricDefinition) GetExperimentMetricDefinition() *ExperimentMetricDefinition { + return &ExperimentMetricDefinition{ + Type: u.Type, + } +} diff --git a/sdk/analytics/azonlineexperimentation/models_serde.go b/sdk/analytics/azonlineexperimentation/models_serde.go new file mode 100644 index 000000000000..599d05c62a29 --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/models_serde.go @@ -0,0 +1,506 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package azonlineexperimentation + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AggregatedValue. +func (a AggregatedValue) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eventName", a.EventName) + populate(objectMap, "eventProperty", a.EventProperty) + populate(objectMap, "filter", a.Filter) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AggregatedValue. +func (a *AggregatedValue) UnmarshalJSON(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 "eventName": + err = unpopulate(val, "EventName", &a.EventName) + delete(rawMsg, key) + case "eventProperty": + err = unpopulate(val, "EventProperty", &a.EventProperty) + delete(rawMsg, key) + case "filter": + err = unpopulate(val, "Filter", &a.Filter) + 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 AverageMetricDefinition. +func (a AverageMetricDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["type"] = ExperimentMetricTypeAverage + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AverageMetricDefinition. +func (a *AverageMetricDefinition) UnmarshalJSON(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 "type": + err = unpopulate(val, "Type", &a.Type) + 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 DiagnosticDetail. +func (d DiagnosticDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", d.Code) + populate(objectMap, "message", d.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiagnosticDetail. +func (d *DiagnosticDetail) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &d.Code) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &d.Message) + 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 EventCountMetricDefinition. +func (e EventCountMetricDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "event", e.Event) + objectMap["type"] = ExperimentMetricTypeEventCount + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventCountMetricDefinition. +func (e *EventCountMetricDefinition) UnmarshalJSON(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 "event": + err = unpopulate(val, "Event", &e.Event) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EventRateMetricDefinition. +func (e EventRateMetricDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "event", e.Event) + populate(objectMap, "rateCondition", e.RateCondition) + objectMap["type"] = ExperimentMetricTypeEventRate + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventRateMetricDefinition. +func (e *EventRateMetricDefinition) UnmarshalJSON(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 "event": + err = unpopulate(val, "Event", &e.Event) + delete(rawMsg, key) + case "rateCondition": + err = unpopulate(val, "RateCondition", &e.RateCondition) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExperimentMetric. +func (e ExperimentMetric) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "categories", e.Categories) + populate(objectMap, "definition", e.Definition) + populate(objectMap, "description", e.Description) + populate(objectMap, "desiredDirection", e.DesiredDirection) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "eTag", e.ETag) + populate(objectMap, "id", e.ID) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", e.LastModifiedAt) + populate(objectMap, "lifecycle", e.Lifecycle) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentMetric. +func (e *ExperimentMetric) UnmarshalJSON(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 "categories": + err = unpopulate(val, "Categories", &e.Categories) + delete(rawMsg, key) + case "definition": + e.Definition, err = unmarshalExperimentMetricDefinitionClassification(val) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &e.Description) + delete(rawMsg, key) + case "desiredDirection": + err = unpopulate(val, "DesiredDirection", &e.DesiredDirection) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) + delete(rawMsg, key) + case "eTag": + err = unpopulate(val, "ETag", &e.ETag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &e.LastModifiedAt) + delete(rawMsg, key) + case "lifecycle": + err = unpopulate(val, "Lifecycle", &e.Lifecycle) + 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 ExperimentMetricDefinition. +func (e ExperimentMetricDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentMetricDefinition. +func (e *ExperimentMetricDefinition) UnmarshalJSON(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 "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExperimentMetricValidationResult. +func (e ExperimentMetricValidationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "diagnostics", e.Diagnostics) + populate(objectMap, "isValid", e.IsValid) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExperimentMetricValidationResult. +func (e *ExperimentMetricValidationResult) UnmarshalJSON(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 "diagnostics": + err = unpopulate(val, "Diagnostics", &e.Diagnostics) + delete(rawMsg, key) + case "isValid": + err = unpopulate(val, "IsValid", &e.IsValid) + 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 ObservedEvent. +func (o ObservedEvent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "eventName", o.EventName) + populate(objectMap, "filter", o.Filter) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ObservedEvent. +func (o *ObservedEvent) UnmarshalJSON(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 "eventName": + err = unpopulate(val, "EventName", &o.EventName) + delete(rawMsg, key) + case "filter": + err = unpopulate(val, "Filter", &o.Filter) + 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 PagedExperimentMetric. +func (p PagedExperimentMetric) 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 PagedExperimentMetric. +func (p *PagedExperimentMetric) UnmarshalJSON(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 PercentileMetricDefinition. +func (p PercentileMetricDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "percentile", p.Percentile) + objectMap["type"] = ExperimentMetricTypePercentile + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PercentileMetricDefinition. +func (p *PercentileMetricDefinition) UnmarshalJSON(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 "percentile": + err = unpopulate(val, "Percentile", &p.Percentile) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + 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 SumMetricDefinition. +func (s SumMetricDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["type"] = ExperimentMetricTypeSum + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SumMetricDefinition. +func (s *SumMetricDefinition) UnmarshalJSON(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 "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 UserCountMetricDefinition. +func (u UserCountMetricDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "event", u.Event) + objectMap["type"] = ExperimentMetricTypeUserCount + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserCountMetricDefinition. +func (u *UserCountMetricDefinition) UnmarshalJSON(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 "event": + err = unpopulate(val, "Event", &u.Event) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) + 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 UserRateMetricDefinition. +func (u UserRateMetricDefinition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "endEvent", u.EndEvent) + populate(objectMap, "startEvent", u.StartEvent) + objectMap["type"] = ExperimentMetricTypeUserRate + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserRateMetricDefinition. +func (u *UserRateMetricDefinition) UnmarshalJSON(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 "endEvent": + err = unpopulate(val, "EndEvent", &u.EndEvent) + delete(rawMsg, key) + case "startEvent": + err = unpopulate(val, "StartEvent", &u.StartEvent) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &u.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/analytics/azonlineexperimentation/options.go b/sdk/analytics/azonlineexperimentation/options.go new file mode 100644 index 000000000000..bf860c42328d --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/options.go @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package azonlineexperimentation + +import "time" + +// CreateOrUpdateMetricOptions contains the optional parameters for the Client.CreateOrUpdateMetric method. +type CreateOrUpdateMetricOptions struct { + // An opaque, globally-unique, client-generated string identifier for the request. + ClientRequestID *string + + // The request should only proceed if an entity matches this string. + IfMatch *string + + // The request should only proceed if the entity was modified after this time. + IfModifiedSince *time.Time + + // The request should only proceed if no entity matches this string. + IfNoneMatch *string + + // The request should only proceed if the entity was not modified after this time. + IfUnmodifiedSince *time.Time +} + +// DeleteMetricOptions contains the optional parameters for the Client.DeleteMetric method. +type DeleteMetricOptions struct { + // An opaque, globally-unique, client-generated string identifier for the request. + ClientRequestID *string + + // The request should only proceed if an entity matches this string. + IfMatch *string + + // The request should only proceed if the entity was modified after this time. + IfModifiedSince *time.Time + + // The request should only proceed if no entity matches this string. + IfNoneMatch *string + + // The request should only proceed if the entity was not modified after this time. + IfUnmodifiedSince *time.Time +} + +// GetMetricOptions contains the optional parameters for the Client.GetMetric method. +type GetMetricOptions struct { + // An opaque, globally-unique, client-generated string identifier for the request. + ClientRequestID *string + + // The request should only proceed if an entity matches this string. + IfMatch *string + + // The request should only proceed if the entity was modified after this time. + IfModifiedSince *time.Time + + // The request should only proceed if no entity matches this string. + IfNoneMatch *string + + // The request should only proceed if the entity was not modified after this time. + IfUnmodifiedSince *time.Time +} + +// ListMetricsOptions contains the optional parameters for the Client.NewListMetricsPager method. +type ListMetricsOptions struct { + // An opaque, globally-unique, client-generated string identifier for the request. + ClientRequestID *string + + // The maximum number of result items per page. + Maxpagesize *int32 + + // The number of result items to skip. + Skip *int32 + + // The number of result items to return. + Top *int32 +} + +// ValidateMetricOptions contains the optional parameters for the Client.ValidateMetric method. +type ValidateMetricOptions struct { + // An opaque, globally-unique, client-generated string identifier for the request. + ClientRequestID *string +} diff --git a/sdk/analytics/azonlineexperimentation/polymorphic_helpers.go b/sdk/analytics/azonlineexperimentation/polymorphic_helpers.go new file mode 100644 index 000000000000..dac0e6bad5e5 --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/polymorphic_helpers.go @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package azonlineexperimentation + +import "encoding/json" + +func unmarshalExperimentMetricDefinitionClassification(rawMsg json.RawMessage) (ExperimentMetricDefinitionClassification, 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 ExperimentMetricDefinitionClassification + switch m["type"] { + case string(ExperimentMetricTypeEventCount): + b = &EventCountMetricDefinition{} + case string(ExperimentMetricTypeUserCount): + b = &UserCountMetricDefinition{} + case string(ExperimentMetricTypeEventRate): + b = &EventRateMetricDefinition{} + case string(ExperimentMetricTypeUserRate): + b = &UserRateMetricDefinition{} + case string(ExperimentMetricTypeSum): + b = &SumMetricDefinition{} + case string(ExperimentMetricTypeAverage): + b = &AverageMetricDefinition{} + case string(ExperimentMetricTypePercentile): + b = &PercentileMetricDefinition{} + default: + b = &ExperimentMetricDefinition{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/analytics/azonlineexperimentation/responses.go b/sdk/analytics/azonlineexperimentation/responses.go new file mode 100644 index 000000000000..f34eaab3ad40 --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/responses.go @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package azonlineexperimentation + +// CreateOrUpdateMetricResponse contains the response from method Client.CreateOrUpdateMetric. +type CreateOrUpdateMetricResponse struct { + // Defines experiment metric metadata and computation details. + ExperimentMetric + + // The entity tag for the response. + ETag *string + + // An opaque, globally-unique, client-generated string identifier for the request. + XMSClientRequestID *string +} + +// DeleteMetricResponse contains the response from method Client.DeleteMetric. +type DeleteMetricResponse struct { + // An opaque, globally-unique, client-generated string identifier for the request. + XMSClientRequestID *string +} + +// GetMetricResponse contains the response from method Client.GetMetric. +type GetMetricResponse struct { + // Defines experiment metric metadata and computation details. + ExperimentMetric + + // The entity tag for the response. + ETag *string + + // An opaque, globally-unique, client-generated string identifier for the request. + XMSClientRequestID *string +} + +// ListMetricsResponse contains the response from method Client.NewListMetricsPager. +type ListMetricsResponse struct { + // Paged collection of ExperimentMetric items + PagedExperimentMetric + + // An opaque, globally-unique, client-generated string identifier for the request. + XMSClientRequestID *string +} + +// ValidateMetricResponse contains the response from method Client.ValidateMetric. +type ValidateMetricResponse struct { + // The result of validating an experiment metric. + ExperimentMetricValidationResult + + // An opaque, globally-unique, client-generated string identifier for the request. + XMSClientRequestID *string +} diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/fake/time_rfc3339.go b/sdk/analytics/azonlineexperimentation/time_rfc3339.go similarity index 98% rename from sdk/resourcemanager/computefleet/armcomputefleet/fake/time_rfc3339.go rename to sdk/analytics/azonlineexperimentation/time_rfc3339.go index 87ee11e83b32..a3c99ae03343 100644 --- a/sdk/resourcemanager/computefleet/armcomputefleet/fake/time_rfc3339.go +++ b/sdk/analytics/azonlineexperimentation/time_rfc3339.go @@ -2,7 +2,7 @@ // Licensed under the 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 +package azonlineexperimentation import ( "encoding/json" diff --git a/sdk/analytics/azonlineexperimentation/tsp-location.yaml b/sdk/analytics/azonlineexperimentation/tsp-location.yaml new file mode 100644 index 000000000000..9fc34dc4df70 --- /dev/null +++ b/sdk/analytics/azonlineexperimentation/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/onlineexperimentation/Azure.Analytics.OnlineExperimentation +commit: 079f70d6f2b754db6b736e117196104efd2dd496 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/messaging/eventgrid/aznamespaces/CHANGELOG.md b/sdk/messaging/eventgrid/aznamespaces/CHANGELOG.md index 6d7391ceea97..fd687577b4f1 100644 --- a/sdk/messaging/eventgrid/aznamespaces/CHANGELOG.md +++ b/sdk/messaging/eventgrid/aznamespaces/CHANGELOG.md @@ -1,5 +1,76 @@ # Release History +## 2.0.0 (2025-05-13) +### Breaking Changes + +- Function `*ReceiverClient.AcknowledgeEvents` parameter(s) have been changed from `(context.Context, []string, *AcknowledgeEventsOptions)` to `(context.Context, string, string, []string, *ReceiverClientAcknowledgeEventsOptions)` +- Function `*ReceiverClient.AcknowledgeEvents` return value(s) have been changed from `(AcknowledgeEventsResponse, error)` to `(ReceiverClientAcknowledgeEventsResponse, error)` +- Function `*ReceiverClient.ReceiveEvents` parameter(s) have been changed from `(context.Context, *ReceiveEventsOptions)` to `(context.Context, string, string, *ReceiverClientReceiveEventsOptions)` +- Function `*ReceiverClient.ReceiveEvents` return value(s) have been changed from `(ReceiveEventsResponse, error)` to `(ReceiverClientReceiveEventsResponse, error)` +- Function `*ReceiverClient.RejectEvents` parameter(s) have been changed from `(context.Context, []string, *RejectEventsOptions)` to `(context.Context, string, string, []string, *ReceiverClientRejectEventsOptions)` +- Function `*ReceiverClient.RejectEvents` return value(s) have been changed from `(RejectEventsResponse, error)` to `(ReceiverClientRejectEventsResponse, error)` +- Function `*ReceiverClient.ReleaseEvents` parameter(s) have been changed from `(context.Context, []string, *ReleaseEventsOptions)` to `(context.Context, string, string, []string, *ReceiverClientReleaseEventsOptions)` +- Function `*ReceiverClient.ReleaseEvents` return value(s) have been changed from `(ReleaseEventsResponse, error)` to `(ReceiverClientReleaseEventsResponse, error)` +- Function `*ReceiverClient.RenewEventLocks` parameter(s) have been changed from `(context.Context, []string, *RenewEventLocksOptions)` to `(context.Context, string, string, []string, *ReceiverClientRenewEventLocksOptions)` +- Function `*ReceiverClient.RenewEventLocks` return value(s) have been changed from `(RenewEventLocksResponse, error)` to `(ReceiverClientRenewEventLocksResponse, error)` +- Function `*SenderClient.SendEvent` parameter(s) have been changed from `(context.Context, *messaging.CloudEvent, *SendEventOptions)` to `(context.Context, string, CloudEvent, *SenderClientSendEventOptions)` +- Function `*SenderClient.SendEvent` return value(s) have been changed from `(SendEventResponse, error)` to `(SenderClientSendEventResponse, error)` +- Function `*SenderClient.SendEvents` parameter(s) have been changed from `(context.Context, []*messaging.CloudEvent, *SendEventsOptions)` to `(context.Context, string, []CloudEvent, *SenderClientSendEventsOptions)` +- Function `*SenderClient.SendEvents` return value(s) have been changed from `(SendEventsResponse, error)` to `(SenderClientSendEventsResponse, error)` +- Type of `ReceiveDetails.Event` has been changed from `messaging.CloudEvent` to `*CloudEvent` +- Function `NewReceiverClient` has been removed +- Function `NewReceiverClientWithSharedKeyCredential` has been removed +- Function `NewSenderClient` has been removed +- Function `NewSenderClientWithSharedKeyCredential` has been removed +- Struct `AcknowledgeEventsOptions` has been removed +- Struct `AcknowledgeEventsResponse` has been removed +- Struct `AcknowledgeEventsResult` has been removed +- Struct `ReceiveEventsOptions` has been removed +- Struct `ReceiveEventsResponse` has been removed +- Struct `ReceiveEventsResult` has been removed +- Struct `ReceiverClientOptions` has been removed +- Struct `RejectEventsOptions` has been removed +- Struct `RejectEventsResponse` has been removed +- Struct `RejectEventsResult` has been removed +- Struct `ReleaseEventsOptions` has been removed +- Struct `ReleaseEventsResponse` has been removed +- Struct `ReleaseEventsResult` has been removed +- Struct `RenewEventLocksOptions` has been removed +- Struct `RenewEventLocksResponse` has been removed +- Struct `RenewEventLocksResult` has been removed +- Struct `SendEventOptions` has been removed +- Struct `SendEventResponse` has been removed +- Struct `SendEventsOptions` has been removed +- Struct `SendEventsResponse` has been removed +- Struct `SenderClientOptions` has been removed + +### Features Added + +- New struct `AcknowledgeResult` +- New struct `CloudEvent` +- New struct `InnerError` +- New struct `PublishResult` +- New struct `ReceiveResult` +- New struct `ReceiverClientAcknowledgeEventsOptions` +- New struct `ReceiverClientAcknowledgeEventsResponse` +- New struct `ReceiverClientReceiveEventsOptions` +- New struct `ReceiverClientReceiveEventsResponse` +- New struct `ReceiverClientRejectEventsOptions` +- New struct `ReceiverClientRejectEventsResponse` +- New struct `ReceiverClientReleaseEventsOptions` +- New struct `ReceiverClientReleaseEventsResponse` +- New struct `ReceiverClientRenewEventLocksOptions` +- New struct `ReceiverClientRenewEventLocksResponse` +- New struct `RejectResult` +- New struct `ReleaseResult` +- New struct `RenewLocksResult` +- New struct `SenderClientSendEventOptions` +- New struct `SenderClientSendEventResponse` +- New struct `SenderClientSendEventsOptions` +- New struct `SenderClientSendEventsResponse` +- New field `Details`, `Innererror`, `Target` in struct `Error` + + ## 1.0.1 (Unreleased) ### Features Added diff --git a/sdk/messaging/eventgrid/aznamespaces/README.md b/sdk/messaging/eventgrid/aznamespaces/README.md index 67247efb9979..2f5dcc0cd077 100644 --- a/sdk/messaging/eventgrid/aznamespaces/README.md +++ b/sdk/messaging/eventgrid/aznamespaces/README.md @@ -19,7 +19,7 @@ Key links: Install the Azure Event Grid Namespaces client module for Go with `go get`: ```bash -go get github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces +go get github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces/v2 ``` ### Prerequisites @@ -114,15 +114,15 @@ Azure SDK for Go is licensed under the [MIT](https://github.com/Azure/azure-sdk- [azure_sdk_for_go_contributing_developer_guide]: https://github.com/Azure/azure-sdk-for-go/blob/main/CONTRIBUTING.md#developer-guide [azure_sdk_for_go_contributing_pull_requests]: https://github.com/Azure/azure-sdk-for-go/blob/main/CONTRIBUTING.md#pull-requests [source]: https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/messaging/eventgrid/aznamespaces -[godoc]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces -[godoc_send]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces#SenderClient.SendEvents -[godoc_receive]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces#ReceiverClient.ReceiveEvents -[godoc_examples]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces#pkg-examples -[godoc_example_newsender_sharedkey]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces#example-NewSenderClientWithSharedKeyCredential -[godoc_example_newreceiver_sharedkey]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces#example-NewReceiverClientWithSharedKeyCredential -[godoc_example_newsender]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces#example-NewSenderClient -[godoc_example_newreceiver]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces#example-NewReceiverClient -[godoc_egbasic_client]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces#Client +[godoc]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces/v2 +[godoc_send]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces/v2#SenderClient.SendEvents +[godoc_receive]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces/v2#ReceiverClient.ReceiveEvents +[godoc_examples]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces/v2#pkg-examples +[godoc_example_newsender_sharedkey]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces/v2#example-NewSenderClientWithSharedKeyCredential +[godoc_example_newreceiver_sharedkey]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces/v2#example-NewReceiverClientWithSharedKeyCredential +[godoc_example_newsender]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces/v2#example-NewSenderClient +[godoc_example_newreceiver]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces/v2#example-NewReceiverClient +[godoc_egbasic_client]: https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces/v2#Client [ms_namespace]: https://learn.microsoft.com/azure/event-grid/concepts-pull-delivery#namespaces [ms_topic]: https://learn.microsoft.com/azure/event-grid/concepts-pull-delivery#namespace-topics [ms_subscription]: https://learn.microsoft.com/azure/event-grid/concepts-pull-delivery#event-subscriptions diff --git a/sdk/messaging/eventgrid/aznamespaces/build.go b/sdk/messaging/eventgrid/aznamespaces/build.go deleted file mode 100644 index 05938252414f..000000000000 --- a/sdk/messaging/eventgrid/aznamespaces/build.go +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -//go:generate tsp-client update -//go:generate goimports -w . -//go:generate go run ./internal/generate -//go:generate goimports -w . - -package aznamespaces diff --git a/sdk/messaging/eventgrid/aznamespaces/go.mod b/sdk/messaging/eventgrid/aznamespaces/go.mod index beaa7bcbf597..550d409bce51 100644 --- a/sdk/messaging/eventgrid/aznamespaces/go.mod +++ b/sdk/messaging/eventgrid/aznamespaces/go.mod @@ -1,10 +1,11 @@ -module github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces +module github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces/v2 go 1.23.0 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 + github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces v1.0.0 ) diff --git a/sdk/messaging/eventgrid/aznamespaces/go.sum b/sdk/messaging/eventgrid/aznamespaces/go.sum index 5ad08fa92386..9b1398c8026e 100644 --- a/sdk/messaging/eventgrid/aznamespaces/go.sum +++ b/sdk/messaging/eventgrid/aznamespaces/go.sum @@ -6,6 +6,8 @@ github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+ github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 h1:FPKJS1T+clwv+OLGt13a8UjqeRuh0O4SJ3lUriThc+4= github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1/go.mod h1:j2chePtV91HrC22tGoRX3sGY42uF13WzmmV80/OdVAA= +github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces v1.0.0 h1:NuKtfJWQv4V2lcSDh+lZnm3rLNTQl6ePtqKUHY0qSPU= +github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces v1.0.0/go.mod h1:1VBmb/55EInicb/Z5aS8p6CulJ9olX6BJ9kKjmIHcrA= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 h1:oygO0locgZJe7PpYPXT5A29ZkwJaPqcva7BVeemZOZs= diff --git a/sdk/messaging/eventgrid/aznamespaces/models.go b/sdk/messaging/eventgrid/aznamespaces/models.go index cf95c73508d3..b54536a4681a 100644 --- a/sdk/messaging/eventgrid/aznamespaces/models.go +++ b/sdk/messaging/eventgrid/aznamespaces/models.go @@ -4,15 +4,15 @@ package aznamespaces -import "github.com/Azure/azure-sdk-for-go/sdk/azcore/messaging" +import "time" -// AcknowledgeEventsResult - The result of the Acknowledge operation. -type AcknowledgeEventsResult struct { - // REQUIRED; Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the +// AcknowledgeResult - The result of the Acknowledge operation. +type AcknowledgeResult struct { + // READ-ONLY; Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the // related error information (namely, the error code and description). FailedLockTokens []FailedLockToken - // REQUIRED; Array of lock tokens for the successfully acknowledged cloud events. + // READ-ONLY; Array of lock tokens for the successfully acknowledged cloud events. SucceededLockTokens []string } @@ -25,6 +25,59 @@ type BrokerProperties struct { LockToken *string } +// CloudEvent - Properties of an event published to an Azure Messaging EventGrid Namespace topic using the CloudEvent 1.0 +// Schema. +type CloudEvent struct { + // REQUIRED; An identifier for the event. The combination of id and source must be unique for each distinct event. + ID *string + + // REQUIRED; Identifies the context in which an event happened. The combination of id and source must be unique for each distinct + // event. + Source *string + + // REQUIRED; The version of the CloudEvents specification which the event uses. + Specversion *string + + // REQUIRED; Type of event related to the originating occurrence. + Type *string + + // Event data specific to the event type. + Data any + + // Event data specific to the event type, encoded as a base64 string. + DataBase64 []byte + + // Content type of data value. + Datacontenttype *string + + // Identifies the schema that data adheres to. + Dataschema *string + + // This describes the subject of the event in the context of the event producer (identified by source). + Subject *string + + // The time (in UTC) the event was generated, in RFC3339 format. + Time *time.Time +} + +// Error - The error object. +type Error struct { + // REQUIRED; One of a server-defined set of error codes. + Code *string + + // REQUIRED; A human-readable representation of the error. + Message *string + + // An array of details about specific errors that led to this reported error. + Details []Error + + // An object containing more specific information than the current object about the error. + Innererror *InnerError + + // The target of the error. + Target *string +} + // FailedLockToken - Failed LockToken information. type FailedLockToken struct { // REQUIRED; Error information of the failed operation result for the lock token in the request. @@ -34,47 +87,60 @@ type FailedLockToken struct { LockToken *string } +// InnerError - An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#handling-errors. +type InnerError struct { + // One of a server-defined set of error codes. + Code *string + + // Inner error. + Innererror *InnerError +} + +// PublishResult - The result of the Publish operation. +type PublishResult struct { +} + // ReceiveDetails - Receive operation details per Cloud Event. type ReceiveDetails struct { // REQUIRED; The Event Broker details. BrokerProperties *BrokerProperties // REQUIRED; Cloud Event details. - Event messaging.CloudEvent + Event *CloudEvent } -// ReceiveEventsResult - Details of the Receive operation response. -type ReceiveEventsResult struct { - // REQUIRED; Array of receive responses, one per cloud event. +// ReceiveResult - Details of the Receive operation response. +type ReceiveResult struct { + // READ-ONLY; Array of receive responses, one per cloud event. Details []ReceiveDetails } -// RejectEventsResult - The result of the Reject operation. -type RejectEventsResult struct { - // REQUIRED; Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the +// RejectResult - The result of the Reject operation. +type RejectResult struct { + // READ-ONLY; Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the // related error information (namely, the error code and description). FailedLockTokens []FailedLockToken - // REQUIRED; Array of lock tokens for the successfully rejected cloud events. + // READ-ONLY; Array of lock tokens for the successfully rejected cloud events. SucceededLockTokens []string } -// ReleaseEventsResult - The result of the Release operation. -type ReleaseEventsResult struct { - // REQUIRED; Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the +// ReleaseResult - The result of the Release operation. +type ReleaseResult struct { + // READ-ONLY; Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the // related error information (namely, the error code and description). FailedLockTokens []FailedLockToken - // REQUIRED; Array of lock tokens for the successfully released cloud events. + // READ-ONLY; Array of lock tokens for the successfully released cloud events. SucceededLockTokens []string } -// RenewEventLocksResult - The result of the RenewLock operation. -type RenewEventLocksResult struct { - // REQUIRED; Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the +// RenewLocksResult - The result of the RenewLock operation. +type RenewLocksResult struct { + // READ-ONLY; Array of FailedLockToken for failed cloud events. Each FailedLockToken includes the lock token along with the // related error information (namely, the error code and description). FailedLockTokens []FailedLockToken - // REQUIRED; Array of lock tokens for the successfully renewed locks. + // READ-ONLY; Array of lock tokens for the successfully renewed locks. SucceededLockTokens []string } diff --git a/sdk/messaging/eventgrid/aznamespaces/models_serde.go b/sdk/messaging/eventgrid/aznamespaces/models_serde.go index c3229a6780c0..d406c991e8f0 100644 --- a/sdk/messaging/eventgrid/aznamespaces/models_serde.go +++ b/sdk/messaging/eventgrid/aznamespaces/models_serde.go @@ -7,13 +7,13 @@ package aznamespaces import ( "encoding/json" "fmt" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" ) // MarshalJSON implements the json.Marshaller interface for type AcknowledgeResult. -func (a AcknowledgeEventsResult) MarshalJSON() ([]byte, error) { +func (a AcknowledgeResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "failedLockTokens", a.FailedLockTokens) populate(objectMap, "succeededLockTokens", a.SucceededLockTokens) @@ -21,7 +21,7 @@ func (a AcknowledgeEventsResult) MarshalJSON() ([]byte, error) { } // UnmarshalJSON implements the json.Unmarshaller interface for type AcknowledgeResult. -func (a *AcknowledgeEventsResult) UnmarshalJSON(data []byte) error { +func (a *AcknowledgeResult) UnmarshalJSON(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) @@ -74,6 +74,116 @@ func (b *BrokerProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CloudEvent. +func (c CloudEvent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "data", c.Data) + populateByteArray(objectMap, "data_base64", c.DataBase64, func() any { + return runtime.EncodeByteArray(c.DataBase64, runtime.Base64StdFormat) + }) + populate(objectMap, "datacontenttype", c.Datacontenttype) + populate(objectMap, "dataschema", c.Dataschema) + populate(objectMap, "id", c.ID) + populate(objectMap, "source", c.Source) + populate(objectMap, "specversion", c.Specversion) + populate(objectMap, "subject", c.Subject) + populateDateTimeRFC3339(objectMap, "time", c.Time) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudEvent. +func (c *CloudEvent) UnmarshalJSON(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 "data": + err = unpopulate(val, "Data", &c.Data) + delete(rawMsg, key) + case "data_base64": + if val != nil && string(val) != "null" { + err = runtime.DecodeByteArray(string(val), &c.DataBase64, runtime.Base64StdFormat) + } + delete(rawMsg, key) + case "datacontenttype": + err = unpopulate(val, "Datacontenttype", &c.Datacontenttype) + delete(rawMsg, key) + case "dataschema": + err = unpopulate(val, "Dataschema", &c.Dataschema) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &c.Source) + delete(rawMsg, key) + case "specversion": + err = unpopulate(val, "Specversion", &c.Specversion) + delete(rawMsg, key) + case "subject": + err = unpopulate(val, "Subject", &c.Subject) + delete(rawMsg, key) + case "time": + err = unpopulateDateTimeRFC3339(val, "Time", &c.Time) + 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 Error. +func (e Error) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "innererror", e.Innererror) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Error. +func (e *Error) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &e.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &e.Details) + delete(rawMsg, key) + case "innererror": + err = unpopulate(val, "Innererror", &e.Innererror) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &e.Message) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &e.Target) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type FailedLockToken. func (f FailedLockToken) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -105,6 +215,37 @@ func (f *FailedLockToken) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type InnerError. +func (i InnerError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", i.Code) + populate(objectMap, "innererror", i.Innererror) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InnerError. +func (i *InnerError) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &i.Code) + delete(rawMsg, key) + case "innererror": + err = unpopulate(val, "Innererror", &i.Innererror) + 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 ReceiveDetails. func (r ReceiveDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -137,14 +278,14 @@ func (r *ReceiveDetails) UnmarshalJSON(data []byte) error { } // MarshalJSON implements the json.Marshaller interface for type ReceiveResult. -func (r ReceiveEventsResult) MarshalJSON() ([]byte, error) { +func (r ReceiveResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "value", r.Details) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type ReceiveResult. -func (r *ReceiveEventsResult) UnmarshalJSON(data []byte) error { +func (r *ReceiveResult) UnmarshalJSON(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) @@ -164,7 +305,7 @@ func (r *ReceiveEventsResult) UnmarshalJSON(data []byte) error { } // MarshalJSON implements the json.Marshaller interface for type RejectResult. -func (r RejectEventsResult) MarshalJSON() ([]byte, error) { +func (r RejectResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "failedLockTokens", r.FailedLockTokens) populate(objectMap, "succeededLockTokens", r.SucceededLockTokens) @@ -172,7 +313,7 @@ func (r RejectEventsResult) MarshalJSON() ([]byte, error) { } // UnmarshalJSON implements the json.Unmarshaller interface for type RejectResult. -func (r *RejectEventsResult) UnmarshalJSON(data []byte) error { +func (r *RejectResult) UnmarshalJSON(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) @@ -195,7 +336,7 @@ func (r *RejectEventsResult) UnmarshalJSON(data []byte) error { } // MarshalJSON implements the json.Marshaller interface for type ReleaseResult. -func (r ReleaseEventsResult) MarshalJSON() ([]byte, error) { +func (r ReleaseResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "failedLockTokens", r.FailedLockTokens) populate(objectMap, "succeededLockTokens", r.SucceededLockTokens) @@ -203,7 +344,7 @@ func (r ReleaseEventsResult) MarshalJSON() ([]byte, error) { } // UnmarshalJSON implements the json.Unmarshaller interface for type ReleaseResult. -func (r *ReleaseEventsResult) UnmarshalJSON(data []byte) error { +func (r *ReleaseResult) UnmarshalJSON(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) @@ -226,7 +367,7 @@ func (r *ReleaseEventsResult) UnmarshalJSON(data []byte) error { } // MarshalJSON implements the json.Marshaller interface for type RenewLocksResult. -func (r RenewEventLocksResult) MarshalJSON() ([]byte, error) { +func (r RenewLocksResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "failedLockTokens", r.FailedLockTokens) populate(objectMap, "succeededLockTokens", r.SucceededLockTokens) @@ -234,7 +375,7 @@ func (r RenewEventLocksResult) MarshalJSON() ([]byte, error) { } // UnmarshalJSON implements the json.Unmarshaller interface for type RenewLocksResult. -func (r *RenewEventLocksResult) UnmarshalJSON(data []byte) error { +func (r *RenewLocksResult) UnmarshalJSON(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) diff --git a/sdk/messaging/eventgrid/aznamespaces/options.go b/sdk/messaging/eventgrid/aznamespaces/options.go index 5845c536f55d..c6384646ad1c 100644 --- a/sdk/messaging/eventgrid/aznamespaces/options.go +++ b/sdk/messaging/eventgrid/aznamespaces/options.go @@ -4,13 +4,13 @@ package aznamespaces -// AcknowledgeEventsOptions contains the optional parameters for the ReceiverClient.AcknowledgeEvents method. -type AcknowledgeEventsOptions struct { +// ReceiverClientAcknowledgeEventsOptions contains the optional parameters for the ReceiverClient.AcknowledgeEvents method. +type ReceiverClientAcknowledgeEventsOptions struct { // placeholder for future optional parameters } -// ReceiveEventsOptions contains the optional parameters for the ReceiverClient.ReceiveEvents method. -type ReceiveEventsOptions struct { +// ReceiverClientReceiveEventsOptions contains the optional parameters for the ReceiverClient.ReceiveEvents method. +type ReceiverClientReceiveEventsOptions struct { // Max Events count to be received. Minimum value is 1, while maximum value is 100 events. If not specified, the default value // is 1. MaxEvents *int32 @@ -22,28 +22,28 @@ type ReceiveEventsOptions struct { MaxWaitTime *int32 } -// RejectEventsOptions contains the optional parameters for the ReceiverClient.RejectEvents method. -type RejectEventsOptions struct { +// ReceiverClientRejectEventsOptions contains the optional parameters for the ReceiverClient.RejectEvents method. +type ReceiverClientRejectEventsOptions struct { // placeholder for future optional parameters } -// ReleaseEventsOptions contains the optional parameters for the ReceiverClient.ReleaseEvents method. -type ReleaseEventsOptions struct { +// ReceiverClientReleaseEventsOptions contains the optional parameters for the ReceiverClient.ReleaseEvents method. +type ReceiverClientReleaseEventsOptions struct { // Release cloud events with the specified delay in seconds. ReleaseDelayInSeconds *ReleaseDelay } -// RenewEventLocksOptions contains the optional parameters for the ReceiverClient.RenewEventLocks method. -type RenewEventLocksOptions struct { +// ReceiverClientRenewEventLocksOptions contains the optional parameters for the ReceiverClient.RenewEventLocks method. +type ReceiverClientRenewEventLocksOptions struct { // placeholder for future optional parameters } -// SendEventOptions contains the optional parameters for the SenderClient.SendEvent method. -type SendEventOptions struct { +// SenderClientSendEventOptions contains the optional parameters for the SenderClient.SendEvent method. +type SenderClientSendEventOptions struct { // placeholder for future optional parameters } -// SendEventsOptions contains the optional parameters for the SenderClient.SendEvents method. -type SendEventsOptions struct { +// SenderClientSendEventsOptions contains the optional parameters for the SenderClient.SendEvents method. +type SenderClientSendEventsOptions struct { // placeholder for future optional parameters } diff --git a/sdk/messaging/eventgrid/aznamespaces/receiver_client.go b/sdk/messaging/eventgrid/aznamespaces/receiver_client.go index f693b9622522..920359869022 100644 --- a/sdk/messaging/eventgrid/aznamespaces/receiver_client.go +++ b/sdk/messaging/eventgrid/aznamespaces/receiver_client.go @@ -7,21 +7,18 @@ package aznamespaces import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "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" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ReceiverClient contains the methods for the Receiver group. // Don't use this type directly, use a constructor function instead. type ReceiverClient struct { - data receiverData - internal *azcore.Client endpoint string } @@ -37,26 +34,26 @@ type ReceiverClient struct { // - lockTokens - Array of lock tokens. // - options - ReceiverClientAcknowledgeEventsOptions contains the optional parameters for the ReceiverClient.AcknowledgeEvents // method. -func (client *ReceiverClient) internalAcknowledgeEvents(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, options *AcknowledgeEventsOptions) (AcknowledgeEventsResponse, error) { +func (client *ReceiverClient) AcknowledgeEvents(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, options *ReceiverClientAcknowledgeEventsOptions) (ReceiverClientAcknowledgeEventsResponse, error) { var err error req, err := client.acknowledgeEventsCreateRequest(ctx, topicName, eventSubscriptionName, lockTokens, options) if err != nil { - return AcknowledgeEventsResponse{}, err + return ReceiverClientAcknowledgeEventsResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return AcknowledgeEventsResponse{}, err + return ReceiverClientAcknowledgeEventsResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return AcknowledgeEventsResponse{}, err + return ReceiverClientAcknowledgeEventsResponse{}, err } resp, err := client.acknowledgeEventsHandleResponse(httpResp) return resp, err } // acknowledgeEventsCreateRequest creates the AcknowledgeEvents request. -func (client *ReceiverClient) acknowledgeEventsCreateRequest(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, _ *AcknowledgeEventsOptions) (*policy.Request, error) { +func (client *ReceiverClient) acknowledgeEventsCreateRequest(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, _ *ReceiverClientAcknowledgeEventsOptions) (*policy.Request, error) { host := "{endpoint}" host = strings.ReplaceAll(host, "{endpoint}", client.endpoint) urlPath := "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:acknowledge" @@ -89,10 +86,10 @@ func (client *ReceiverClient) acknowledgeEventsCreateRequest(ctx context.Context } // acknowledgeEventsHandleResponse handles the AcknowledgeEvents response. -func (client *ReceiverClient) acknowledgeEventsHandleResponse(resp *http.Response) (AcknowledgeEventsResponse, error) { - result := AcknowledgeEventsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AcknowledgeEventsResult); err != nil { - return AcknowledgeEventsResponse{}, err +func (client *ReceiverClient) acknowledgeEventsHandleResponse(resp *http.Response) (ReceiverClientAcknowledgeEventsResponse, error) { + result := ReceiverClientAcknowledgeEventsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AcknowledgeResult); err != nil { + return ReceiverClientAcknowledgeEventsResponse{}, err } return result, nil } @@ -104,26 +101,26 @@ func (client *ReceiverClient) acknowledgeEventsHandleResponse(resp *http.Respons // - topicName - Topic Name. // - eventSubscriptionName - Event Subscription Name. // - options - ReceiverClientReceiveEventsOptions contains the optional parameters for the ReceiverClient.ReceiveEvents method. -func (client *ReceiverClient) internalReceiveEvents(ctx context.Context, topicName string, eventSubscriptionName string, options *ReceiveEventsOptions) (ReceiveEventsResponse, error) { +func (client *ReceiverClient) ReceiveEvents(ctx context.Context, topicName string, eventSubscriptionName string, options *ReceiverClientReceiveEventsOptions) (ReceiverClientReceiveEventsResponse, error) { var err error req, err := client.receiveEventsCreateRequest(ctx, topicName, eventSubscriptionName, options) if err != nil { - return ReceiveEventsResponse{}, err + return ReceiverClientReceiveEventsResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ReceiveEventsResponse{}, err + return ReceiverClientReceiveEventsResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return ReceiveEventsResponse{}, err + return ReceiverClientReceiveEventsResponse{}, err } resp, err := client.receiveEventsHandleResponse(httpResp) return resp, err } // receiveEventsCreateRequest creates the ReceiveEvents request. -func (client *ReceiverClient) receiveEventsCreateRequest(ctx context.Context, topicName string, eventSubscriptionName string, options *ReceiveEventsOptions) (*policy.Request, error) { +func (client *ReceiverClient) receiveEventsCreateRequest(ctx context.Context, topicName string, eventSubscriptionName string, options *ReceiverClientReceiveEventsOptions) (*policy.Request, error) { host := "{endpoint}" host = strings.ReplaceAll(host, "{endpoint}", client.endpoint) urlPath := "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:receive" @@ -153,10 +150,10 @@ func (client *ReceiverClient) receiveEventsCreateRequest(ctx context.Context, to } // receiveEventsHandleResponse handles the ReceiveEvents response. -func (client *ReceiverClient) receiveEventsHandleResponse(resp *http.Response) (ReceiveEventsResponse, error) { - result := ReceiveEventsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ReceiveEventsResult); err != nil { - return ReceiveEventsResponse{}, err +func (client *ReceiverClient) receiveEventsHandleResponse(resp *http.Response) (ReceiverClientReceiveEventsResponse, error) { + result := ReceiverClientReceiveEventsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ReceiveResult); err != nil { + return ReceiverClientReceiveEventsResponse{}, err } return result, nil } @@ -171,26 +168,26 @@ func (client *ReceiverClient) receiveEventsHandleResponse(resp *http.Response) ( // - eventSubscriptionName - Event Subscription Name. // - lockTokens - Array of lock tokens. // - options - ReceiverClientRejectEventsOptions contains the optional parameters for the ReceiverClient.RejectEvents method. -func (client *ReceiverClient) internalRejectEvents(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, options *RejectEventsOptions) (RejectEventsResponse, error) { +func (client *ReceiverClient) RejectEvents(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, options *ReceiverClientRejectEventsOptions) (ReceiverClientRejectEventsResponse, error) { var err error req, err := client.rejectEventsCreateRequest(ctx, topicName, eventSubscriptionName, lockTokens, options) if err != nil { - return RejectEventsResponse{}, err + return ReceiverClientRejectEventsResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return RejectEventsResponse{}, err + return ReceiverClientRejectEventsResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return RejectEventsResponse{}, err + return ReceiverClientRejectEventsResponse{}, err } resp, err := client.rejectEventsHandleResponse(httpResp) return resp, err } // rejectEventsCreateRequest creates the RejectEvents request. -func (client *ReceiverClient) rejectEventsCreateRequest(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, _ *RejectEventsOptions) (*policy.Request, error) { +func (client *ReceiverClient) rejectEventsCreateRequest(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, _ *ReceiverClientRejectEventsOptions) (*policy.Request, error) { host := "{endpoint}" host = strings.ReplaceAll(host, "{endpoint}", client.endpoint) urlPath := "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:reject" @@ -223,10 +220,10 @@ func (client *ReceiverClient) rejectEventsCreateRequest(ctx context.Context, top } // rejectEventsHandleResponse handles the RejectEvents response. -func (client *ReceiverClient) rejectEventsHandleResponse(resp *http.Response) (RejectEventsResponse, error) { - result := RejectEventsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RejectEventsResult); err != nil { - return RejectEventsResponse{}, err +func (client *ReceiverClient) rejectEventsHandleResponse(resp *http.Response) (ReceiverClientRejectEventsResponse, error) { + result := ReceiverClientRejectEventsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RejectResult); err != nil { + return ReceiverClientRejectEventsResponse{}, err } return result, nil } @@ -241,26 +238,26 @@ func (client *ReceiverClient) rejectEventsHandleResponse(resp *http.Response) (R // - eventSubscriptionName - Event Subscription Name. // - lockTokens - Array of lock tokens. // - options - ReceiverClientReleaseEventsOptions contains the optional parameters for the ReceiverClient.ReleaseEvents method. -func (client *ReceiverClient) internalReleaseEvents(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, options *ReleaseEventsOptions) (ReleaseEventsResponse, error) { +func (client *ReceiverClient) ReleaseEvents(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, options *ReceiverClientReleaseEventsOptions) (ReceiverClientReleaseEventsResponse, error) { var err error req, err := client.releaseEventsCreateRequest(ctx, topicName, eventSubscriptionName, lockTokens, options) if err != nil { - return ReleaseEventsResponse{}, err + return ReceiverClientReleaseEventsResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return ReleaseEventsResponse{}, err + return ReceiverClientReleaseEventsResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return ReleaseEventsResponse{}, err + return ReceiverClientReleaseEventsResponse{}, err } resp, err := client.releaseEventsHandleResponse(httpResp) return resp, err } // releaseEventsCreateRequest creates the ReleaseEvents request. -func (client *ReceiverClient) releaseEventsCreateRequest(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, options *ReleaseEventsOptions) (*policy.Request, error) { +func (client *ReceiverClient) releaseEventsCreateRequest(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, options *ReceiverClientReleaseEventsOptions) (*policy.Request, error) { host := "{endpoint}" host = strings.ReplaceAll(host, "{endpoint}", client.endpoint) urlPath := "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:release" @@ -296,10 +293,10 @@ func (client *ReceiverClient) releaseEventsCreateRequest(ctx context.Context, to } // releaseEventsHandleResponse handles the ReleaseEvents response. -func (client *ReceiverClient) releaseEventsHandleResponse(resp *http.Response) (ReleaseEventsResponse, error) { - result := ReleaseEventsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ReleaseEventsResult); err != nil { - return ReleaseEventsResponse{}, err +func (client *ReceiverClient) releaseEventsHandleResponse(resp *http.Response) (ReceiverClientReleaseEventsResponse, error) { + result := ReceiverClientReleaseEventsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ReleaseResult); err != nil { + return ReceiverClientReleaseEventsResponse{}, err } return result, nil } @@ -315,26 +312,26 @@ func (client *ReceiverClient) releaseEventsHandleResponse(resp *http.Response) ( // - lockTokens - Array of lock tokens. // - options - ReceiverClientRenewEventLocksOptions contains the optional parameters for the ReceiverClient.RenewEventLocks // method. -func (client *ReceiverClient) internalRenewEventLocks(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, options *RenewEventLocksOptions) (RenewEventLocksResponse, error) { +func (client *ReceiverClient) RenewEventLocks(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, options *ReceiverClientRenewEventLocksOptions) (ReceiverClientRenewEventLocksResponse, error) { var err error req, err := client.renewEventLocksCreateRequest(ctx, topicName, eventSubscriptionName, lockTokens, options) if err != nil { - return RenewEventLocksResponse{}, err + return ReceiverClientRenewEventLocksResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return RenewEventLocksResponse{}, err + return ReceiverClientRenewEventLocksResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return RenewEventLocksResponse{}, err + return ReceiverClientRenewEventLocksResponse{}, err } resp, err := client.renewEventLocksHandleResponse(httpResp) return resp, err } // renewEventLocksCreateRequest creates the RenewEventLocks request. -func (client *ReceiverClient) renewEventLocksCreateRequest(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, _ *RenewEventLocksOptions) (*policy.Request, error) { +func (client *ReceiverClient) renewEventLocksCreateRequest(ctx context.Context, topicName string, eventSubscriptionName string, lockTokens []string, _ *ReceiverClientRenewEventLocksOptions) (*policy.Request, error) { host := "{endpoint}" host = strings.ReplaceAll(host, "{endpoint}", client.endpoint) urlPath := "/topics/{topicName}/eventsubscriptions/{eventSubscriptionName}:renewLock" @@ -367,10 +364,10 @@ func (client *ReceiverClient) renewEventLocksCreateRequest(ctx context.Context, } // renewEventLocksHandleResponse handles the RenewEventLocks response. -func (client *ReceiverClient) renewEventLocksHandleResponse(resp *http.Response) (RenewEventLocksResponse, error) { - result := RenewEventLocksResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.RenewEventLocksResult); err != nil { - return RenewEventLocksResponse{}, err +func (client *ReceiverClient) renewEventLocksHandleResponse(resp *http.Response) (ReceiverClientRenewEventLocksResponse, error) { + result := ReceiverClientRenewEventLocksResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RenewLocksResult); err != nil { + return ReceiverClientRenewEventLocksResponse{}, err } return result, nil } diff --git a/sdk/messaging/eventgrid/aznamespaces/receiver_client_custom.go b/sdk/messaging/eventgrid/aznamespaces/receiver_client_custom.go deleted file mode 100644 index 66ea3354ac6b..000000000000 --- a/sdk/messaging/eventgrid/aznamespaces/receiver_client_custom.go +++ /dev/null @@ -1,140 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. - -package aznamespaces - -import ( - "context" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces/internal" -) - -// ReceiverClientOptions contains the optional parameters when creating a ReceiverClient. -type ReceiverClientOptions struct { - azcore.ClientOptions -} - -// NewReceiverClient creates a [ReceiverClient] which uses an azcore.TokenCredential for authentication. -// - topicName - Topic Name. -// - subscriptionName - Event Subscription Name. -func NewReceiverClient(endpoint string, topic string, subscription string, cred azcore.TokenCredential, options *ReceiverClientOptions) (*ReceiverClient, error) { - if options == nil { - options = &ReceiverClientOptions{} - } - - azc, err := azcore.NewClient(internal.ModuleName+".Client", internal.ModuleVersion, runtime.PipelineOptions{ - PerRetry: []policy.Policy{ - runtime.NewBearerTokenPolicy(cred, []string{authScope}, nil), - }, - }, &options.ClientOptions) - - if err != nil { - return nil, err - } - - return &ReceiverClient{ - internal: azc, - endpoint: endpoint, - data: receiverData{ - topic: topic, - subscription: subscription, - }, - }, nil -} - -// NewReceiverClientWithSharedKeyCredential creates a [ReceiverClient] using a shared key. -// - topicName - Topic Name. -// - subscriptionName - Event Subscription Name. -func NewReceiverClientWithSharedKeyCredential(endpoint string, topic string, subscription string, keyCred *azcore.KeyCredential, options *ReceiverClientOptions) (*ReceiverClient, error) { - if options == nil { - options = &ReceiverClientOptions{} - } - - azc, err := azcore.NewClient(internal.ModuleName+".Client", internal.ModuleVersion, runtime.PipelineOptions{ - PerRetry: []policy.Policy{ - runtime.NewKeyCredentialPolicy(keyCred, "Authorization", &runtime.KeyCredentialPolicyOptions{ - Prefix: "SharedAccessKey ", - }), - }, - }, &options.ClientOptions) - - if err != nil { - return nil, err - } - - return &ReceiverClient{ - internal: azc, - endpoint: endpoint, - data: receiverData{ - topic: topic, - subscription: subscription, - }, - }, nil -} - -// RejectEvents rejects a batch of Cloud Events. The server responds with an HTTP 200 status code if the request is successfully -// accepted. The response body will include the set of successfully rejected lockTokens, -// along with other failed lockTokens with their corresponding error information. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-06-01 -// - lockTokens - slice of lock tokens. -// - options - RejectEventsOptions contains the optional parameters for the ReceiverClient.RejectEvents method. -func (client *ReceiverClient) RejectEvents(ctx context.Context, lockTokens []string, options *RejectEventsOptions) (RejectEventsResponse, error) { - return client.internalRejectEvents(ctx, client.data.topic, client.data.subscription, lockTokens, options) -} - -// AcknowledgeEvents acknowledges a batch of Cloud Events. The server responds with an HTTP 200 status code if the request -// is successfully accepted. The response body will include the set of successfully acknowledged -// lockTokens, along with other failed lockTokens with their corresponding error information. Successfully acknowledged events -// will no longer be available to any consumer. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-06-01 -// - lockTokens - slice of lock tokens. -// - options - AcknowledgeEventsOptions contains the optional parameters for the ReceiverClient.AcknowledgeEvents method. -func (client *ReceiverClient) AcknowledgeEvents(ctx context.Context, lockTokens []string, options *AcknowledgeEventsOptions) (AcknowledgeEventsResponse, error) { - return client.internalAcknowledgeEvents(ctx, client.data.topic, client.data.subscription, lockTokens, options) -} - -// ReleaseEvents releases a batch of Cloud Events. The server responds with an HTTP 200 status code if the request is -// successfully accepted. The response body will include the set of successfully released lockTokens, -// along with other failed lockTokens with their corresponding error information. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-06-01 -// - lockTokens - slice of lock tokens. -// - options - ReleaseEventsOptions contains the optional parameters for the ReceiverClient.ReleaseEvents method. -func (client *ReceiverClient) ReleaseEvents(ctx context.Context, lockTokens []string, options *ReleaseEventsOptions) (ReleaseEventsResponse, error) { - return client.internalReleaseEvents(ctx, client.data.topic, client.data.subscription, lockTokens, options) -} - -// RenewEventLocks renews locks for batch of Cloud Events. The server responds with an HTTP 200 status code if the request -// is successfully accepted. The response body will include the set of successfully renewed -// lockTokens, along with other failed lockTokens with their corresponding error information. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-06-01 -// - lockTokens - slice of lock tokens. -// - options - RenewLocksOptions contains the optional parameters for the ReceiverClient.RenewLocks method. -func (client *ReceiverClient) RenewEventLocks(ctx context.Context, lockTokens []string, options *RenewEventLocksOptions) (RenewEventLocksResponse, error) { - return client.internalRenewEventLocks(ctx, client.data.topic, client.data.subscription, lockTokens, options) -} - -// ReceiveEvents receives a batch of Cloud Events from a subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-06-01 -// - options - ReceiveEventsOptions contains the optional parameters for the ReceiverClient.ReceiveEvents method. -func (client *ReceiverClient) ReceiveEvents(ctx context.Context, options *ReceiveEventsOptions) (ReceiveEventsResponse, error) { - return client.internalReceiveEvents(ctx, client.data.topic, client.data.subscription, options) -} - -type receiverData struct { - topic string - subscription string -} diff --git a/sdk/messaging/eventgrid/aznamespaces/responses.go b/sdk/messaging/eventgrid/aznamespaces/responses.go index 55700b10b61e..c2e3e7f9f677 100644 --- a/sdk/messaging/eventgrid/aznamespaces/responses.go +++ b/sdk/messaging/eventgrid/aznamespaces/responses.go @@ -4,40 +4,44 @@ package aznamespaces -// AcknowledgeEventsResponse contains the response from method ReceiverClient.AcknowledgeEvents. -type AcknowledgeEventsResponse struct { +// ReceiverClientAcknowledgeEventsResponse contains the response from method ReceiverClient.AcknowledgeEvents. +type ReceiverClientAcknowledgeEventsResponse struct { // The result of the Acknowledge operation. - AcknowledgeEventsResult + AcknowledgeResult } -// ReceiveEventsResponse contains the response from method ReceiverClient.ReceiveEvents. -type ReceiveEventsResponse struct { +// ReceiverClientReceiveEventsResponse contains the response from method ReceiverClient.ReceiveEvents. +type ReceiverClientReceiveEventsResponse struct { // Details of the Receive operation response. - ReceiveEventsResult + ReceiveResult } -// RejectEventsResponse contains the response from method ReceiverClient.RejectEvents. -type RejectEventsResponse struct { +// ReceiverClientRejectEventsResponse contains the response from method ReceiverClient.RejectEvents. +type ReceiverClientRejectEventsResponse struct { // The result of the Reject operation. - RejectEventsResult + RejectResult } -// ReleaseEventsResponse contains the response from method ReceiverClient.ReleaseEvents. -type ReleaseEventsResponse struct { +// ReceiverClientReleaseEventsResponse contains the response from method ReceiverClient.ReleaseEvents. +type ReceiverClientReleaseEventsResponse struct { // The result of the Release operation. - ReleaseEventsResult + ReleaseResult } -// RenewEventLocksResponse contains the response from method ReceiverClient.RenewEventLocks. -type RenewEventLocksResponse struct { +// ReceiverClientRenewEventLocksResponse contains the response from method ReceiverClient.RenewEventLocks. +type ReceiverClientRenewEventLocksResponse struct { // The result of the RenewLock operation. - RenewEventLocksResult + RenewLocksResult } -// SendEventResponse contains the response from method SenderClient.SendEvent. -type SendEventResponse struct { +// SenderClientSendEventResponse contains the response from method SenderClient.SendEvent. +type SenderClientSendEventResponse struct { + // The result of the Publish operation. + PublishResult } -// SendEventsResponse contains the response from method SenderClient.SendEvents. -type SendEventsResponse struct { +// SenderClientSendEventsResponse contains the response from method SenderClient.SendEvents. +type SenderClientSendEventsResponse struct { + // The result of the Publish operation. + PublishResult } diff --git a/sdk/messaging/eventgrid/aznamespaces/sender_client.go b/sdk/messaging/eventgrid/aznamespaces/sender_client.go index 31c41ae19142..c973630383d8 100644 --- a/sdk/messaging/eventgrid/aznamespaces/sender_client.go +++ b/sdk/messaging/eventgrid/aznamespaces/sender_client.go @@ -7,21 +7,17 @@ package aznamespaces import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/messaging" "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" ) // SenderClient contains the methods for the Sender group. // Don't use this type directly, use a constructor function instead. type SenderClient struct { - data senderData - internal *azcore.Client endpoint string } @@ -33,26 +29,26 @@ type SenderClient struct { // - topicName - Topic Name. // - event - Single Cloud Event being published. // - options - SenderClientSendEventOptions contains the optional parameters for the SenderClient.SendEvent method. -func (client *SenderClient) internalSendEvent(ctx context.Context, topicName string, event *messaging.CloudEvent, options *SendEventOptions) (SendEventResponse, error) { +func (client *SenderClient) SendEvent(ctx context.Context, topicName string, event CloudEvent, options *SenderClientSendEventOptions) (SenderClientSendEventResponse, error) { var err error req, err := client.sendEventCreateRequest(ctx, topicName, event, options) if err != nil { - return SendEventResponse{}, err + return SenderClientSendEventResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return SendEventResponse{}, err + return SenderClientSendEventResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return SendEventResponse{}, err + return SenderClientSendEventResponse{}, err } resp, err := client.sendEventHandleResponse(httpResp) return resp, err } // sendEventCreateRequest creates the SendEvent request. -func (client *SenderClient) sendEventCreateRequest(ctx context.Context, topicName string, event *messaging.CloudEvent, _ *SendEventOptions) (*policy.Request, error) { +func (client *SenderClient) sendEventCreateRequest(ctx context.Context, topicName string, event CloudEvent, _ *SenderClientSendEventOptions) (*policy.Request, error) { host := "{endpoint}" host = strings.ReplaceAll(host, "{endpoint}", client.endpoint) urlPath := "/topics/{topicName}:publish" @@ -76,8 +72,11 @@ func (client *SenderClient) sendEventCreateRequest(ctx context.Context, topicNam } // sendEventHandleResponse handles the SendEvent response. -func (client *SenderClient) sendEventHandleResponse(_ *http.Response) (SendEventResponse, error) { - result := SendEventResponse{} +func (client *SenderClient) sendEventHandleResponse(resp *http.Response) (SenderClientSendEventResponse, error) { + result := SenderClientSendEventResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublishResult); err != nil { + return SenderClientSendEventResponse{}, err + } return result, nil } @@ -88,26 +87,26 @@ func (client *SenderClient) sendEventHandleResponse(_ *http.Response) (SendEvent // - topicName - Topic Name. // - events - Array of Cloud Events being published. // - options - SenderClientSendEventsOptions contains the optional parameters for the SenderClient.SendEvents method. -func (client *SenderClient) internalSendEvents(ctx context.Context, topicName string, events []*messaging.CloudEvent, options *SendEventsOptions) (SendEventsResponse, error) { +func (client *SenderClient) SendEvents(ctx context.Context, topicName string, events []CloudEvent, options *SenderClientSendEventsOptions) (SenderClientSendEventsResponse, error) { var err error req, err := client.sendEventsCreateRequest(ctx, topicName, events, options) if err != nil { - return SendEventsResponse{}, err + return SenderClientSendEventsResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return SendEventsResponse{}, err + return SenderClientSendEventsResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return SendEventsResponse{}, err + return SenderClientSendEventsResponse{}, err } resp, err := client.sendEventsHandleResponse(httpResp) return resp, err } // sendEventsCreateRequest creates the SendEvents request. -func (client *SenderClient) sendEventsCreateRequest(ctx context.Context, topicName string, events []*messaging.CloudEvent, _ *SendEventsOptions) (*policy.Request, error) { +func (client *SenderClient) sendEventsCreateRequest(ctx context.Context, topicName string, events []CloudEvent, _ *SenderClientSendEventsOptions) (*policy.Request, error) { host := "{endpoint}" host = strings.ReplaceAll(host, "{endpoint}", client.endpoint) urlPath := "/topics/{topicName}:publish" @@ -131,7 +130,10 @@ func (client *SenderClient) sendEventsCreateRequest(ctx context.Context, topicNa } // sendEventsHandleResponse handles the SendEvents response. -func (client *SenderClient) sendEventsHandleResponse(_ *http.Response) (SendEventsResponse, error) { - result := SendEventsResponse{} +func (client *SenderClient) sendEventsHandleResponse(resp *http.Response) (SenderClientSendEventsResponse, error) { + result := SenderClientSendEventsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PublishResult); err != nil { + return SenderClientSendEventsResponse{}, err + } return result, nil } diff --git a/sdk/messaging/eventgrid/aznamespaces/sender_client_custom.go b/sdk/messaging/eventgrid/aznamespaces/sender_client_custom.go deleted file mode 100644 index e2c45685d817..000000000000 --- a/sdk/messaging/eventgrid/aznamespaces/sender_client_custom.go +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. - -package aznamespaces - -import ( - "context" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/messaging" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/messaging/eventgrid/aznamespaces/internal" -) - -// SenderClientOptions contains the optional parameters when creating a SenderClient. -type SenderClientOptions struct { - azcore.ClientOptions -} - -// NewSenderClient creates a [SenderClient] which uses an azcore.TokenCredential for authentication. -func NewSenderClient(endpoint string, topic string, cred azcore.TokenCredential, options *SenderClientOptions) (*SenderClient, error) { - if options == nil { - options = &SenderClientOptions{} - } - - azc, err := azcore.NewClient(internal.ModuleName+".Client", internal.ModuleVersion, runtime.PipelineOptions{ - PerRetry: []policy.Policy{ - runtime.NewBearerTokenPolicy(cred, []string{authScope}, nil), - }, - }, &options.ClientOptions) - - if err != nil { - return nil, err - } - - return &SenderClient{ - internal: azc, - endpoint: endpoint, - data: senderData{ - Topic: topic, - }, - }, nil -} - -// NewSenderClientWithSharedKeyCredential creates a [SenderClient] using a shared key. -func NewSenderClientWithSharedKeyCredential(endpoint string, topic string, keyCred *azcore.KeyCredential, options *SenderClientOptions) (*SenderClient, error) { - if options == nil { - options = &SenderClientOptions{} - } - - azc, err := azcore.NewClient(internal.ModuleName+".Client", internal.ModuleVersion, runtime.PipelineOptions{ - PerRetry: []policy.Policy{ - runtime.NewKeyCredentialPolicy(keyCred, "Authorization", &runtime.KeyCredentialPolicyOptions{ - Prefix: "SharedAccessKey ", - }), - }, - }, &options.ClientOptions) - - if err != nil { - return nil, err - } - - return &SenderClient{ - internal: azc, - endpoint: endpoint, - data: senderData{ - Topic: topic, - }, - }, nil -} - -type senderData struct { - Topic string -} - -// SendEvent publishes a single Cloud Event to a namespace topic. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-06-01 -// - event - Cloud Event to publish. -// - options - SendOptions contains the optional parameters for the SenderClient.SendEvent method. -func (client *SenderClient) SendEvent(ctx context.Context, event *messaging.CloudEvent, options *SendEventOptions) (SendEventResponse, error) { - return client.internalSendEvent(ctx, client.data.Topic, event, options) -} - -// SendEvents publishes a batch of Cloud Events to a namespace topic. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-06-01 -// - events - slice of Cloud Events to publish. -// - options - SendEventsOptions contains the optional parameters for the SenderClient.SendEvents method. -func (client *SenderClient) SendEvents(ctx context.Context, events []*messaging.CloudEvent, options *SendEventsOptions) (SendEventsResponse, error) { - return client.internalSendEvents(ctx, client.data.Topic, events, options) -} diff --git a/sdk/messaging/eventgrid/aznamespaces/time_rfc3339.go b/sdk/messaging/eventgrid/aznamespaces/time_rfc3339.go index 9fa0bee9e256..6e37ba42202d 100644 --- a/sdk/messaging/eventgrid/aznamespaces/time_rfc3339.go +++ b/sdk/messaging/eventgrid/aznamespaces/time_rfc3339.go @@ -7,12 +7,11 @@ package aznamespaces import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "regexp" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. diff --git a/sdk/messaging/eventgrid/aznamespaces/tsp-location.yaml b/sdk/messaging/eventgrid/aznamespaces/tsp-location.yaml index a9f6493d90e4..e06cbbe826bf 100644 --- a/sdk/messaging/eventgrid/aznamespaces/tsp-location.yaml +++ b/sdk/messaging/eventgrid/aznamespaces/tsp-location.yaml @@ -1,3 +1,4 @@ directory: specification/eventgrid/Azure.Messaging.EventGrid -commit: 8d6deb81acb126a071f6f7dbf18d87a49a82e7e2 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/messaging/eventgrid/azsystemevents/CHANGELOG.md b/sdk/messaging/eventgrid/azsystemevents/CHANGELOG.md index ac40b2915569..b3de2f5f04d8 100644 --- a/sdk/messaging/eventgrid/azsystemevents/CHANGELOG.md +++ b/sdk/messaging/eventgrid/azsystemevents/CHANGELOG.md @@ -1,5 +1,69 @@ # Release History +## 1.0.0 (2025-05-13) +### Breaking Changes + +- Type of `ACSMessageDeliveryStatusUpdatedEventData.Error` has been changed from `*Error` to `*InternalACSMessageChannelEventError` +- Type of `ACSMessageReceivedEventData.Error` has been changed from `*Error` to `*InternalACSMessageChannelEventError` +- Type of `ACSRouterJobClassificationFailedEventData.Errors` has been changed from `[]*Error` to `[]InternalACSRouterCommunicationError` + +### Features Added + +- New value `TypeACSCallEnded`, `TypeACSCallParticipantAdded`, `TypeACSCallParticipantRemoved`, `TypeACSCallStarted`, `TypeACSChatAzureBotCommandReceivedInThread`, `TypeACSChatTypingIndicatorReceivedInThread` added to enum type `string` +- New enum type `ACSCallEndedByKind` with values `ACSCallEndedByKindMicrosoftInternal`, `ACSCallEndedByKindParticipant` +- New enum type `ACSCallParticipantRoleKind` with values `ACSCallParticipantRoleKindAttendee`, `ACSCallParticipantRoleKindCollaborator`, `ACSCallParticipantRoleKindConsumer`, `ACSCallParticipantRoleKindOrganizer`, `ACSCallParticipantRoleKindPresenter` +- New struct `ACSCallEndReasonProperties` +- New struct `ACSCallEndedByProperties` +- New struct `ACSCallEndedEventData` +- New struct `ACSCallGroupProperties` +- New struct `ACSCallParticipantAddedEventData` +- New struct `ACSCallParticipantEventProperties` +- New struct `ACSCallParticipantProperties` +- New struct `ACSCallParticipantRemovedEventData` +- New struct `ACSCallRoomProperties` +- New struct `ACSCallStartedEventData` +- New struct `ACSCallingEventProperties` +- New struct `ACSChatAzureBotCommandReceivedInThreadEventData` +- New struct `ACSChatEventBaseProperties` +- New struct `ACSChatEventInThreadBaseProperties` +- New struct `ACSChatMessageEventBaseProperties` +- New struct `ACSChatMessageEventInThreadBaseProperties` +- New struct `ACSChatThreadEventBaseProperties` +- New struct `ACSChatThreadEventInThreadBaseProperties` +- New struct `ACSChatTypingIndicatorReceivedInThreadEventData` +- New struct `ACSMessageEventData` +- New struct `ACSRouterEventData` +- New struct `ACSRouterJobEventData` +- New struct `ACSRouterWorkerEventData` +- New struct `ACSSMSEventBaseProperties` +- New struct `APIManagementCircuitBreakerClosedEventData` +- New struct `APIManagementCircuitBreakerOpenedEventData` +- New struct `APIManagementCircuitBreakerProperties` +- New struct `APIManagementExpiredGatewayTokenProperties` +- New struct `APIManagementGatewayProperties` +- New struct `APIManagementGatewayTokenExpiredEventData` +- New struct `APIManagementGatewayTokenNearExpiryEventData` +- New struct `APIManagementNearExpiryGatewayTokenProperties` +- New struct `AVSClusterEventData` +- New struct `AVSPrivateCloudEventData` +- New struct `AVSScriptExecutionEventData` +- New struct `AppConfigurationSnapshotEventData` +- New struct `ContainerRegistryArtifactEventData` +- New struct `ContainerRegistryEventData` +- New struct `ContainerServiceClusterSupportEventData` +- New struct `ContainerServiceNodePoolRollingEventData` +- New struct `DeviceConnectionStateEventProperties` +- New struct `DeviceLifeCycleEventProperties` +- New struct `DeviceTelemetryEventProperties` +- New struct `EdgeSolutionVersionPublishedEventData` +- New struct `EventGridMQTTClientEventData` +- New struct `InternalACSMessageChannelEventError` +- New struct `InternalACSRouterCommunicationError` +- New struct `MapsGeofenceEventProperties` +- New struct `ResourceNotificationsResourceDeletedEventData` +- New struct `ResourceNotificationsResourceUpdatedEventData` + + ## 0.6.2 (2025-05-06) ### Features Added diff --git a/sdk/messaging/eventgrid/azsystemevents/build.go b/sdk/messaging/eventgrid/azsystemevents/build.go deleted file mode 100644 index e22b15cc1977..000000000000 --- a/sdk/messaging/eventgrid/azsystemevents/build.go +++ /dev/null @@ -1,12 +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. - -//go:generate tsp-client update -//go:generate goimports -w . -//go:generate go run ./internal/generate -//go:generate goimports -w ./.. - -package azsystemevents diff --git a/sdk/messaging/eventgrid/azsystemevents/constants.go b/sdk/messaging/eventgrid/azsystemevents/constants.go index f4437dd1f2b7..4531df1142cb 100644 --- a/sdk/messaging/eventgrid/azsystemevents/constants.go +++ b/sdk/messaging/eventgrid/azsystemevents/constants.go @@ -22,6 +22,33 @@ func PossibleACSCallEndedByKindValues() []ACSCallEndedByKind { } } +// ACSCallParticipantRoleKind - Call participant role kind. +type ACSCallParticipantRoleKind string + +const ( + // ACSCallParticipantRoleKindAttendee - Attendee + ACSCallParticipantRoleKindAttendee ACSCallParticipantRoleKind = "Attendee" + // ACSCallParticipantRoleKindCollaborator - Collaborator + ACSCallParticipantRoleKindCollaborator ACSCallParticipantRoleKind = "Collaborator" + // ACSCallParticipantRoleKindConsumer - Consumer + ACSCallParticipantRoleKindConsumer ACSCallParticipantRoleKind = "Consumer" + // ACSCallParticipantRoleKindOrganizer - Organizer + ACSCallParticipantRoleKindOrganizer ACSCallParticipantRoleKind = "Organizer" + // ACSCallParticipantRoleKindPresenter - Presenter + ACSCallParticipantRoleKindPresenter ACSCallParticipantRoleKind = "Presenter" +) + +// PossibleACSCallParticipantRoleKindValues returns the possible values for the ACSCallParticipantRoleKind const type. +func PossibleACSCallParticipantRoleKindValues() []ACSCallParticipantRoleKind { + return []ACSCallParticipantRoleKind{ + ACSCallParticipantRoleKindAttendee, + ACSCallParticipantRoleKindCollaborator, + ACSCallParticipantRoleKindConsumer, + ACSCallParticipantRoleKindOrganizer, + ACSCallParticipantRoleKindPresenter, + } +} + // ACSEmailDeliveryReportStatus - The status of the email. Any value other than Delivered is considered failed. type ACSEmailDeliveryReportStatus string diff --git a/sdk/messaging/eventgrid/azsystemevents/models.go b/sdk/messaging/eventgrid/azsystemevents/models.go index 60e62244b03b..b59df0b92786 100644 --- a/sdk/messaging/eventgrid/azsystemevents/models.go +++ b/sdk/messaging/eventgrid/azsystemevents/models.go @@ -18,7 +18,7 @@ type ACSCallEndReasonProperties struct { SubCode *int32 } -// ACSCallEndedByProperties - Schema of calling event endedby properties +// ACSCallEndedByProperties - Schema of calling event ended by properties type ACSCallEndedByProperties struct { // REQUIRED; The communication identifier of the call ended by CommunicationIdentifier *CommunicationIdentifierModel @@ -148,7 +148,7 @@ type ACSCallParticipantProperties struct { CommunicationIdentifier *CommunicationIdentifierModel // The role of the participant - Role *string + Role *ACSCallParticipantRoleKind } // ACSCallParticipantRemovedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.CallParticipantRemoved @@ -276,6 +276,27 @@ type ACSChatAzureBotCommandReceivedInThreadEventData struct { TransactionID *string } +// ACSChatEventBaseProperties - Schema of common properties of all chat events +type ACSChatEventBaseProperties struct { + // REQUIRED; The communication identifier of the target user + RecipientCommunicationIdentifier *CommunicationIdentifierModel + + // REQUIRED; The chat thread id + ThreadID *string + + // The transaction id will be used as co-relation vector + TransactionID *string +} + +// ACSChatEventInThreadBaseProperties - Schema of common properties of all thread-level chat events +type ACSChatEventInThreadBaseProperties struct { + // REQUIRED; The chat thread id + ThreadID *string + + // The transaction id will be used as co-relation vector + TransactionID *string +} + // ACSChatMessageDeletedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatMessageDeleted // event. type ACSChatMessageDeletedEventData struct { @@ -418,6 +439,63 @@ type ACSChatMessageEditedInThreadEventData struct { TransactionID *string } +// ACSChatMessageEventBaseProperties - Schema of common properties of all chat message events +type ACSChatMessageEventBaseProperties struct { + // REQUIRED; The original compose time of the message + ComposeTime *time.Time + + // REQUIRED; The chat message id + MessageID *string + + // REQUIRED; The communication identifier of the target user + RecipientCommunicationIdentifier *CommunicationIdentifierModel + + // REQUIRED; The communication identifier of the sender + SenderCommunicationIdentifier *CommunicationIdentifierModel + + // REQUIRED; The chat thread id + ThreadID *string + + // REQUIRED; The type of the message + Type *string + + // REQUIRED; The version of the message + Version *int64 + + // The display name of the sender + SenderDisplayName *string + + // The transaction id will be used as co-relation vector + TransactionID *string +} + +// ACSChatMessageEventInThreadBaseProperties - Schema of common properties of all thread-level chat message events +type ACSChatMessageEventInThreadBaseProperties struct { + // REQUIRED; The original compose time of the message + ComposeTime *time.Time + + // REQUIRED; The chat message id + MessageID *string + + // REQUIRED; The communication identifier of the sender + SenderCommunicationIdentifier *CommunicationIdentifierModel + + // REQUIRED; The chat thread id + ThreadID *string + + // REQUIRED; The type of the message + Type *string + + // REQUIRED; The version of the message + Version *int64 + + // The display name of the sender + SenderDisplayName *string + + // The transaction id will be used as co-relation vector + TransactionID *string +} + // ACSChatMessageReceivedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatMessageReceived // event. type ACSChatMessageReceivedEventData struct { @@ -598,15 +676,15 @@ type ACSChatThreadCreatedEventData struct { // REQUIRED; The communication identifier of the user who created the thread CreatedByCommunicationIdentifier *CommunicationIdentifierModel - // REQUIRED; The list of properties of participants who are part of the thread - Participants []ACSChatThreadParticipantProperties - // REQUIRED; The thread properties Properties map[string]any // REQUIRED; The chat thread id ThreadID *string + // READ-ONLY; The list of properties of participants who are part of the thread + Participants []ACSChatThreadParticipantProperties + // The thread metadata Metadata map[string]*string @@ -626,9 +704,6 @@ type ACSChatThreadCreatedWithUserEventData struct { // REQUIRED; The communication identifier of the user who created the thread CreatedByCommunicationIdentifier *CommunicationIdentifierModel - // REQUIRED; The list of properties of participants who are part of the thread - Participants []ACSChatThreadParticipantProperties - // REQUIRED; The thread properties Properties map[string]any @@ -638,14 +713,17 @@ type ACSChatThreadCreatedWithUserEventData struct { // REQUIRED; The chat thread id ThreadID *string - // The thread metadata - Metadata map[string]*string - // The transaction id will be used as co-relation vector TransactionID *string // The version of the thread Version *int64 + + // READ-ONLY; The list of properties of participants who are part of the thread + Participants []ACSChatThreadParticipantProperties + + // The thread metadata + Metadata map[string]*string } // ACSChatThreadDeletedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.ChatThreadDeleted @@ -670,6 +748,39 @@ type ACSChatThreadDeletedEventData struct { Version *int64 } +// ACSChatThreadEventBaseProperties - Schema of common properties of all chat thread events +type ACSChatThreadEventBaseProperties struct { + // REQUIRED; The original creation time of the thread + CreateTime *time.Time + + // REQUIRED; The communication identifier of the target user + RecipientCommunicationIdentifier *CommunicationIdentifierModel + + // REQUIRED; The chat thread id + ThreadID *string + + // The transaction id will be used as co-relation vector + TransactionID *string + + // The version of the thread + Version *int64 +} + +// ACSChatThreadEventInThreadBaseProperties - Schema of common properties of all chat thread events +type ACSChatThreadEventInThreadBaseProperties struct { + // REQUIRED; The original creation time of the thread + CreateTime *time.Time + + // REQUIRED; The chat thread id + ThreadID *string + + // The transaction id will be used as co-relation vector + TransactionID *string + + // The version of the thread + Version *int64 +} + // ACSChatThreadParticipantProperties - Schema of the chat thread participant type ACSChatThreadParticipantProperties struct { // REQUIRED; The communication identifier of the user @@ -933,12 +1044,27 @@ type ACSMessageDeliveryStatusUpdatedEventData struct { To *string // The channel event error - Error *Error + Error *InternalACSMessageChannelEventError // The message id MessageID *string } +// ACSMessageEventData - Schema of common properties of all chat thread events +type ACSMessageEventData struct { + // REQUIRED; The message sender + From *string + + // REQUIRED; The time message was received + ReceivedTimestamp *time.Time + + // REQUIRED; The message recipient + To *string + + // The channel event error + Error *InternalACSMessageChannelEventError +} + // ACSMessageInteractiveButtonReplyContent - Message Interactive button reply content for a user to business message type ACSMessageInteractiveButtonReplyContent struct { // The ID of the button @@ -1027,7 +1153,7 @@ type ACSMessageReceivedEventData struct { Context *ACSMessageContext // The channel event error - Error *Error + Error *InternalACSMessageChannelEventError // Optional. The received message interactive content InteractiveContent *ACSMessageInteractiveContent @@ -1090,7 +1216,7 @@ type ACSRecordingFileStatusUpdatedEventData struct { // ACSRecordingStorageInfoProperties - Schema for all properties of Recording Storage Information. type ACSRecordingStorageInfoProperties struct { - // REQUIRED; List of details of recording chunks information + // READ-ONLY; List of details of recording chunks information RecordingChunks []ACSRecordingChunkInfoProperties } @@ -1106,6 +1232,18 @@ type ACSRouterChannelConfiguration struct { MaxNumberOfJobs *int32 } +// ACSRouterEventData - Schema of common properties of all Router events +type ACSRouterEventData struct { + // REQUIRED; Router Event Job ID + JobID *string + + // Router Event Channel ID + ChannelID *string + + // Router Event Channel Reference + ChannelReference *string +} + // ACSRouterJobCancelledEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobCancelled // event type ACSRouterJobCancelledEventData struct { @@ -1137,9 +1275,6 @@ type ACSRouterJobCancelledEventData struct { // ACSRouterJobClassificationFailedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobClassificationFailed // event type ACSRouterJobClassificationFailedEventData struct { - // REQUIRED; Router Job Classification Failed Errors - Errors []*Error - // REQUIRED; Router Event Job ID JobID *string @@ -1149,6 +1284,9 @@ type ACSRouterJobClassificationFailedEventData struct { // REQUIRED; Router Jobs events Tags Tags map[string]*string + // READ-ONLY; Router Job Classification Failed Errors + Errors []InternalACSRouterCommunicationError + // Router Event Channel ID ChannelID *string @@ -1165,9 +1303,6 @@ type ACSRouterJobClassificationFailedEventData struct { // ACSRouterJobClassifiedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobClassified // event type ACSRouterJobClassifiedEventData struct { - // REQUIRED; Router Job Attached Worker Selector - AttachedWorkerSelectors []ACSRouterWorkerSelector - // REQUIRED; Router Event Job ID JobID *string @@ -1194,6 +1329,9 @@ type ACSRouterJobClassifiedEventData struct { // Router Job events Queue Id QueueID *string + + // READ-ONLY; Router Job Attached Worker Selector + AttachedWorkerSelectors []ACSRouterWorkerSelector } // ACSRouterJobClosedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobClosed @@ -1277,6 +1415,27 @@ type ACSRouterJobDeletedEventData struct { QueueID *string } +// ACSRouterJobEventData - Schema of common properties of all Router Job events +type ACSRouterJobEventData struct { + // REQUIRED; Router Event Job ID + JobID *string + + // REQUIRED; Router Job events Labels + Labels map[string]*string + + // REQUIRED; Router Jobs events Tags + Tags map[string]*string + + // Router Event Channel ID + ChannelID *string + + // Router Event Channel Reference + ChannelReference *string + + // Router Job events Queue Id + QueueID *string +} + // ACSRouterJobExceptionTriggeredEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobExceptionTriggered // event type ACSRouterJobExceptionTriggeredEventData struct { @@ -1308,9 +1467,6 @@ type ACSRouterJobExceptionTriggeredEventData struct { // ACSRouterJobQueuedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobQueued // event type ACSRouterJobQueuedEventData struct { - // REQUIRED; Router Job Queued Attached Worker Selector - AttachedWorkerSelectors []ACSRouterWorkerSelector - // REQUIRED; Router Event Job ID JobID *string @@ -1320,12 +1476,12 @@ type ACSRouterJobQueuedEventData struct { // REQUIRED; Router Job Priority Priority *int32 - // REQUIRED; Router Job Queued Requested Worker Selector - RequestedWorkerSelectors []ACSRouterWorkerSelector - // REQUIRED; Router Jobs events Tags Tags map[string]*string + // READ-ONLY; Router Job Queued Requested Worker Selector + RequestedWorkerSelectors []ACSRouterWorkerSelector + // Router Event Channel ID ChannelID *string @@ -1334,6 +1490,9 @@ type ACSRouterJobQueuedEventData struct { // Router Job events Queue Id QueueID *string + + // READ-ONLY; Router Job Queued Attached Worker Selector + AttachedWorkerSelectors []ACSRouterWorkerSelector } // ACSRouterJobReceivedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobReceived @@ -1348,9 +1507,6 @@ type ACSRouterJobReceivedEventData struct { // REQUIRED; Router Job events Labels Labels map[string]*string - // REQUIRED; Router Job Received Requested Worker Selectors - RequestedWorkerSelectors []ACSRouterWorkerSelector - // REQUIRED; Router Job Received Scheduled Time in UTC ScheduledOn *time.Time @@ -1360,6 +1516,9 @@ type ACSRouterJobReceivedEventData struct { // REQUIRED; Unavailable For Matching for Router Job Received UnavailableForMatching *bool + // READ-ONLY; Router Job Received Requested Worker Selectors + RequestedWorkerSelectors []ACSRouterWorkerSelector + // Router Event Channel ID ChannelID *string @@ -1379,12 +1538,6 @@ type ACSRouterJobReceivedEventData struct { // ACSRouterJobSchedulingFailedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobSchedulingFailed // event type ACSRouterJobSchedulingFailedEventData struct { - // REQUIRED; Router Job Scheduling Failed Attached Worker Selector Expired - ExpiredAttachedWorkerSelectors []ACSRouterWorkerSelector - - // REQUIRED; Router Job Scheduling Failed Requested Worker Selector Expired - ExpiredRequestedWorkerSelectors []ACSRouterWorkerSelector - // REQUIRED; Router Event Job ID JobID *string @@ -1400,6 +1553,15 @@ type ACSRouterJobSchedulingFailedEventData struct { // REQUIRED; Router Jobs events Tags Tags map[string]*string + // Router Job events Queue Id + QueueID *string + + // READ-ONLY; Router Job Scheduling Failed Attached Worker Selector Expired + ExpiredAttachedWorkerSelectors []ACSRouterWorkerSelector + + // READ-ONLY; Router Job Scheduling Failed Requested Worker Selector Expired + ExpiredRequestedWorkerSelectors []ACSRouterWorkerSelector + // Router Event Channel ID ChannelID *string @@ -1408,9 +1570,6 @@ type ACSRouterJobSchedulingFailedEventData struct { // Router Job Scheduling Failed Reason FailureReason *string - - // Router Job events Queue Id - QueueID *string } // ACSRouterJobUnassignedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobUnassigned @@ -1444,12 +1603,6 @@ type ACSRouterJobUnassignedEventData struct { // ACSRouterJobWaitingForActivationEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobWaitingForActivation // event type ACSRouterJobWaitingForActivationEventData struct { - // REQUIRED; Router Job Waiting For Activation Worker Selector Expired - ExpiredAttachedWorkerSelectors []ACSRouterWorkerSelector - - // REQUIRED; Router Job Waiting For Activation Requested Worker Selector Expired - ExpiredRequestedWorkerSelectors []ACSRouterWorkerSelector - // REQUIRED; Router Event Job ID JobID *string @@ -1468,25 +1621,25 @@ type ACSRouterJobWaitingForActivationEventData struct { // REQUIRED; Router Job Waiting For Activation Unavailable For Matching UnavailableForMatching *bool + // Router Job events Queue Id + QueueID *string + + // READ-ONLY; Router Job Waiting For Activation Worker Selector Expired + ExpiredAttachedWorkerSelectors []ACSRouterWorkerSelector + + // READ-ONLY; Router Job Waiting For Activation Requested Worker Selector Expired + ExpiredRequestedWorkerSelectors []ACSRouterWorkerSelector + // Router Event Channel ID ChannelID *string // Router Event Channel Reference ChannelReference *string - - // Router Job events Queue Id - QueueID *string } // ACSRouterJobWorkerSelectorsExpiredEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterJobWorkerSelectorsExpired // event type ACSRouterJobWorkerSelectorsExpiredEventData struct { - // REQUIRED; Router Job Worker Selectors Expired Attached Worker Selectors - ExpiredAttachedWorkerSelectors []ACSRouterWorkerSelector - - // REQUIRED; Router Job Worker Selectors Expired Requested Worker Selectors - ExpiredRequestedWorkerSelectors []ACSRouterWorkerSelector - // REQUIRED; Router Event Job ID JobID *string @@ -1496,14 +1649,20 @@ type ACSRouterJobWorkerSelectorsExpiredEventData struct { // REQUIRED; Router Jobs events Tags Tags map[string]*string + // Router Job events Queue Id + QueueID *string + + // READ-ONLY; Router Job Worker Selectors Expired Attached Worker Selectors + ExpiredAttachedWorkerSelectors []ACSRouterWorkerSelector + + // READ-ONLY; Router Job Worker Selectors Expired Requested Worker Selectors + ExpiredRequestedWorkerSelectors []ACSRouterWorkerSelector + // Router Event Channel ID ChannelID *string // Router Event Channel Reference ChannelReference *string - - // Router Job events Queue Id - QueueID *string } // ACSRouterQueueDetails - Router Queue Details @@ -1541,6 +1700,21 @@ type ACSRouterWorkerDeregisteredEventData struct { WorkerID *string } +// ACSRouterWorkerEventData - Schema of common properties of all Router Worker events +type ACSRouterWorkerEventData struct { + // REQUIRED; Router Event Job ID + JobID *string + + // Router Event Channel ID + ChannelID *string + + // Router Event Channel Reference + ChannelReference *string + + // Router Worker events Worker Id + WorkerID *string +} + // ACSRouterWorkerOfferAcceptedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterWorkerOfferAccepted // event type ACSRouterWorkerOfferAcceptedEventData struct { @@ -1693,15 +1867,9 @@ type ACSRouterWorkerOfferRevokedEventData struct { // ACSRouterWorkerRegisteredEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterWorkerRegistered // event type ACSRouterWorkerRegisteredEventData struct { - // REQUIRED; Router Worker Registered Channel Configuration - ChannelConfigurations []ACSRouterChannelConfiguration - // REQUIRED; Router Worker Registered Labels Labels map[string]*string - // REQUIRED; Router Worker Registered Queue Info - QueueAssignments []ACSRouterQueueDetails - // REQUIRED; Router Worker Registered Tags Tags map[string]*string @@ -1710,6 +1878,12 @@ type ACSRouterWorkerRegisteredEventData struct { // Router Worker Registered Worker Id WorkerID *string + + // READ-ONLY; Router Worker Registered Channel Configuration + ChannelConfigurations []ACSRouterChannelConfiguration + + // READ-ONLY; Router Worker Registered Queue Info + QueueAssignments []ACSRouterQueueDetails } // ACSRouterWorkerSelector - Router Job Worker Selector @@ -1736,19 +1910,13 @@ type ACSRouterWorkerSelector struct { // ACSRouterWorkerUpdatedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.RouterWorkerUpdated // event. type ACSRouterWorkerUpdatedEventData struct { - // REQUIRED; Router Worker Updated Channel Configuration - ChannelConfigurations []ACSRouterChannelConfiguration - // REQUIRED; Router Worker Updated Labels Labels map[string]*string - // REQUIRED; Router Worker Updated Queue Info - QueueAssignments []ACSRouterQueueDetails - // REQUIRED; Router Worker Updated Tags Tags map[string]*string - // REQUIRED; Router Worker Properties Updated + // READ-ONLY; Router Worker Properties Updated UpdatedWorkerProperties []ACSRouterUpdatedWorkerProperty // Router Worker Updated Total Capacity @@ -1756,6 +1924,12 @@ type ACSRouterWorkerUpdatedEventData struct { // Router Worker Updated Worker Id WorkerID *string + + // READ-ONLY; Router Worker Updated Channel Configuration + ChannelConfigurations []ACSRouterChannelConfiguration + + // READ-ONLY; Router Worker Updated Queue Info + QueueAssignments []ACSRouterQueueDetails } // ACSSMSDeliveryAttemptProperties - Schema for details of a delivery attempt @@ -1773,9 +1947,6 @@ type ACSSMSDeliveryAttemptProperties struct { // ACSSMSDeliveryReportReceivedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.SMSDeliveryReportReceived // event. type ACSSMSDeliveryReportReceivedEventData struct { - // REQUIRED; List of details of delivery attempts made - DeliveryAttempts []ACSSMSDeliveryAttemptProperties - // REQUIRED; Status of Delivery DeliveryStatus *string @@ -1796,6 +1967,21 @@ type ACSSMSDeliveryReportReceivedEventData struct { // Customer Content Tag *string + + // READ-ONLY; List of details of delivery attempts made + DeliveryAttempts []ACSSMSDeliveryAttemptProperties +} + +// ACSSMSEventBaseProperties - Schema of common properties of all SMS events +type ACSSMSEventBaseProperties struct { + // REQUIRED; The identity of SMS message sender + From *string + + // REQUIRED; The identity of the SMS message + MessageID *string + + // REQUIRED; The identity of SMS message receiver + To *string } // ACSSMSReceivedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Communication.SMSReceived event. @@ -1909,6 +2095,39 @@ type APIManagementAPIUpdatedEventData struct { ResourceURI *string } +// APIManagementCircuitBreakerClosedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.CircuitBreaker.Closed +// event. +type APIManagementCircuitBreakerClosedEventData struct { + // REQUIRED; Name of the backend for which the circuit has closed. + BackendName *string + + // REQUIRED; Information related to the circuit breaker configured on the backend. + CircuitBreaker *APIManagementCircuitBreakerProperties +} + +// APIManagementCircuitBreakerOpenedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.CircuitBreaker.Opened +// event. +type APIManagementCircuitBreakerOpenedEventData struct { + // REQUIRED; Name of the backend for which the circuit has opened. + BackendName *string + + // REQUIRED; Information related to the circuit breaker configured on the backend. + CircuitBreaker *APIManagementCircuitBreakerProperties +} + +// APIManagementCircuitBreakerProperties - Information related to the circuit breaker configured on the backend. +type APIManagementCircuitBreakerProperties struct { + // REQUIRED; Overview of all configured rules and respective details. + Rules map[string]map[string]any +} + +// APIManagementExpiredGatewayTokenProperties - Information related to a gateway token that has expired for a self-hosted +// gateway deployment. +type APIManagementExpiredGatewayTokenProperties struct { + // REQUIRED; Timestamp when the gateway token has expired. + ExpiredAtUTC *time.Time +} + // APIManagementGatewayAPIAddedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayAPIAdded // event. type APIManagementGatewayAPIAddedEventData struct { @@ -1989,6 +2208,36 @@ type APIManagementGatewayHostnameConfigurationUpdatedEventData struct { ResourceURI *string } +// APIManagementGatewayProperties - Information related to a given self-hosted gateway deployment. +type APIManagementGatewayProperties struct { + // REQUIRED; Id of Gateway that is used to deploy the gateway to get the configuration for. This is the ARM resource ID referenced + // in the Azure API Management instance. Uses the format, `/subscriptions//resourceGroups//Microsoft.ApiManagement/service//gateway/` + GatewayID *string + + // REQUIRED; Unique instance ID of the deployed gateway + InstanceID *string +} + +// APIManagementGatewayTokenExpiredEventData - Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayTokenExpired +// event. +type APIManagementGatewayTokenExpiredEventData struct { + // REQUIRED; Information related to a given self-hosted gateway deployment. + GatewayInfo *APIManagementGatewayProperties + + // REQUIRED; Information related to a an expired gateway token for a self-hosted gateway deployment. + TokenInfo *APIManagementExpiredGatewayTokenProperties +} + +// APIManagementGatewayTokenNearExpiryEventData - Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayTokenNearExpiry +// event. +type APIManagementGatewayTokenNearExpiryEventData struct { + // REQUIRED; Information related to a given self-hosted gateway deployment. + GatewayInfo *APIManagementGatewayProperties + + // REQUIRED; Information related to a an expired gateway token for a self-hosted gateway deployment. + TokenInfo *APIManagementNearExpiryGatewayTokenProperties +} + // APIManagementGatewayUpdatedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.GatewayUpdated // event. type APIManagementGatewayUpdatedEventData struct { @@ -1997,6 +2246,13 @@ type APIManagementGatewayUpdatedEventData struct { ResourceURI *string } +// APIManagementNearExpiryGatewayTokenProperties - Information related to a gateway token that is near expiry for a self-hosted +// gateway deployment. +type APIManagementNearExpiryGatewayTokenProperties struct { + // REQUIRED; Timestamp when the gateway token will expire. + ExpiredAtUTC *time.Time +} + // APIManagementProductCreatedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.ApiManagement.ProductCreated // event. type APIManagementProductCreatedEventData struct { @@ -2074,13 +2330,13 @@ type AVSClusterCreatedEventData struct { // REQUIRED; Id of the operation that caused this event. OperationID *string - // Hosts added to the cluster in this event, if any. + // READ-ONLY; Hosts added to the cluster in this event, if any. AddedHostNames []string - // Hosts in Maintenance mode in the cluster, if any. + // READ-ONLY; Hosts in Maintenance mode in the cluster, if any. InMaintenanceHostNames []string - // Hosts removed from the cluster in this event, if any. + // READ-ONLY; Hosts removed from the cluster in this event, if any. RemovedHostNames []string } @@ -2089,31 +2345,46 @@ type AVSClusterDeletedEventData struct { // REQUIRED; Id of the operation that caused this event. OperationID *string - // Hosts added to the cluster in this event, if any. + // READ-ONLY; Hosts added to the cluster in this event, if any. AddedHostNames []string - // Hosts in Maintenance mode in the cluster, if any. + // READ-ONLY; Hosts in Maintenance mode in the cluster, if any. InMaintenanceHostNames []string - // Hosts removed from the cluster in this event, if any. + // READ-ONLY; Hosts removed from the cluster in this event, if any. RemovedHostNames []string } -// AVSClusterFailedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ClusterFailed event. -type AVSClusterFailedEventData struct { +// AVSClusterEventData - Schema of the Data property of an EventGridEvent for Microsoft.AVS/clusters events. +type AVSClusterEventData struct { // REQUIRED; Id of the operation that caused this event. OperationID *string - // Hosts added to the cluster in this event, if any. + // READ-ONLY; Hosts added to the cluster in this event, if any. AddedHostNames []string + // READ-ONLY; Hosts in Maintenance mode in the cluster, if any. + InMaintenanceHostNames []string + + // READ-ONLY; Hosts removed from the cluster in this event, if any. + RemovedHostNames []string +} + +// AVSClusterFailedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.AVS.ClusterFailed event. +type AVSClusterFailedEventData struct { + // REQUIRED; Id of the operation that caused this event. + OperationID *string + // Failure reason of an event. FailureMessage *string - // Hosts in Maintenance mode in the cluster, if any. + // READ-ONLY; Hosts added to the cluster in this event, if any. + AddedHostNames []string + + // READ-ONLY; Hosts in Maintenance mode in the cluster, if any. InMaintenanceHostNames []string - // Hosts removed from the cluster in this event, if any. + // READ-ONLY; Hosts removed from the cluster in this event, if any. RemovedHostNames []string } @@ -2122,13 +2393,13 @@ type AVSClusterUpdatedEventData struct { // REQUIRED; Id of the operation that caused this event. OperationID *string - // Hosts added to the cluster in this event, if any. + // READ-ONLY; Hosts added to the cluster in this event, if any. AddedHostNames []string - // Hosts in Maintenance mode in the cluster, if any. + // READ-ONLY; Hosts in Maintenance mode in the cluster, if any. InMaintenanceHostNames []string - // Hosts removed from the cluster in this event, if any. + // READ-ONLY; Hosts removed from the cluster in this event, if any. RemovedHostNames []string } @@ -2137,16 +2408,22 @@ type AVSClusterUpdatingEventData struct { // REQUIRED; Id of the operation that caused this event. OperationID *string - // Hosts added to the cluster in this event, if any. + // READ-ONLY; Hosts added to the cluster in this event, if any. AddedHostNames []string - // Hosts in Maintenance mode in the cluster, if any. + // READ-ONLY; Hosts in Maintenance mode in the cluster, if any. InMaintenanceHostNames []string - // Hosts removed from the cluster in this event, if any. + // READ-ONLY; Hosts removed from the cluster in this event, if any. RemovedHostNames []string } +// AVSPrivateCloudEventData - Schema of the Data property of an EventGridEvent for Microsoft.AVS/privateClouds events. +type AVSPrivateCloudEventData struct { + // REQUIRED; Id of the operation that caused this event. + OperationID *string +} + // AVSPrivateCloudFailedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.AVS.PrivateCloudFailed // event. type AVSPrivateCloudFailedEventData struct { @@ -2180,7 +2457,19 @@ type AVSScriptExecutionCancelledEventData struct { // REQUIRED; Id of the operation that caused this event. OperationID *string - // Stdout outputs from the execution, if any. + // READ-ONLY; Stdout outputs from the execution, if any. + Output []string +} + +// AVSScriptExecutionEventData - Schema of the Data property of an EventGridEvent for Microsoft.AVS/scriptExecutions events. +type AVSScriptExecutionEventData struct { + // REQUIRED; Cmdlet referenced in the execution that caused this event. + CmdletID *string + + // REQUIRED; Id of the operation that caused this event. + OperationID *string + + // READ-ONLY; Stdout outputs from the execution, if any. Output []string } @@ -2196,7 +2485,7 @@ type AVSScriptExecutionFailedEventData struct { // Failure reason of an event. FailureMessage *string - // Stdout outputs from the execution, if any. + // READ-ONLY; Stdout outputs from the execution, if any. Output []string } @@ -2212,7 +2501,7 @@ type AVSScriptExecutionFinishedEventData struct { // REQUIRED; Id of the operation that caused this event. OperationID *string - // Stdout outputs from the execution, if any. + // READ-ONLY; Stdout outputs from the execution, if any. Output []string } @@ -2225,7 +2514,7 @@ type AVSScriptExecutionStartedEventData struct { // REQUIRED; Id of the operation that caused this event. OperationID *string - // Stdout outputs from the execution, if any. + // READ-ONLY; Stdout outputs from the execution, if any. Output []string } @@ -2274,6 +2563,18 @@ type AppConfigurationSnapshotCreatedEventData struct { SyncToken *string } +// AppConfigurationSnapshotEventData - Schema of common properties of snapshot events +type AppConfigurationSnapshotEventData struct { + // REQUIRED; The etag representing the new state of the snapshot. + Etag *string + + // REQUIRED; The name of the snapshot. + Name *string + + // REQUIRED; The sync token representing the server state after the event. + SyncToken *string +} + // AppConfigurationSnapshotModifiedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.AppConfiguration.SnapshotModified // event. type AppConfigurationSnapshotModifiedEventData struct { @@ -2334,6 +2635,27 @@ type CommunicationUserIdentifierModel struct { ID *string } +// ContainerRegistryArtifactEventData - The content of the event request message. +type ContainerRegistryArtifactEventData struct { + // REQUIRED; The action that encompasses the provided event. + Action *string + + // REQUIRED; The event ID. + ID *string + + // REQUIRED; The location of the event. + Location *string + + // REQUIRED; The target of the event. + Target *ContainerRegistryArtifactEventTarget + + // REQUIRED; The time at which the event occurred. + Timestamp *time.Time + + // The connected registry information if the event is generated by a connected registry. + ConnectedRegistry *ContainerRegistryEventConnectedRegistry +} + // ContainerRegistryArtifactEventTarget - The target of the event. type ContainerRegistryArtifactEventTarget struct { // REQUIRED; The MIME type of the artifact. @@ -2415,6 +2737,37 @@ type ContainerRegistryEventConnectedRegistry struct { Name *string } +// ContainerRegistryEventData - The content of the event request message. +type ContainerRegistryEventData struct { + // REQUIRED; The action that encompasses the provided event. + Action *string + + // REQUIRED; The event ID. + ID *string + + // REQUIRED; The location of the event. + Location *string + + // REQUIRED; The target of the event. + Target *ContainerRegistryEventTarget + + // REQUIRED; The time at which the event occurred. + Timestamp *time.Time + + // The agent that initiated the event. For most situations, this could be from the authorization context of the request. + Actor *ContainerRegistryEventActor + + // The connected registry information if the event is generated by a connected registry. + ConnectedRegistry *ContainerRegistryEventConnectedRegistry + + // The request that generated the event. + Request *ContainerRegistryEventRequest + + // The registry node that generated the event. Put differently, while the actor initiates the event, the source generates + // it. + Source *ContainerRegistryEventSource +} + // ContainerRegistryEventRequest - The request that generated the event. type ContainerRegistryEventRequest struct { // REQUIRED; The externally accessible hostname of the registry instance, as specified by the http host header on incoming @@ -2548,6 +2901,12 @@ type ContainerServiceClusterSupportEndingEventData struct { KubernetesVersion *string } +// ContainerServiceClusterSupportEventData - Schema of common properties of cluster support events +type ContainerServiceClusterSupportEventData struct { + // REQUIRED; The Kubernetes version of the ManagedCluster resource + KubernetesVersion *string +} + // ContainerServiceNewKubernetesVersionAvailableEventData - Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.NewKubernetesVersionAvailable // event type ContainerServiceNewKubernetesVersionAvailableEventData struct { @@ -2566,6 +2925,12 @@ type ContainerServiceNewKubernetesVersionAvailableEventData struct { LatestPreviewKubernetesVersion *string } +// ContainerServiceNodePoolRollingEventData - Schema of common properties of node pool rolling events +type ContainerServiceNodePoolRollingEventData struct { + // REQUIRED; The name of the node pool in the ManagedCluster resource + NodePoolName *string +} + // ContainerServiceNodePoolRollingFailedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.ContainerService.NodePoolRollingFailed // event type ContainerServiceNodePoolRollingFailedEventData struct { @@ -2636,6 +3001,50 @@ type DeviceConnectionStateEventInfo struct { SequenceNumber *string } +// DeviceConnectionStateEventProperties - Schema of the Data property of an EventGridEvent for a device connection state event +// (DeviceConnected, DeviceDisconnected). +type DeviceConnectionStateEventProperties struct { + // REQUIRED; Information about the device connection state event. + DeviceConnectionStateEventInfo *DeviceConnectionStateEventInfo + + // REQUIRED; The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports + // ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = `@` ; $ '. + DeviceID *string + + // REQUIRED; Name of the IoT Hub where the device was created or deleted. + HubName *string + + // The unique identifier of the module. This case-sensitive string can be up to 128 characters long, and supports ASCII 7-bit + // alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = `@` ; $ '. + ModuleID *string +} + +// DeviceLifeCycleEventProperties - Schema of the Data property of an EventGridEvent for a device life cycle event (DeviceCreated, +// DeviceDeleted). +type DeviceLifeCycleEventProperties struct { + // REQUIRED; The unique identifier of the device. This case-sensitive string can be up to 128 characters long, and supports + // ASCII 7-bit alphanumeric characters plus the following special characters: - : . + % _ # * ? ! ( ) , = `@` ; $ '. + DeviceID *string + + // REQUIRED; Name of the IoT Hub where the device was created or deleted. + HubName *string + + // REQUIRED; Information about the device twin, which is the cloud representation of application device metadata. + Twin *DeviceTwinInfo +} + +// DeviceTelemetryEventProperties - Schema of the Data property of an EventGridEvent for a device telemetry event (DeviceTelemetry). +type DeviceTelemetryEventProperties struct { + // REQUIRED; The content of the message from the device. + Body map[string]any + + // REQUIRED; Application properties are user-defined strings that can be added to the message. These fields are optional. + Properties map[string]*string + + // REQUIRED; System properties help identify contents and source of the messages. + SystemProperties map[string]*string +} + // DeviceTwinInfo - Information about the device twin, which is the cloud representation of application device metadata. type DeviceTwinInfo struct { // REQUIRED; Authentication type used for this device: either SAS, SelfSigned, or CertificateAuthority. @@ -2711,6 +3120,31 @@ type DeviceTwinProperties struct { Version *float32 } +// EdgeSolutionVersionPublishedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Edge.SolutionVersionPublished +// event. +type EdgeSolutionVersionPublishedEventData struct { + // REQUIRED; API Version supported for the resources + APIVersion *string + + // REQUIRED; Direct URL to callback for updating validation status + CallbackURL *string + + // REQUIRED; A GUID to uniquely track External Solution Validation + ExternalValidationID *string + + // REQUIRED; ARM ID of the Solution Template resource + SolutionTemplateID *string + + // REQUIRED; ARM ID of the Solution Template Version resource + SolutionTemplateVersionID *string + + // REQUIRED; ARM ID of the Solution Version resource + SolutionVersionID *string + + // REQUIRED; ARM ID of the Target resource + TargetID *string +} + // EventGridMQTTClientCreatedOrUpdatedEventData - Event data for Microsoft.EventGrid.MQTTClientCreatedOrUpdated event. type EventGridMQTTClientCreatedOrUpdatedEventData struct { // REQUIRED; The key-value attributes that are assigned to the client resource. @@ -2753,6 +3187,20 @@ type EventGridMQTTClientDeletedEventData struct { NamespaceName *string } +// EventGridMQTTClientEventData - Schema of the Data property of an EventGridEvent for MQTT Client state changes. +type EventGridMQTTClientEventData struct { + // REQUIRED; Unique identifier for the MQTT client that the client presents to the service + // for authentication. This case-sensitive string can be up to 128 characters + // long, and supports UTF-8 characters. + ClientAuthenticationName *string + + // REQUIRED; Name of the client resource in the Event Grid namespace. + ClientName *string + + // REQUIRED; Name of the Event Grid namespace where the MQTT client was created or updated. + NamespaceName *string +} + // EventGridMQTTClientSessionConnectedEventData - Event data for Microsoft.EventGrid.MQTTClientSessionConnected event. type EventGridMQTTClientSessionConnectedEventData struct { // REQUIRED; Unique identifier for the MQTT client that the client presents to the service @@ -3023,8 +3471,8 @@ type IOTHubDeviceTelemetryEventData struct { SystemProperties map[string]*string } -// internalACSMessageChannelEventError - Message Channel Event Error -type internalACSMessageChannelEventError struct { +// InternalACSMessageChannelEventError - Message Channel Event Error +type InternalACSMessageChannelEventError struct { // The channel error code ChannelCode *string @@ -3032,22 +3480,22 @@ type internalACSMessageChannelEventError struct { ChannelMessage *string } -// internalACSRouterCommunicationError - Router Communication Error -type internalACSRouterCommunicationError struct { - // REQUIRED; List of Router Communication Errors - Details []internalACSRouterCommunicationError - +// InternalACSRouterCommunicationError - Router Communication Error +type InternalACSRouterCommunicationError struct { // REQUIRED; Router Communication Inner Error - Innererror *internalACSRouterCommunicationError - - // Router Communication Error Code - Code *string + Innererror *InternalACSRouterCommunicationError // Router Communication Error Message Message *string // Router Communication Error Target Target *string + + // READ-ONLY; List of Router Communication Errors + Details []InternalACSRouterCommunicationError + + // Router Communication Error Code + Code *string } // KeyVaultAccessPolicyChangedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.KeyVault.VaultAccessPolicyChanged @@ -3411,36 +3859,54 @@ type MachineLearningServicesRunStatusChangedEventData struct { // MapsGeofenceEnteredEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceEntered event. type MapsGeofenceEnteredEventData struct { - // REQUIRED; Lists of the geometry ID of the geofence which is expired relative to the user time in the request. + // REQUIRED; True if at least one event is published to the Azure Maps event subscriber, false if no event is published to + // the Azure Maps event subscriber. + IsEventPublished *bool + + // READ-ONLY; Lists of the geometry ID of the geofence which is expired relative to the user time in the request. ExpiredGeofenceGeometryID []string - // REQUIRED; Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer + // READ-ONLY; Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer // around the fence. Geometries []MapsGeofenceGeometry - // REQUIRED; Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. + // READ-ONLY; Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. InvalidPeriodGeofenceGeometryID []string +} +// MapsGeofenceEventProperties - Schema of the Data property of an EventGridEvent for a Geofence event (GeofenceEntered, GeofenceExited, +// GeofenceResult). +type MapsGeofenceEventProperties struct { // REQUIRED; True if at least one event is published to the Azure Maps event subscriber, false if no event is published to // the Azure Maps event subscriber. IsEventPublished *bool -} -// MapsGeofenceExitedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceExited event. -type MapsGeofenceExitedEventData struct { - // REQUIRED; Lists of the geometry ID of the geofence which is expired relative to the user time in the request. + // READ-ONLY; Lists of the geometry ID of the geofence which is expired relative to the user time in the request. ExpiredGeofenceGeometryID []string - // REQUIRED; Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer + // READ-ONLY; Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer // around the fence. Geometries []MapsGeofenceGeometry - // REQUIRED; Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. + // READ-ONLY; Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. InvalidPeriodGeofenceGeometryID []string +} +// MapsGeofenceExitedEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceExited event. +type MapsGeofenceExitedEventData struct { // REQUIRED; True if at least one event is published to the Azure Maps event subscriber, false if no event is published to // the Azure Maps event subscriber. IsEventPublished *bool + + // READ-ONLY; Lists of the geometry ID of the geofence which is expired relative to the user time in the request. + ExpiredGeofenceGeometryID []string + + // READ-ONLY; Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer + // around the fence. + Geometries []MapsGeofenceGeometry + + // READ-ONLY; Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. + InvalidPeriodGeofenceGeometryID []string } // MapsGeofenceGeometry - The geofence geometry. @@ -3471,19 +3937,19 @@ type MapsGeofenceGeometry struct { // MapsGeofenceResultEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Maps.GeofenceResult event. type MapsGeofenceResultEventData struct { - // REQUIRED; Lists of the geometry ID of the geofence which is expired relative to the user time in the request. + // REQUIRED; True if at least one event is published to the Azure Maps event subscriber, false if no event is published to + // the Azure Maps event subscriber. + IsEventPublished *bool + + // READ-ONLY; Lists of the geometry ID of the geofence which is expired relative to the user time in the request. ExpiredGeofenceGeometryID []string - // REQUIRED; Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer + // READ-ONLY; Lists the fence geometries that either fully contain the coordinate position or have an overlap with the searchBuffer // around the fence. Geometries []MapsGeofenceGeometry - // REQUIRED; Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. + // READ-ONLY; Lists of the geometry ID of the geofence which is in invalid period relative to the user time in the request. InvalidPeriodGeofenceGeometryID []string - - // REQUIRED; True if at least one event is published to the Azure Maps event subscriber, false if no event is published to - // the Azure Maps event subscriber. - IsEventPublished *bool } // MicrosoftTeamsAppIdentifierModel - A Microsoft Teams application. @@ -3893,7 +4359,9 @@ type ResourceHTTPRequest struct { } // ResourceNotificationsContainerServiceEventResourcesScheduledEventData - Schema of the Data property of an event grid event -// for a Microsoft.ResourceNotifications.ContainerServiceEventResources.ScheduledEventEmitted preview event. +// for a Microsoft.ResourceNotifications.ContainerServiceEventResources.ScheduledEventEmitted preview event.Schema of the +// Data property of an event grid event for a Microsoft.ResourceNotifications.ContainerServiceEventResources.ScheduledEventEmitted +// preview event. type ResourceNotificationsContainerServiceEventResourcesScheduledEventData struct { // REQUIRED; api version of the resource properties bag APIVersion *string @@ -3952,6 +4420,16 @@ type ResourceNotificationsResourceDeletedDetails struct { Type *string } +// ResourceNotificationsResourceDeletedEventData - Describes the schema of the common properties across all ARN system topic +// delete events +type ResourceNotificationsResourceDeletedEventData struct { + // REQUIRED; details about operational info + OperationalDetails *ResourceNotificationsOperationalDetails + + // REQUIRED; resourceInfo details for delete event + ResourceDetails *ResourceNotificationsResourceDeletedDetails +} + // ResourceNotificationsResourceManagementCreatedOrUpdatedEventData - Schema of the Data property of an EventGridEvent for // a // Microsoft.ResourceNotifications.Resources.CreatedOrUpdated event. @@ -3998,6 +4476,19 @@ type ResourceNotificationsResourceUpdatedDetails struct { Tags map[string]*string } +// ResourceNotificationsResourceUpdatedEventData - Describes the schema of the common properties across all ARN system topic +// events +type ResourceNotificationsResourceUpdatedEventData struct { + // REQUIRED; api version of the resource properties bag + APIVersion *string + + // REQUIRED; details about operational info + OperationalDetails *ResourceNotificationsOperationalDetails + + // REQUIRED; resourceInfo details for update event + ResourceDetails *ResourceNotificationsResourceUpdatedDetails +} + // ResourceWriteCancelEventData - Schema of the Data property of an EventGridEvent for a Microsoft.Resources.ResourceWriteCancel // event. This is raised when a resource create or update operation is canceled. type ResourceWriteCancelEventData struct { diff --git a/sdk/messaging/eventgrid/azsystemevents/models_serde.go b/sdk/messaging/eventgrid/azsystemevents/models_serde.go index f235e882c25b..0fa7a808aa32 100644 --- a/sdk/messaging/eventgrid/azsystemevents/models_serde.go +++ b/sdk/messaging/eventgrid/azsystemevents/models_serde.go @@ -7,9 +7,8 @@ package azsystemevents import ( "encoding/json" "fmt" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" ) // MarshalJSON implements the json.Marshaller interface for type ACSCallEndReasonProperties. @@ -596,6 +595,72 @@ func (a *ACSChatAzureBotCommandReceivedInThreadEventData) UnmarshalJSON(data []b return nil } +// MarshalJSON implements the json.Marshaller interface for type ACSChatEventBaseProperties. +func (a ACSChatEventBaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "recipientCommunicationIdentifier", a.RecipientCommunicationIdentifier) + populate(objectMap, "threadId", a.ThreadID) + populate(objectMap, "transactionId", a.TransactionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSChatEventBaseProperties. +func (a *ACSChatEventBaseProperties) UnmarshalJSON(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 "recipientCommunicationIdentifier": + err = unpopulate(val, "RecipientCommunicationIdentifier", &a.RecipientCommunicationIdentifier) + delete(rawMsg, key) + case "threadId": + err = unpopulate(val, "ThreadID", &a.ThreadID) + delete(rawMsg, key) + case "transactionId": + err = unpopulate(val, "TransactionID", &a.TransactionID) + 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 ACSChatEventInThreadBaseProperties. +func (a ACSChatEventInThreadBaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "threadId", a.ThreadID) + populate(objectMap, "transactionId", a.TransactionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSChatEventInThreadBaseProperties. +func (a *ACSChatEventInThreadBaseProperties) UnmarshalJSON(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 "threadId": + err = unpopulate(val, "ThreadID", &a.ThreadID) + delete(rawMsg, key) + case "transactionId": + err = unpopulate(val, "TransactionID", &a.TransactionID) + 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 ACSChatMessageDeletedEventData. func (a ACSChatMessageDeletedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -856,6 +921,120 @@ func (a *ACSChatMessageEditedInThreadEventData) UnmarshalJSON(data []byte) error return nil } +// MarshalJSON implements the json.Marshaller interface for type ACSChatMessageEventBaseProperties. +func (a ACSChatMessageEventBaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "composeTime", a.ComposeTime) + populate(objectMap, "messageId", a.MessageID) + populate(objectMap, "recipientCommunicationIdentifier", a.RecipientCommunicationIdentifier) + populate(objectMap, "senderCommunicationIdentifier", a.SenderCommunicationIdentifier) + populate(objectMap, "senderDisplayName", a.SenderDisplayName) + populate(objectMap, "threadId", a.ThreadID) + populate(objectMap, "transactionId", a.TransactionID) + populate(objectMap, "type", a.Type) + populate(objectMap, "version", a.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSChatMessageEventBaseProperties. +func (a *ACSChatMessageEventBaseProperties) UnmarshalJSON(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 "composeTime": + err = unpopulateDateTimeRFC3339(val, "ComposeTime", &a.ComposeTime) + delete(rawMsg, key) + case "messageId": + err = unpopulate(val, "MessageID", &a.MessageID) + delete(rawMsg, key) + case "recipientCommunicationIdentifier": + err = unpopulate(val, "RecipientCommunicationIdentifier", &a.RecipientCommunicationIdentifier) + delete(rawMsg, key) + case "senderCommunicationIdentifier": + err = unpopulate(val, "SenderCommunicationIdentifier", &a.SenderCommunicationIdentifier) + delete(rawMsg, key) + case "senderDisplayName": + err = unpopulate(val, "SenderDisplayName", &a.SenderDisplayName) + delete(rawMsg, key) + case "threadId": + err = unpopulate(val, "ThreadID", &a.ThreadID) + delete(rawMsg, key) + case "transactionId": + err = unpopulate(val, "TransactionID", &a.TransactionID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &a.Version) + 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 ACSChatMessageEventInThreadBaseProperties. +func (a ACSChatMessageEventInThreadBaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "composeTime", a.ComposeTime) + populate(objectMap, "messageId", a.MessageID) + populate(objectMap, "senderCommunicationIdentifier", a.SenderCommunicationIdentifier) + populate(objectMap, "senderDisplayName", a.SenderDisplayName) + populate(objectMap, "threadId", a.ThreadID) + populate(objectMap, "transactionId", a.TransactionID) + populate(objectMap, "type", a.Type) + populate(objectMap, "version", a.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSChatMessageEventInThreadBaseProperties. +func (a *ACSChatMessageEventInThreadBaseProperties) UnmarshalJSON(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 "composeTime": + err = unpopulateDateTimeRFC3339(val, "ComposeTime", &a.ComposeTime) + delete(rawMsg, key) + case "messageId": + err = unpopulate(val, "MessageID", &a.MessageID) + delete(rawMsg, key) + case "senderCommunicationIdentifier": + err = unpopulate(val, "SenderCommunicationIdentifier", &a.SenderCommunicationIdentifier) + delete(rawMsg, key) + case "senderDisplayName": + err = unpopulate(val, "SenderDisplayName", &a.SenderDisplayName) + delete(rawMsg, key) + case "threadId": + err = unpopulate(val, "ThreadID", &a.ThreadID) + delete(rawMsg, key) + case "transactionId": + err = unpopulate(val, "TransactionID", &a.TransactionID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &a.Version) + 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 ACSChatMessageReceivedEventData. func (a ACSChatMessageReceivedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1351,6 +1530,88 @@ func (a *ACSChatThreadDeletedEventData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ACSChatThreadEventBaseProperties. +func (a ACSChatThreadEventBaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createTime", a.CreateTime) + populate(objectMap, "recipientCommunicationIdentifier", a.RecipientCommunicationIdentifier) + populate(objectMap, "threadId", a.ThreadID) + populate(objectMap, "transactionId", a.TransactionID) + populate(objectMap, "version", a.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSChatThreadEventBaseProperties. +func (a *ACSChatThreadEventBaseProperties) UnmarshalJSON(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 "createTime": + err = unpopulateDateTimeRFC3339(val, "CreateTime", &a.CreateTime) + delete(rawMsg, key) + case "recipientCommunicationIdentifier": + err = unpopulate(val, "RecipientCommunicationIdentifier", &a.RecipientCommunicationIdentifier) + delete(rawMsg, key) + case "threadId": + err = unpopulate(val, "ThreadID", &a.ThreadID) + delete(rawMsg, key) + case "transactionId": + err = unpopulate(val, "TransactionID", &a.TransactionID) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &a.Version) + 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 ACSChatThreadEventInThreadBaseProperties. +func (a ACSChatThreadEventInThreadBaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createTime", a.CreateTime) + populate(objectMap, "threadId", a.ThreadID) + populate(objectMap, "transactionId", a.TransactionID) + populate(objectMap, "version", a.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSChatThreadEventInThreadBaseProperties. +func (a *ACSChatThreadEventInThreadBaseProperties) UnmarshalJSON(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 "createTime": + err = unpopulateDateTimeRFC3339(val, "CreateTime", &a.CreateTime) + delete(rawMsg, key) + case "threadId": + err = unpopulate(val, "ThreadID", &a.ThreadID) + delete(rawMsg, key) + case "transactionId": + err = unpopulate(val, "TransactionID", &a.TransactionID) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &a.Version) + 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 ACSChatThreadParticipantProperties. func (a ACSChatThreadParticipantProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1921,7 +2182,7 @@ func (a *ACSMessageDeliveryStatusUpdatedEventData) UnmarshalJSON(data []byte) er err = unpopulate(val, "ChannelKind", &a.ChannelKind) delete(rawMsg, key) case "error": - err = unmarshalInternalACSMessageChannelEventError(val, "Error", &a.Error) + err = unpopulate(val, "Error", &a.Error) delete(rawMsg, key) case "from": err = unpopulate(val, "From", &a.From) @@ -1946,16 +2207,18 @@ func (a *ACSMessageDeliveryStatusUpdatedEventData) UnmarshalJSON(data []byte) er return nil } -// MarshalJSON implements the json.Marshaller interface for type ACSMessageInteractiveButtonReplyContent. -func (a ACSMessageInteractiveButtonReplyContent) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ACSMessageEventData. +func (a ACSMessageEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", a.ButtonID) - populate(objectMap, "title", a.Title) + populate(objectMap, "error", a.Error) + populate(objectMap, "from", a.From) + populateDateTimeRFC3339(objectMap, "receivedTimeStamp", a.ReceivedTimestamp) + populate(objectMap, "to", a.To) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ACSMessageInteractiveButtonReplyContent. -func (a *ACSMessageInteractiveButtonReplyContent) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSMessageEventData. +func (a *ACSMessageEventData) UnmarshalJSON(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) @@ -1963,11 +2226,48 @@ func (a *ACSMessageInteractiveButtonReplyContent) UnmarshalJSON(data []byte) err for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ButtonID", &a.ButtonID) + case "error": + err = unpopulate(val, "Error", &a.Error) delete(rawMsg, key) - case "title": - err = unpopulate(val, "Title", &a.Title) + case "from": + err = unpopulate(val, "From", &a.From) + delete(rawMsg, key) + case "receivedTimeStamp": + err = unpopulateDateTimeRFC3339(val, "ReceivedTimestamp", &a.ReceivedTimestamp) + delete(rawMsg, key) + case "to": + err = unpopulate(val, "To", &a.To) + 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 ACSMessageInteractiveButtonReplyContent. +func (a ACSMessageInteractiveButtonReplyContent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ButtonID) + populate(objectMap, "title", a.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSMessageInteractiveButtonReplyContent. +func (a *ACSMessageInteractiveButtonReplyContent) UnmarshalJSON(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, "ButtonID", &a.ButtonID) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &a.Title) delete(rawMsg, key) } if err != nil { @@ -2162,7 +2462,7 @@ func (a *ACSMessageReceivedEventData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Context", &a.Context) delete(rawMsg, key) case "error": - err = unmarshalInternalACSMessageChannelEventError(val, "Error", &a.Error) + err = unpopulate(val, "Error", &a.Error) delete(rawMsg, key) case "from": err = unpopulate(val, "From", &a.From) @@ -2356,6 +2656,41 @@ func (a *ACSRouterChannelConfiguration) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ACSRouterEventData. +func (a ACSRouterEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "channelId", a.ChannelID) + populate(objectMap, "channelReference", a.ChannelReference) + populate(objectMap, "jobId", a.JobID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSRouterEventData. +func (a *ACSRouterEventData) UnmarshalJSON(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 "channelId": + err = unpopulate(val, "ChannelID", &a.ChannelID) + delete(rawMsg, key) + case "channelReference": + err = unpopulate(val, "ChannelReference", &a.ChannelReference) + delete(rawMsg, key) + case "jobId": + err = unpopulate(val, "JobID", &a.JobID) + 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 ACSRouterJobCancelledEventData. func (a ACSRouterJobCancelledEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2444,7 +2779,7 @@ func (a *ACSRouterJobClassificationFailedEventData) UnmarshalJSON(data []byte) e err = unpopulate(val, "ClassificationPolicyID", &a.ClassificationPolicyID) delete(rawMsg, key) case "errors": - err = unmarshalInternalACSRouterCommunicationError(val, "Errors", &a.Errors) + err = unpopulate(val, "Errors", &a.Errors) delete(rawMsg, key) case "jobId": err = unpopulate(val, "JobID", &a.JobID) @@ -2690,6 +3025,53 @@ func (a *ACSRouterJobDeletedEventData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ACSRouterJobEventData. +func (a ACSRouterJobEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "channelId", a.ChannelID) + populate(objectMap, "channelReference", a.ChannelReference) + populate(objectMap, "jobId", a.JobID) + populate(objectMap, "labels", a.Labels) + populate(objectMap, "queueId", a.QueueID) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSRouterJobEventData. +func (a *ACSRouterJobEventData) UnmarshalJSON(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 "channelId": + err = unpopulate(val, "ChannelID", &a.ChannelID) + delete(rawMsg, key) + case "channelReference": + err = unpopulate(val, "ChannelReference", &a.ChannelReference) + delete(rawMsg, key) + case "jobId": + err = unpopulate(val, "JobID", &a.JobID) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &a.Labels) + delete(rawMsg, key) + case "queueId": + err = unpopulate(val, "QueueID", &a.QueueID) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + 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 ACSRouterJobExceptionTriggeredEventData. func (a ACSRouterJobExceptionTriggeredEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3220,6 +3602,45 @@ func (a *ACSRouterWorkerDeregisteredEventData) UnmarshalJSON(data []byte) error return nil } +// MarshalJSON implements the json.Marshaller interface for type ACSRouterWorkerEventData. +func (a ACSRouterWorkerEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "channelId", a.ChannelID) + populate(objectMap, "channelReference", a.ChannelReference) + populate(objectMap, "jobId", a.JobID) + populate(objectMap, "workerId", a.WorkerID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSRouterWorkerEventData. +func (a *ACSRouterWorkerEventData) UnmarshalJSON(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 "channelId": + err = unpopulate(val, "ChannelID", &a.ChannelID) + delete(rawMsg, key) + case "channelReference": + err = unpopulate(val, "ChannelReference", &a.ChannelReference) + delete(rawMsg, key) + case "jobId": + err = unpopulate(val, "JobID", &a.JobID) + delete(rawMsg, key) + case "workerId": + err = unpopulate(val, "WorkerID", &a.WorkerID) + 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 ACSRouterWorkerOfferAcceptedEventData. func (a ACSRouterWorkerOfferAcceptedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3742,6 +4163,41 @@ func (a *ACSSMSDeliveryReportReceivedEventData) UnmarshalJSON(data []byte) error return nil } +// MarshalJSON implements the json.Marshaller interface for type ACSSMSEventBaseProperties. +func (a ACSSMSEventBaseProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "from", a.From) + populate(objectMap, "messageId", a.MessageID) + populate(objectMap, "to", a.To) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ACSSMSEventBaseProperties. +func (a *ACSSMSEventBaseProperties) UnmarshalJSON(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 "from": + err = unpopulate(val, "From", &a.From) + delete(rawMsg, key) + case "messageId": + err = unpopulate(val, "MessageID", &a.MessageID) + delete(rawMsg, key) + case "to": + err = unpopulate(val, "To", &a.To) + 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 ACSSMSReceivedEventData. func (a ACSSMSReceivedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4079,15 +4535,16 @@ func (a *APIManagementAPIUpdatedEventData) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayAPIAddedEventData. -func (a APIManagementGatewayAPIAddedEventData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type APIManagementCircuitBreakerClosedEventData. +func (a APIManagementCircuitBreakerClosedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resourceUri", a.ResourceURI) + populate(objectMap, "backendName", a.BackendName) + populate(objectMap, "circuitBreaker", a.CircuitBreaker) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayAPIAddedEventData. -func (a *APIManagementGatewayAPIAddedEventData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementCircuitBreakerClosedEventData. +func (a *APIManagementCircuitBreakerClosedEventData) UnmarshalJSON(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) @@ -4095,8 +4552,11 @@ func (a *APIManagementGatewayAPIAddedEventData) UnmarshalJSON(data []byte) error for key, val := range rawMsg { var err error switch key { - case "resourceUri": - err = unpopulate(val, "ResourceURI", &a.ResourceURI) + case "backendName": + err = unpopulate(val, "BackendName", &a.BackendName) + delete(rawMsg, key) + case "circuitBreaker": + err = unpopulate(val, "CircuitBreaker", &a.CircuitBreaker) delete(rawMsg, key) } if err != nil { @@ -4106,15 +4566,16 @@ func (a *APIManagementGatewayAPIAddedEventData) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayAPIRemovedEventData. -func (a APIManagementGatewayAPIRemovedEventData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type APIManagementCircuitBreakerOpenedEventData. +func (a APIManagementCircuitBreakerOpenedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resourceUri", a.ResourceURI) + populate(objectMap, "backendName", a.BackendName) + populate(objectMap, "circuitBreaker", a.CircuitBreaker) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayAPIRemovedEventData. -func (a *APIManagementGatewayAPIRemovedEventData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementCircuitBreakerOpenedEventData. +func (a *APIManagementCircuitBreakerOpenedEventData) UnmarshalJSON(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) @@ -4122,8 +4583,11 @@ func (a *APIManagementGatewayAPIRemovedEventData) UnmarshalJSON(data []byte) err for key, val := range rawMsg { var err error switch key { - case "resourceUri": - err = unpopulate(val, "ResourceURI", &a.ResourceURI) + case "backendName": + err = unpopulate(val, "BackendName", &a.BackendName) + delete(rawMsg, key) + case "circuitBreaker": + err = unpopulate(val, "CircuitBreaker", &a.CircuitBreaker) delete(rawMsg, key) } if err != nil { @@ -4133,15 +4597,15 @@ func (a *APIManagementGatewayAPIRemovedEventData) UnmarshalJSON(data []byte) err return nil } -// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayCertificateAuthorityCreatedEventData. -func (a APIManagementGatewayCertificateAuthorityCreatedEventData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type APIManagementCircuitBreakerProperties. +func (a APIManagementCircuitBreakerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resourceUri", a.ResourceURI) + populate(objectMap, "rules", a.Rules) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayCertificateAuthorityCreatedEventData. -func (a *APIManagementGatewayCertificateAuthorityCreatedEventData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementCircuitBreakerProperties. +func (a *APIManagementCircuitBreakerProperties) UnmarshalJSON(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) @@ -4149,8 +4613,8 @@ func (a *APIManagementGatewayCertificateAuthorityCreatedEventData) UnmarshalJSON for key, val := range rawMsg { var err error switch key { - case "resourceUri": - err = unpopulate(val, "ResourceURI", &a.ResourceURI) + case "rules": + err = unpopulate(val, "Rules", &a.Rules) delete(rawMsg, key) } if err != nil { @@ -4160,15 +4624,15 @@ func (a *APIManagementGatewayCertificateAuthorityCreatedEventData) UnmarshalJSON return nil } -// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayCertificateAuthorityDeletedEventData. -func (a APIManagementGatewayCertificateAuthorityDeletedEventData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type APIManagementExpiredGatewayTokenProperties. +func (a APIManagementExpiredGatewayTokenProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "resourceUri", a.ResourceURI) + populateDateTimeRFC3339(objectMap, "expiredAtUtc", a.ExpiredAtUTC) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayCertificateAuthorityDeletedEventData. -func (a *APIManagementGatewayCertificateAuthorityDeletedEventData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementExpiredGatewayTokenProperties. +func (a *APIManagementExpiredGatewayTokenProperties) UnmarshalJSON(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) @@ -4176,8 +4640,8 @@ func (a *APIManagementGatewayCertificateAuthorityDeletedEventData) UnmarshalJSON for key, val := range rawMsg { var err error switch key { - case "resourceUri": - err = unpopulate(val, "ResourceURI", &a.ResourceURI) + case "expiredAtUtc": + err = unpopulateDateTimeRFC3339(val, "ExpiredAtUTC", &a.ExpiredAtUTC) delete(rawMsg, key) } if err != nil { @@ -4187,15 +4651,15 @@ func (a *APIManagementGatewayCertificateAuthorityDeletedEventData) UnmarshalJSON return nil } -// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayCertificateAuthorityUpdatedEventData. -func (a APIManagementGatewayCertificateAuthorityUpdatedEventData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayAPIAddedEventData. +func (a APIManagementGatewayAPIAddedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "resourceUri", a.ResourceURI) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayCertificateAuthorityUpdatedEventData. -func (a *APIManagementGatewayCertificateAuthorityUpdatedEventData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayAPIAddedEventData. +func (a *APIManagementGatewayAPIAddedEventData) UnmarshalJSON(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) @@ -4214,15 +4678,15 @@ func (a *APIManagementGatewayCertificateAuthorityUpdatedEventData) UnmarshalJSON return nil } -// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayCreatedEventData. -func (a APIManagementGatewayCreatedEventData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayAPIRemovedEventData. +func (a APIManagementGatewayAPIRemovedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "resourceUri", a.ResourceURI) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayCreatedEventData. -func (a *APIManagementGatewayCreatedEventData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayAPIRemovedEventData. +func (a *APIManagementGatewayAPIRemovedEventData) UnmarshalJSON(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) @@ -4241,15 +4705,15 @@ func (a *APIManagementGatewayCreatedEventData) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayDeletedEventData. -func (a APIManagementGatewayDeletedEventData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayCertificateAuthorityCreatedEventData. +func (a APIManagementGatewayCertificateAuthorityCreatedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "resourceUri", a.ResourceURI) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayDeletedEventData. -func (a *APIManagementGatewayDeletedEventData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayCertificateAuthorityCreatedEventData. +func (a *APIManagementGatewayCertificateAuthorityCreatedEventData) UnmarshalJSON(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) @@ -4268,15 +4732,15 @@ func (a *APIManagementGatewayDeletedEventData) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayHostnameConfigurationCreatedEventData. -func (a APIManagementGatewayHostnameConfigurationCreatedEventData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayCertificateAuthorityDeletedEventData. +func (a APIManagementGatewayCertificateAuthorityDeletedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "resourceUri", a.ResourceURI) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayHostnameConfigurationCreatedEventData. -func (a *APIManagementGatewayHostnameConfigurationCreatedEventData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayCertificateAuthorityDeletedEventData. +func (a *APIManagementGatewayCertificateAuthorityDeletedEventData) UnmarshalJSON(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) @@ -4295,15 +4759,15 @@ func (a *APIManagementGatewayHostnameConfigurationCreatedEventData) UnmarshalJSO return nil } -// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayHostnameConfigurationDeletedEventData. -func (a APIManagementGatewayHostnameConfigurationDeletedEventData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayCertificateAuthorityUpdatedEventData. +func (a APIManagementGatewayCertificateAuthorityUpdatedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "resourceUri", a.ResourceURI) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayHostnameConfigurationDeletedEventData. -func (a *APIManagementGatewayHostnameConfigurationDeletedEventData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayCertificateAuthorityUpdatedEventData. +func (a *APIManagementGatewayCertificateAuthorityUpdatedEventData) UnmarshalJSON(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) @@ -4322,16 +4786,43 @@ func (a *APIManagementGatewayHostnameConfigurationDeletedEventData) UnmarshalJSO return nil } -// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayHostnameConfigurationUpdatedEventData. -func (a APIManagementGatewayHostnameConfigurationUpdatedEventData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayCreatedEventData. +func (a APIManagementGatewayCreatedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "resourceUri", a.ResourceURI) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayHostnameConfigurationUpdatedEventData. -func (a *APIManagementGatewayHostnameConfigurationUpdatedEventData) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayCreatedEventData. +func (a *APIManagementGatewayCreatedEventData) UnmarshalJSON(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 "resourceUri": + err = unpopulate(val, "ResourceURI", &a.ResourceURI) + 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 APIManagementGatewayDeletedEventData. +func (a APIManagementGatewayDeletedEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceUri", a.ResourceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayDeletedEventData. +func (a *APIManagementGatewayDeletedEventData) UnmarshalJSON(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) } @@ -4349,6 +4840,180 @@ func (a *APIManagementGatewayHostnameConfigurationUpdatedEventData) UnmarshalJSO return nil } +// MarshalJSON implements the json.Marshaller interface for type APIManagementGatewayHostnameConfigurationCreatedEventData. +func (a APIManagementGatewayHostnameConfigurationCreatedEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceUri", a.ResourceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayHostnameConfigurationCreatedEventData. +func (a *APIManagementGatewayHostnameConfigurationCreatedEventData) UnmarshalJSON(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 "resourceUri": + err = unpopulate(val, "ResourceURI", &a.ResourceURI) + 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 APIManagementGatewayHostnameConfigurationDeletedEventData. +func (a APIManagementGatewayHostnameConfigurationDeletedEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceUri", a.ResourceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayHostnameConfigurationDeletedEventData. +func (a *APIManagementGatewayHostnameConfigurationDeletedEventData) UnmarshalJSON(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 "resourceUri": + err = unpopulate(val, "ResourceURI", &a.ResourceURI) + 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 APIManagementGatewayHostnameConfigurationUpdatedEventData. +func (a APIManagementGatewayHostnameConfigurationUpdatedEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "resourceUri", a.ResourceURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayHostnameConfigurationUpdatedEventData. +func (a *APIManagementGatewayHostnameConfigurationUpdatedEventData) UnmarshalJSON(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 "resourceUri": + err = unpopulate(val, "ResourceURI", &a.ResourceURI) + 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 APIManagementGatewayProperties. +func (a APIManagementGatewayProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "gatewayId", a.GatewayID) + populate(objectMap, "instanceId", a.InstanceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayProperties. +func (a *APIManagementGatewayProperties) UnmarshalJSON(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 "gatewayId": + err = unpopulate(val, "GatewayID", &a.GatewayID) + delete(rawMsg, key) + case "instanceId": + err = unpopulate(val, "InstanceID", &a.InstanceID) + 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 APIManagementGatewayTokenExpiredEventData. +func (a APIManagementGatewayTokenExpiredEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "gatewayInfo", a.GatewayInfo) + populate(objectMap, "tokenInfo", a.TokenInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayTokenExpiredEventData. +func (a *APIManagementGatewayTokenExpiredEventData) UnmarshalJSON(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 "gatewayInfo": + err = unpopulate(val, "GatewayInfo", &a.GatewayInfo) + delete(rawMsg, key) + case "tokenInfo": + err = unpopulate(val, "TokenInfo", &a.TokenInfo) + 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 APIManagementGatewayTokenNearExpiryEventData. +func (a APIManagementGatewayTokenNearExpiryEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "gatewayInfo", a.GatewayInfo) + populate(objectMap, "tokenInfo", a.TokenInfo) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementGatewayTokenNearExpiryEventData. +func (a *APIManagementGatewayTokenNearExpiryEventData) UnmarshalJSON(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 "gatewayInfo": + err = unpopulate(val, "GatewayInfo", &a.GatewayInfo) + delete(rawMsg, key) + case "tokenInfo": + err = unpopulate(val, "TokenInfo", &a.TokenInfo) + 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 APIManagementGatewayUpdatedEventData. func (a APIManagementGatewayUpdatedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4376,6 +5041,33 @@ func (a *APIManagementGatewayUpdatedEventData) UnmarshalJSON(data []byte) error return nil } +// MarshalJSON implements the json.Marshaller interface for type APIManagementNearExpiryGatewayTokenProperties. +func (a APIManagementNearExpiryGatewayTokenProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "expiredAtUtc", a.ExpiredAtUTC) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type APIManagementNearExpiryGatewayTokenProperties. +func (a *APIManagementNearExpiryGatewayTokenProperties) UnmarshalJSON(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 "expiredAtUtc": + err = unpopulateDateTimeRFC3339(val, "ExpiredAtUTC", &a.ExpiredAtUTC) + 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 APIManagementProductCreatedEventData. func (a APIManagementProductCreatedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4697,6 +5389,45 @@ func (a *AVSClusterDeletedEventData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AVSClusterEventData. +func (a AVSClusterEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "addedHostNames", a.AddedHostNames) + populate(objectMap, "inMaintenanceHostNames", a.InMaintenanceHostNames) + populate(objectMap, "operationId", a.OperationID) + populate(objectMap, "removedHostNames", a.RemovedHostNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AVSClusterEventData. +func (a *AVSClusterEventData) UnmarshalJSON(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 "addedHostNames": + err = unpopulate(val, "AddedHostNames", &a.AddedHostNames) + delete(rawMsg, key) + case "inMaintenanceHostNames": + err = unpopulate(val, "InMaintenanceHostNames", &a.InMaintenanceHostNames) + delete(rawMsg, key) + case "operationId": + err = unpopulate(val, "OperationID", &a.OperationID) + delete(rawMsg, key) + case "removedHostNames": + err = unpopulate(val, "RemovedHostNames", &a.RemovedHostNames) + 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 AVSClusterFailedEventData. func (a AVSClusterFailedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4818,6 +5549,33 @@ func (a *AVSClusterUpdatingEventData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AVSPrivateCloudEventData. +func (a AVSPrivateCloudEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", a.OperationID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AVSPrivateCloudEventData. +func (a *AVSPrivateCloudEventData) UnmarshalJSON(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 "operationId": + err = unpopulate(val, "OperationID", &a.OperationID) + 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 AVSPrivateCloudFailedEventData. func (a AVSPrivateCloudFailedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4938,6 +5696,41 @@ func (a *AVSScriptExecutionCancelledEventData) UnmarshalJSON(data []byte) error return nil } +// MarshalJSON implements the json.Marshaller interface for type AVSScriptExecutionEventData. +func (a AVSScriptExecutionEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cmdletId", a.CmdletID) + populate(objectMap, "operationId", a.OperationID) + populate(objectMap, "output", a.Output) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AVSScriptExecutionEventData. +func (a *AVSScriptExecutionEventData) UnmarshalJSON(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 "cmdletId": + err = unpopulate(val, "CmdletID", &a.CmdletID) + delete(rawMsg, key) + case "operationId": + err = unpopulate(val, "OperationID", &a.OperationID) + delete(rawMsg, key) + case "output": + err = unpopulate(val, "Output", &a.Output) + 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 AVSScriptExecutionFailedEventData. func (a AVSScriptExecutionFailedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5164,6 +5957,41 @@ func (a *AppConfigurationSnapshotCreatedEventData) UnmarshalJSON(data []byte) er return nil } +// MarshalJSON implements the json.Marshaller interface for type AppConfigurationSnapshotEventData. +func (a AppConfigurationSnapshotEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "name", a.Name) + populate(objectMap, "syncToken", a.SyncToken) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AppConfigurationSnapshotEventData. +func (a *AppConfigurationSnapshotEventData) UnmarshalJSON(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 "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "syncToken": + err = unpopulate(val, "SyncToken", &a.SyncToken) + 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 AppConfigurationSnapshotModifiedEventData. func (a AppConfigurationSnapshotModifiedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5335,6 +6163,53 @@ func (c *CommunicationUserIdentifierModel) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ContainerRegistryArtifactEventData. +func (c ContainerRegistryArtifactEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", c.Action) + populate(objectMap, "connectedRegistry", c.ConnectedRegistry) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "target", c.Target) + populateDateTimeRFC3339(objectMap, "timestamp", c.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerRegistryArtifactEventData. +func (c *ContainerRegistryArtifactEventData) UnmarshalJSON(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 "action": + err = unpopulate(val, "Action", &c.Action) + delete(rawMsg, key) + case "connectedRegistry": + err = unpopulate(val, "ConnectedRegistry", &c.ConnectedRegistry) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &c.Target) + delete(rawMsg, key) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &c.Timestamp) + 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 ContainerRegistryArtifactEventTarget. func (c ContainerRegistryArtifactEventTarget) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5534,6 +6409,65 @@ func (c *ContainerRegistryEventConnectedRegistry) UnmarshalJSON(data []byte) err return nil } +// MarshalJSON implements the json.Marshaller interface for type ContainerRegistryEventData. +func (c ContainerRegistryEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "action", c.Action) + populate(objectMap, "actor", c.Actor) + populate(objectMap, "connectedRegistry", c.ConnectedRegistry) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "request", c.Request) + populate(objectMap, "source", c.Source) + populate(objectMap, "target", c.Target) + populateDateTimeRFC3339(objectMap, "timestamp", c.Timestamp) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerRegistryEventData. +func (c *ContainerRegistryEventData) UnmarshalJSON(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 "action": + err = unpopulate(val, "Action", &c.Action) + delete(rawMsg, key) + case "actor": + err = unpopulate(val, "Actor", &c.Actor) + delete(rawMsg, key) + case "connectedRegistry": + err = unpopulate(val, "ConnectedRegistry", &c.ConnectedRegistry) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "request": + err = unpopulate(val, "Request", &c.Request) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &c.Source) + delete(rawMsg, key) + case "target": + err = unpopulate(val, "Target", &c.Target) + delete(rawMsg, key) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &c.Timestamp) + 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 ContainerRegistryEventRequest. func (c ContainerRegistryEventRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5831,18 +6765,81 @@ func (c *ContainerServiceClusterSupportEndingEventData) UnmarshalJSON(data []byt return nil } -// MarshalJSON implements the json.Marshaller interface for type ContainerServiceNewKubernetesVersionAvailableEventData. -func (c ContainerServiceNewKubernetesVersionAvailableEventData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContainerServiceClusterSupportEventData. +func (c ContainerServiceClusterSupportEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kubernetesVersion", c.KubernetesVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerServiceClusterSupportEventData. +func (c *ContainerServiceClusterSupportEventData) UnmarshalJSON(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 "kubernetesVersion": + err = unpopulate(val, "KubernetesVersion", &c.KubernetesVersion) + 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 ContainerServiceNewKubernetesVersionAvailableEventData. +func (c ContainerServiceNewKubernetesVersionAvailableEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "latestPreviewKubernetesVersion", c.LatestPreviewKubernetesVersion) + populate(objectMap, "latestStableKubernetesVersion", c.LatestStableKubernetesVersion) + populate(objectMap, "latestSupportedKubernetesVersion", c.LatestSupportedKubernetesVersion) + populate(objectMap, "lowestMinorKubernetesVersion", c.LowestMinorKubernetesVersion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerServiceNewKubernetesVersionAvailableEventData. +func (c *ContainerServiceNewKubernetesVersionAvailableEventData) UnmarshalJSON(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 "latestPreviewKubernetesVersion": + err = unpopulate(val, "LatestPreviewKubernetesVersion", &c.LatestPreviewKubernetesVersion) + delete(rawMsg, key) + case "latestStableKubernetesVersion": + err = unpopulate(val, "LatestStableKubernetesVersion", &c.LatestStableKubernetesVersion) + delete(rawMsg, key) + case "latestSupportedKubernetesVersion": + err = unpopulate(val, "LatestSupportedKubernetesVersion", &c.LatestSupportedKubernetesVersion) + delete(rawMsg, key) + case "lowestMinorKubernetesVersion": + err = unpopulate(val, "LowestMinorKubernetesVersion", &c.LowestMinorKubernetesVersion) + 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 ContainerServiceNodePoolRollingEventData. +func (c ContainerServiceNodePoolRollingEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "latestPreviewKubernetesVersion", c.LatestPreviewKubernetesVersion) - populate(objectMap, "latestStableKubernetesVersion", c.LatestStableKubernetesVersion) - populate(objectMap, "latestSupportedKubernetesVersion", c.LatestSupportedKubernetesVersion) - populate(objectMap, "lowestMinorKubernetesVersion", c.LowestMinorKubernetesVersion) + populate(objectMap, "nodePoolName", c.NodePoolName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerServiceNewKubernetesVersionAvailableEventData. -func (c *ContainerServiceNewKubernetesVersionAvailableEventData) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerServiceNodePoolRollingEventData. +func (c *ContainerServiceNodePoolRollingEventData) UnmarshalJSON(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) @@ -5850,17 +6847,8 @@ func (c *ContainerServiceNewKubernetesVersionAvailableEventData) UnmarshalJSON(d for key, val := range rawMsg { var err error switch key { - case "latestPreviewKubernetesVersion": - err = unpopulate(val, "LatestPreviewKubernetesVersion", &c.LatestPreviewKubernetesVersion) - delete(rawMsg, key) - case "latestStableKubernetesVersion": - err = unpopulate(val, "LatestStableKubernetesVersion", &c.LatestStableKubernetesVersion) - delete(rawMsg, key) - case "latestSupportedKubernetesVersion": - err = unpopulate(val, "LatestSupportedKubernetesVersion", &c.LatestSupportedKubernetesVersion) - delete(rawMsg, key) - case "lowestMinorKubernetesVersion": - err = unpopulate(val, "LowestMinorKubernetesVersion", &c.LowestMinorKubernetesVersion) + case "nodePoolName": + err = unpopulate(val, "NodePoolName", &c.NodePoolName) delete(rawMsg, key) } if err != nil { @@ -6083,6 +7071,115 @@ func (d *DeviceConnectionStateEventInfo) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DeviceConnectionStateEventProperties. +func (d DeviceConnectionStateEventProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deviceConnectionStateEventInfo", d.DeviceConnectionStateEventInfo) + populate(objectMap, "deviceId", d.DeviceID) + populate(objectMap, "hubName", d.HubName) + populate(objectMap, "moduleId", d.ModuleID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceConnectionStateEventProperties. +func (d *DeviceConnectionStateEventProperties) UnmarshalJSON(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 "deviceConnectionStateEventInfo": + err = unpopulate(val, "DeviceConnectionStateEventInfo", &d.DeviceConnectionStateEventInfo) + delete(rawMsg, key) + case "deviceId": + err = unpopulate(val, "DeviceID", &d.DeviceID) + delete(rawMsg, key) + case "hubName": + err = unpopulate(val, "HubName", &d.HubName) + delete(rawMsg, key) + case "moduleId": + err = unpopulate(val, "ModuleID", &d.ModuleID) + 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 DeviceLifeCycleEventProperties. +func (d DeviceLifeCycleEventProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deviceId", d.DeviceID) + populate(objectMap, "hubName", d.HubName) + populate(objectMap, "twin", d.Twin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceLifeCycleEventProperties. +func (d *DeviceLifeCycleEventProperties) UnmarshalJSON(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 "deviceId": + err = unpopulate(val, "DeviceID", &d.DeviceID) + delete(rawMsg, key) + case "hubName": + err = unpopulate(val, "HubName", &d.HubName) + delete(rawMsg, key) + case "twin": + err = unpopulate(val, "Twin", &d.Twin) + 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 DeviceTelemetryEventProperties. +func (d DeviceTelemetryEventProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "body", d.Body) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemProperties", d.SystemProperties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceTelemetryEventProperties. +func (d *DeviceTelemetryEventProperties) UnmarshalJSON(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 "body": + err = unpopulate(val, "Body", &d.Body) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "systemProperties": + err = unpopulate(val, "SystemProperties", &d.SystemProperties) + 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 DeviceTwinInfo. func (d DeviceTwinInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6270,6 +7367,57 @@ func (d *DeviceTwinProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EdgeSolutionVersionPublishedEventData. +func (e EdgeSolutionVersionPublishedEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apiVersion", e.APIVersion) + populate(objectMap, "callbackUrl", e.CallbackURL) + populate(objectMap, "externalValidationId", e.ExternalValidationID) + populate(objectMap, "solutionTemplateId", e.SolutionTemplateID) + populate(objectMap, "solutionTemplateVersionId", e.SolutionTemplateVersionID) + populate(objectMap, "solutionVersionId", e.SolutionVersionID) + populate(objectMap, "targetId", e.TargetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EdgeSolutionVersionPublishedEventData. +func (e *EdgeSolutionVersionPublishedEventData) UnmarshalJSON(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 "apiVersion": + err = unpopulate(val, "APIVersion", &e.APIVersion) + delete(rawMsg, key) + case "callbackUrl": + err = unpopulate(val, "CallbackURL", &e.CallbackURL) + delete(rawMsg, key) + case "externalValidationId": + err = unpopulate(val, "ExternalValidationID", &e.ExternalValidationID) + delete(rawMsg, key) + case "solutionTemplateId": + err = unpopulate(val, "SolutionTemplateID", &e.SolutionTemplateID) + delete(rawMsg, key) + case "solutionTemplateVersionId": + err = unpopulate(val, "SolutionTemplateVersionID", &e.SolutionTemplateVersionID) + delete(rawMsg, key) + case "solutionVersionId": + err = unpopulate(val, "SolutionVersionID", &e.SolutionVersionID) + delete(rawMsg, key) + case "targetId": + err = unpopulate(val, "TargetID", &e.TargetID) + 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 EventGridMQTTClientCreatedOrUpdatedEventData. func (e EventGridMQTTClientCreatedOrUpdatedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6356,6 +7504,41 @@ func (e *EventGridMQTTClientDeletedEventData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type EventGridMQTTClientEventData. +func (e EventGridMQTTClientEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientAuthenticationName", e.ClientAuthenticationName) + populate(objectMap, "clientName", e.ClientName) + populate(objectMap, "namespaceName", e.NamespaceName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EventGridMQTTClientEventData. +func (e *EventGridMQTTClientEventData) UnmarshalJSON(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 "clientAuthenticationName": + err = unpopulate(val, "ClientAuthenticationName", &e.ClientAuthenticationName) + delete(rawMsg, key) + case "clientName": + err = unpopulate(val, "ClientName", &e.ClientName) + delete(rawMsg, key) + case "namespaceName": + err = unpopulate(val, "NamespaceName", &e.NamespaceName) + 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 EventGridMQTTClientSessionConnectedEventData. func (e EventGridMQTTClientSessionConnectedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6947,7 +8130,7 @@ func (i *IOTHubDeviceTelemetryEventData) UnmarshalJSON(data []byte) error { } // MarshalJSON implements the json.Marshaller interface for type InternalACSMessageChannelEventError. -func (i internalACSMessageChannelEventError) MarshalJSON() ([]byte, error) { +func (i InternalACSMessageChannelEventError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "channelCode", i.ChannelCode) populate(objectMap, "channelMessage", i.ChannelMessage) @@ -6955,7 +8138,7 @@ func (i internalACSMessageChannelEventError) MarshalJSON() ([]byte, error) { } // UnmarshalJSON implements the json.Unmarshaller interface for type InternalACSMessageChannelEventError. -func (i *internalACSMessageChannelEventError) UnmarshalJSON(data []byte) error { +func (i *InternalACSMessageChannelEventError) UnmarshalJSON(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) @@ -6978,7 +8161,7 @@ func (i *internalACSMessageChannelEventError) UnmarshalJSON(data []byte) error { } // MarshalJSON implements the json.Marshaller interface for type InternalACSRouterCommunicationError. -func (i internalACSRouterCommunicationError) MarshalJSON() ([]byte, error) { +func (i InternalACSRouterCommunicationError) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "code", i.Code) populate(objectMap, "details", i.Details) @@ -6989,7 +8172,7 @@ func (i internalACSRouterCommunicationError) MarshalJSON() ([]byte, error) { } // UnmarshalJSON implements the json.Unmarshaller interface for type InternalACSRouterCommunicationError. -func (i *internalACSRouterCommunicationError) UnmarshalJSON(data []byte) error { +func (i *InternalACSRouterCommunicationError) UnmarshalJSON(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) @@ -7804,6 +8987,45 @@ func (m *MapsGeofenceEnteredEventData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MapsGeofenceEventProperties. +func (m MapsGeofenceEventProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "expiredGeofenceGeometryId", m.ExpiredGeofenceGeometryID) + populate(objectMap, "geometries", m.Geometries) + populate(objectMap, "invalidPeriodGeofenceGeometryId", m.InvalidPeriodGeofenceGeometryID) + populate(objectMap, "isEventPublished", m.IsEventPublished) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MapsGeofenceEventProperties. +func (m *MapsGeofenceEventProperties) UnmarshalJSON(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 "expiredGeofenceGeometryId": + err = unpopulate(val, "ExpiredGeofenceGeometryID", &m.ExpiredGeofenceGeometryID) + delete(rawMsg, key) + case "geometries": + err = unpopulate(val, "Geometries", &m.Geometries) + delete(rawMsg, key) + case "invalidPeriodGeofenceGeometryId": + err = unpopulate(val, "InvalidPeriodGeofenceGeometryID", &m.InvalidPeriodGeofenceGeometryID) + delete(rawMsg, key) + case "isEventPublished": + err = unpopulate(val, "IsEventPublished", &m.IsEventPublished) + 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 MapsGeofenceExitedEventData. func (m MapsGeofenceExitedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -8958,6 +10180,37 @@ func (r *ResourceNotificationsResourceDeletedDetails) UnmarshalJSON(data []byte) return nil } +// MarshalJSON implements the json.Marshaller interface for type ResourceNotificationsResourceDeletedEventData. +func (r ResourceNotificationsResourceDeletedEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationalInfo", r.OperationalDetails) + populate(objectMap, "resourceInfo", r.ResourceDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceNotificationsResourceDeletedEventData. +func (r *ResourceNotificationsResourceDeletedEventData) UnmarshalJSON(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 "operationalInfo": + err = unpopulate(val, "OperationalDetails", &r.OperationalDetails) + delete(rawMsg, key) + case "resourceInfo": + err = unpopulate(val, "ResourceDetails", &r.ResourceDetails) + 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 ResourceNotificationsResourceManagementCreatedOrUpdatedEventData. func (r ResourceNotificationsResourceManagementCreatedOrUpdatedEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -9071,6 +10324,41 @@ func (r *ResourceNotificationsResourceUpdatedDetails) UnmarshalJSON(data []byte) return nil } +// MarshalJSON implements the json.Marshaller interface for type ResourceNotificationsResourceUpdatedEventData. +func (r ResourceNotificationsResourceUpdatedEventData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apiVersion", r.APIVersion) + populate(objectMap, "operationalInfo", r.OperationalDetails) + populate(objectMap, "resourceInfo", r.ResourceDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceNotificationsResourceUpdatedEventData. +func (r *ResourceNotificationsResourceUpdatedEventData) UnmarshalJSON(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 "apiVersion": + err = unpopulate(val, "APIVersion", &r.APIVersion) + delete(rawMsg, key) + case "operationalInfo": + err = unpopulate(val, "OperationalDetails", &r.OperationalDetails) + delete(rawMsg, key) + case "resourceInfo": + err = unpopulate(val, "ResourceDetails", &r.ResourceDetails) + 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 ResourceWriteCancelEventData. func (r ResourceWriteCancelEventData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/messaging/eventgrid/azsystemevents/time_rfc1123.go b/sdk/messaging/eventgrid/azsystemevents/time_rfc1123.go deleted file mode 100644 index c3039fc970bf..000000000000 --- a/sdk/messaging/eventgrid/azsystemevents/time_rfc1123.go +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. - -package azsystemevents - -import ( - "encoding/json" - "fmt" - "reflect" - "strings" - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" -) - -const ( - dateTimeRFC1123JSON = `"` + time.RFC1123 + `"` -) - -type dateTimeRFC1123 time.Time - -func (t dateTimeRFC1123) MarshalJSON() ([]byte, error) { - b := []byte(time.Time(t).Format(dateTimeRFC1123JSON)) - return b, nil -} - -func (t dateTimeRFC1123) MarshalText() ([]byte, error) { - b := []byte(time.Time(t).Format(time.RFC1123)) - return b, nil -} - -func (t *dateTimeRFC1123) UnmarshalJSON(data []byte) error { - p, err := time.Parse(dateTimeRFC1123JSON, strings.ToUpper(string(data))) - *t = dateTimeRFC1123(p) - return err -} - -func (t *dateTimeRFC1123) UnmarshalText(data []byte) error { - if len(data) == 0 { - return nil - } - p, err := time.Parse(time.RFC1123, string(data)) - *t = dateTimeRFC1123(p) - return err -} - -func (t dateTimeRFC1123) String() string { - return time.Time(t).Format(time.RFC1123) -} - -func populateDateTimeRFC1123(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] = (*dateTimeRFC1123)(t) -} - -func unpopulateDateTimeRFC1123(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC1123 - 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/messaging/eventgrid/azsystemevents/time_rfc3339.go b/sdk/messaging/eventgrid/azsystemevents/time_rfc3339.go index 11a0123184b4..8a459a317ff0 100644 --- a/sdk/messaging/eventgrid/azsystemevents/time_rfc3339.go +++ b/sdk/messaging/eventgrid/azsystemevents/time_rfc3339.go @@ -7,12 +7,11 @@ package azsystemevents import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "regexp" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. diff --git a/sdk/messaging/eventgrid/azsystemevents/tsp-location.yaml b/sdk/messaging/eventgrid/azsystemevents/tsp-location.yaml index bded21a43c24..4d36bcdbfb8c 100644 --- a/sdk/messaging/eventgrid/azsystemevents/tsp-location.yaml +++ b/sdk/messaging/eventgrid/azsystemevents/tsp-location.yaml @@ -1,3 +1,4 @@ directory: specification/eventgrid/Azure.Messaging.EventGrid.SystemEvents -commit: a2676eccfc3db4abecc73519206d6ef3ff5826c9 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/agricultureplatform/armagricultureplatform/CHANGELOG.md b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/CHANGELOG.md new file mode 100644 index 000000000000..908f909d68f2 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2025-05-13) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agricultureplatform/armagricultureplatform` 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/agricultureplatform/armagricultureplatform/LICENSE.txt b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/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/agricultureplatform/armagricultureplatform/README.md b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/README.md new file mode 100644 index 000000000000..9520481a19d4 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/README.md @@ -0,0 +1,90 @@ +# Azure Agricultureplatform Module for Go + +The `armagricultureplatform` module provides operations for working with Azure Agricultureplatform. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/agricultureplatform/armagricultureplatform) + +# 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 Agricultureplatform module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agricultureplatform/armagricultureplatform +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Agricultureplatform. 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 Agricultureplatform 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 := armagricultureplatform.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 := armagricultureplatform.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.NewAgriServiceClient() +``` + +## 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 `Agricultureplatform` 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/agricultureplatform/armagricultureplatform/agriservice_client.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/agriservice_client.go new file mode 100644 index 000000000000..dab322d1ad7e --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/agriservice_client.go @@ -0,0 +1,520 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armagricultureplatform + +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" +) + +// AgriServiceClient contains the methods for the AgriService group. +// Don't use this type directly, use NewAgriServiceClient() instead. +type AgriServiceClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAgriServiceClient creates a new instance of AgriServiceClient 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 NewAgriServiceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AgriServiceClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AgriServiceClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a AgriServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - agriServiceResourceName - The name of the AgriService resource. +// - resource - Resource create parameters. +// - options - AgriServiceClientBeginCreateOrUpdateOptions contains the optional parameters for the AgriServiceClient.BeginCreateOrUpdate +// method. +func (client *AgriServiceClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, agriServiceResourceName string, resource AgriServiceResource, options *AgriServiceClientBeginCreateOrUpdateOptions) (*runtime.Poller[AgriServiceClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, agriServiceResourceName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgriServiceClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgriServiceClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a AgriServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +func (client *AgriServiceClient) createOrUpdate(ctx context.Context, resourceGroupName string, agriServiceResourceName string, resource AgriServiceResource, options *AgriServiceClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AgriServiceClient.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, agriServiceResourceName, 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 *AgriServiceClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, agriServiceResourceName string, resource AgriServiceResource, _ *AgriServiceClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if agriServiceResourceName == "" { + return nil, errors.New("parameter agriServiceResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agriServiceResourceName}", url.PathEscape(agriServiceResourceName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a AgriServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - agriServiceResourceName - The name of the AgriService resource. +// - options - AgriServiceClientBeginDeleteOptions contains the optional parameters for the AgriServiceClient.BeginDelete method. +func (client *AgriServiceClient) BeginDelete(ctx context.Context, resourceGroupName string, agriServiceResourceName string, options *AgriServiceClientBeginDeleteOptions) (*runtime.Poller[AgriServiceClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, agriServiceResourceName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgriServiceClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgriServiceClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a AgriServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +func (client *AgriServiceClient) deleteOperation(ctx context.Context, resourceGroupName string, agriServiceResourceName string, options *AgriServiceClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "AgriServiceClient.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, agriServiceResourceName, 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 *AgriServiceClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, agriServiceResourceName string, _ *AgriServiceClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if agriServiceResourceName == "" { + return nil, errors.New("parameter agriServiceResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agriServiceResourceName}", url.PathEscape(agriServiceResourceName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a AgriServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - agriServiceResourceName - The name of the AgriService resource. +// - options - AgriServiceClientGetOptions contains the optional parameters for the AgriServiceClient.Get method. +func (client *AgriServiceClient) Get(ctx context.Context, resourceGroupName string, agriServiceResourceName string, options *AgriServiceClientGetOptions) (AgriServiceClientGetResponse, error) { + var err error + const operationName = "AgriServiceClient.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, agriServiceResourceName, options) + if err != nil { + return AgriServiceClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AgriServiceClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgriServiceClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AgriServiceClient) getCreateRequest(ctx context.Context, resourceGroupName string, agriServiceResourceName string, _ *AgriServiceClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if agriServiceResourceName == "" { + return nil, errors.New("parameter agriServiceResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agriServiceResourceName}", url.PathEscape(agriServiceResourceName)) + 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-06-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 *AgriServiceClient) getHandleResponse(resp *http.Response) (AgriServiceClientGetResponse, error) { + result := AgriServiceClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgriServiceResource); err != nil { + return AgriServiceClientGetResponse{}, err + } + return result, nil +} + +// ListAvailableSolutions - Returns the list of available agri solutions. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - agriServiceResourceName - The name of the AgriService resource. +// - options - AgriServiceClientListAvailableSolutionsOptions contains the optional parameters for the AgriServiceClient.ListAvailableSolutions +// method. +func (client *AgriServiceClient) ListAvailableSolutions(ctx context.Context, resourceGroupName string, agriServiceResourceName string, options *AgriServiceClientListAvailableSolutionsOptions) (AgriServiceClientListAvailableSolutionsResponse, error) { + var err error + const operationName = "AgriServiceClient.ListAvailableSolutions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.listAvailableSolutionsCreateRequest(ctx, resourceGroupName, agriServiceResourceName, options) + if err != nil { + return AgriServiceClientListAvailableSolutionsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AgriServiceClientListAvailableSolutionsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AgriServiceClientListAvailableSolutionsResponse{}, err + } + resp, err := client.listAvailableSolutionsHandleResponse(httpResp) + return resp, err +} + +// listAvailableSolutionsCreateRequest creates the ListAvailableSolutions request. +func (client *AgriServiceClient) listAvailableSolutionsCreateRequest(ctx context.Context, resourceGroupName string, agriServiceResourceName string, _ *AgriServiceClientListAvailableSolutionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}/listAvailableSolutions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if agriServiceResourceName == "" { + return nil, errors.New("parameter agriServiceResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agriServiceResourceName}", url.PathEscape(agriServiceResourceName)) + 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-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAvailableSolutionsHandleResponse handles the ListAvailableSolutions response. +func (client *AgriServiceClient) listAvailableSolutionsHandleResponse(resp *http.Response) (AgriServiceClientListAvailableSolutionsResponse, error) { + result := AgriServiceClientListAvailableSolutionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AvailableAgriSolutionListResult); err != nil { + return AgriServiceClientListAvailableSolutionsResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List AgriServiceResource resources by resource group +// +// Generated from API version 2024-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AgriServiceClientListByResourceGroupOptions contains the optional parameters for the AgriServiceClient.NewListByResourceGroupPager +// method. +func (client *AgriServiceClient) NewListByResourceGroupPager(resourceGroupName string, options *AgriServiceClientListByResourceGroupOptions) *runtime.Pager[AgriServiceClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[AgriServiceClientListByResourceGroupResponse]{ + More: func(page AgriServiceClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AgriServiceClientListByResourceGroupResponse) (AgriServiceClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AgriServiceClient.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 AgriServiceClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *AgriServiceClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AgriServiceClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-06-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 *AgriServiceClient) listByResourceGroupHandleResponse(resp *http.Response) (AgriServiceClientListByResourceGroupResponse, error) { + result := AgriServiceClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgriServiceResourceListResult); err != nil { + return AgriServiceClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List AgriServiceResource resources by subscription ID +// +// Generated from API version 2024-06-01-preview +// - options - AgriServiceClientListBySubscriptionOptions contains the optional parameters for the AgriServiceClient.NewListBySubscriptionPager +// method. +func (client *AgriServiceClient) NewListBySubscriptionPager(options *AgriServiceClientListBySubscriptionOptions) *runtime.Pager[AgriServiceClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AgriServiceClientListBySubscriptionResponse]{ + More: func(page AgriServiceClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AgriServiceClientListBySubscriptionResponse) (AgriServiceClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AgriServiceClient.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 AgriServiceClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *AgriServiceClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AgriServiceClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.AgriculturePlatform/agriServices" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-06-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *AgriServiceClient) listBySubscriptionHandleResponse(resp *http.Response) (AgriServiceClientListBySubscriptionResponse, error) { + result := AgriServiceClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AgriServiceResourceListResult); err != nil { + return AgriServiceClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a AgriServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - agriServiceResourceName - The name of the AgriService resource. +// - properties - The resource properties to be updated. +// - options - AgriServiceClientBeginUpdateOptions contains the optional parameters for the AgriServiceClient.BeginUpdate method. +func (client *AgriServiceClient) BeginUpdate(ctx context.Context, resourceGroupName string, agriServiceResourceName string, properties AgriServiceResourceUpdate, options *AgriServiceClientBeginUpdateOptions) (*runtime.Poller[AgriServiceClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, agriServiceResourceName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AgriServiceClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AgriServiceClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a AgriServiceResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-06-01-preview +func (client *AgriServiceClient) update(ctx context.Context, resourceGroupName string, agriServiceResourceName string, properties AgriServiceResourceUpdate, options *AgriServiceClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "AgriServiceClient.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, agriServiceResourceName, 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 *AgriServiceClient) updateCreateRequest(ctx context.Context, resourceGroupName string, agriServiceResourceName string, properties AgriServiceResourceUpdate, _ *AgriServiceClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if agriServiceResourceName == "" { + return nil, errors.New("parameter agriServiceResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{agriServiceResourceName}", url.PathEscape(agriServiceResourceName)) + 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-06-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/agricultureplatform/armagricultureplatform/agriservice_client_example_test.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/agriservice_client_example_test.go new file mode 100644 index 000000000000..6708e8a302dd --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/agriservice_client_example_test.go @@ -0,0 +1,638 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armagricultureplatform_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/agricultureplatform/armagricultureplatform" + "log" +) + +// Generated from example definition: 2024-06-01-preview/AgriService_CreateOrUpdate_MaximumSet_Gen.json +func ExampleAgriServiceClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armagricultureplatform.NewClientFactory("83D293F5-DEFD-4D48-B120-1DC713BE338A", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAgriServiceClient().BeginCreateOrUpdate(ctx, "rgopenapi", "abc123", armagricultureplatform.AgriServiceResource{ + Properties: &armagricultureplatform.AgriServiceResourceProperties{ + Config: &armagricultureplatform.AgriServiceConfig{}, + ManagedOnBehalfOfConfiguration: &armagricultureplatform.ManagedOnBehalfOfConfiguration{}, + DataConnectorCredentials: []*armagricultureplatform.DataConnectorCredentialMap{ + { + Key: to.Ptr("BackendAADApplicationCredentials"), + Value: &armagricultureplatform.DataConnectorCredentials{ + ClientID: to.Ptr("dce298a8-1eec-481a-a8f9-a3cd5a8257b2"), + }, + }, + }, + InstalledSolutions: []*armagricultureplatform.InstalledSolutionMap{ + { + Key: to.Ptr("bayerAgPowered.cwum"), + Value: &armagricultureplatform.Solution{ + ApplicationName: to.Ptr("bayerAgPowered.cwum"), + }, + }, + }, + }, + Identity: &armagricultureplatform.ManagedServiceIdentity{ + Type: to.Ptr(armagricultureplatform.ManagedServiceIdentityTypeNone), + UserAssignedIdentities: map[string]*armagricultureplatform.UserAssignedIdentity{ + "key4955": {}, + }, + }, + SKU: &armagricultureplatform.SKU{ + Name: to.Ptr("kfl"), + Tier: to.Ptr(armagricultureplatform.SKUTierFree), + Size: to.Ptr("r"), + Family: to.Ptr("xerdhxyjwrypvxphavgrtjphtohf"), + Capacity: to.Ptr[int32](20), + }, + Tags: map[string]*string{ + "key137": to.Ptr("oxwansfetzzgdwl"), + }, + Location: to.Ptr("pkneuknooprpqirnugzwbkiie"), + }, 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 = armagricultureplatform.AgriServiceClientCreateOrUpdateResponse{ + // AgriServiceResource: &armagricultureplatform.AgriServiceResource{ + // Properties: &armagricultureplatform.AgriServiceResourceProperties{ + // ProvisioningState: to.Ptr(armagricultureplatform.ProvisioningStateSucceeded), + // Config: &armagricultureplatform.AgriServiceConfig{ + // InstanceURI: to.Ptr("zwjvrpcyzxrsizerkzhwkergjrmxqe"), + // Version: to.Ptr("cwhczenyyxtmslccbv"), + // AppServiceResourceID: to.Ptr("icecbrltkdsresejoidqvlybwsbomotnbnmfa"), + // CosmosDbResourceID: to.Ptr("ygzwcdwitjqshybczyukwhaxkomgimvqdmqsdsx"), + // StorageAccountResourceID: to.Ptr("vdruhddgygpkcwngnvbstyitkzocrwnidpeowekohvisiprcmjzpe"), + // KeyVaultResourceID: to.Ptr("egw"), + // RedisCacheResourceID: to.Ptr("fxhznzcilbmqilgnryyazmhkssbhk"), + // }, + // ManagedOnBehalfOfConfiguration: &armagricultureplatform.ManagedOnBehalfOfConfiguration{ + // MoboBrokerResources: []*armagricultureplatform.MoboBrokerResource{ + // { + // ID: to.Ptr("bnthrkwfkfeorrzvtdxbfz"), + // }, + // }, + // }, + // DataConnectorCredentials: []*armagricultureplatform.DataConnectorCredentialMap{ + // { + // Key: to.Ptr("BackendAADApplicationCredentials"), + // Value: &armagricultureplatform.DataConnectorCredentials{ + // ClientID: to.Ptr("dce298a8-1eec-481a-a8f9-a3cd5a8257b2"), + // }, + // }, + // }, + // InstalledSolutions: []*armagricultureplatform.InstalledSolutionMap{ + // { + // Key: to.Ptr("bayerAgPowered.cwum"), + // Value: &armagricultureplatform.Solution{ + // ApplicationName: to.Ptr("bayerAgPowered.cwum"), + // }, + // }, + // }, + // }, + // Identity: &armagricultureplatform.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // TenantID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // Type: to.Ptr(armagricultureplatform.ManagedServiceIdentityTypeNone), + // UserAssignedIdentities: map[string]*armagricultureplatform.UserAssignedIdentity{ + // "key4955": &armagricultureplatform.UserAssignedIdentity{ + // PrincipalID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // ClientID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // }, + // }, + // }, + // SKU: &armagricultureplatform.SKU{ + // Name: to.Ptr("kfl"), + // Tier: to.Ptr(armagricultureplatform.SKUTierFree), + // Size: to.Ptr("r"), + // Family: to.Ptr("xerdhxyjwrypvxphavgrtjphtohf"), + // Capacity: to.Ptr[int32](20), + // }, + // Tags: map[string]*string{ + // "key137": to.Ptr("oxwansfetzzgdwl"), + // }, + // Location: to.Ptr("pkneuknooprpqirnugzwbkiie"), + // ID: to.Ptr("/subscriptions/12345678-1234-1234-1234-123456789abc/resourceGroups/myResourceGroup/providers/Microsoft.Storage/storageAccounts/myStorageAccount"), + // Name: to.Ptr("mnvxvlitiwbndijhbmgiejz"), + // Type: to.Ptr("fvvidjmentwsi"), + // SystemData: &armagricultureplatform.SystemData{ + // CreatedBy: to.Ptr("gthxegufst"), + // CreatedByType: to.Ptr(armagricultureplatform.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-16T11:47:57.784Z"); return t}()), + // LastModifiedBy: to.Ptr("ovgqctuakdgemocstvwqmhyufe"), + // LastModifiedByType: to.Ptr(armagricultureplatform.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-16T11:47:57.784Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-06-01-preview/AgriService_Delete_MaximumSet_Gen.json +func ExampleAgriServiceClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armagricultureplatform.NewClientFactory("83D293F5-DEFD-4D48-B120-1DC713BE338A", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAgriServiceClient().BeginDelete(ctx, "rgopenapi", "abc123", 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-06-01-preview/AgriService_Get_MaximumSet_Gen.json +func ExampleAgriServiceClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armagricultureplatform.NewClientFactory("83D293F5-DEFD-4D48-B120-1DC713BE338A", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAgriServiceClient().Get(ctx, "rgopenapi", "abc123", 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 = armagricultureplatform.AgriServiceClientGetResponse{ + // AgriServiceResource: &armagricultureplatform.AgriServiceResource{ + // Properties: &armagricultureplatform.AgriServiceResourceProperties{ + // ProvisioningState: to.Ptr(armagricultureplatform.ProvisioningStateSucceeded), + // Config: &armagricultureplatform.AgriServiceConfig{ + // InstanceURI: to.Ptr("zwjvrpcyzxrsizerkzhwkergjrmxqe"), + // Version: to.Ptr("cwhczenyyxtmslccbv"), + // AppServiceResourceID: to.Ptr("icecbrltkdsresejoidqvlybwsbomotnbnmfa"), + // CosmosDbResourceID: to.Ptr("ygzwcdwitjqshybczyukwhaxkomgimvqdmqsdsx"), + // StorageAccountResourceID: to.Ptr("vdruhddgygpkcwngnvbstyitkzocrwnidpeowekohvisiprcmjzpe"), + // KeyVaultResourceID: to.Ptr("egw"), + // RedisCacheResourceID: to.Ptr("fxhznzcilbmqilgnryyazmhkssbhk"), + // }, + // ManagedOnBehalfOfConfiguration: &armagricultureplatform.ManagedOnBehalfOfConfiguration{ + // MoboBrokerResources: []*armagricultureplatform.MoboBrokerResource{ + // { + // ID: to.Ptr("bnthrkwfkfeorrzvtdxbfz"), + // }, + // }, + // }, + // DataConnectorCredentials: []*armagricultureplatform.DataConnectorCredentialMap{ + // { + // Key: to.Ptr("BackendAADApplicationCredentials"), + // Value: &armagricultureplatform.DataConnectorCredentials{ + // ClientID: to.Ptr("dce298a8-1eec-481a-a8f9-a3cd5a8257b2"), + // }, + // }, + // }, + // InstalledSolutions: []*armagricultureplatform.InstalledSolutionMap{ + // { + // Key: to.Ptr("bayerAgPowered.cwum"), + // Value: &armagricultureplatform.Solution{ + // ApplicationName: to.Ptr("bayerAgPowered.cwum"), + // }, + // }, + // }, + // }, + // Identity: &armagricultureplatform.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // TenantID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // Type: to.Ptr(armagricultureplatform.ManagedServiceIdentityTypeNone), + // UserAssignedIdentities: map[string]*armagricultureplatform.UserAssignedIdentity{ + // "key4955": &armagricultureplatform.UserAssignedIdentity{ + // PrincipalID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // ClientID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // }, + // }, + // }, + // SKU: &armagricultureplatform.SKU{ + // Name: to.Ptr("kfl"), + // Tier: to.Ptr(armagricultureplatform.SKUTierFree), + // Size: to.Ptr("r"), + // Family: to.Ptr("xerdhxyjwrypvxphavgrtjphtohf"), + // Capacity: to.Ptr[int32](20), + // }, + // Tags: map[string]*string{ + // "key137": to.Ptr("oxwansfetzzgdwl"), + // }, + // Location: to.Ptr("pkneuknooprpqirnugzwbkiie"), + // ID: to.Ptr("/subscriptions/E1D6D0B0-6FE4-45D5-9C3F-50F4D1AF2F39/resourceGroups/rgopenapi/providers/Microsoft.AgriculturePlatform/agriServices/TKXbP-22-NGGH-1Eh55xGX"), + // Name: to.Ptr("mnvxvlitiwbndijhbmgiejz"), + // Type: to.Ptr("fvvidjmentwsi"), + // SystemData: &armagricultureplatform.SystemData{ + // CreatedBy: to.Ptr("gthxegufst"), + // CreatedByType: to.Ptr(armagricultureplatform.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-16T11:47:57.784Z"); return t}()), + // LastModifiedBy: to.Ptr("ovgqctuakdgemocstvwqmhyufe"), + // LastModifiedByType: to.Ptr(armagricultureplatform.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-16T11:47:57.784Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2024-06-01-preview/AgriService_ListAvailableSolutions_MaximumSet_Gen.json +func ExampleAgriServiceClient_ListAvailableSolutions() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armagricultureplatform.NewClientFactory("83D293F5-DEFD-4D48-B120-1DC713BE338A", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewAgriServiceClient().ListAvailableSolutions(ctx, "rgopenapi", "abc123", 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 = armagricultureplatform.AgriServiceClientListAvailableSolutionsResponse{ + // AvailableAgriSolutionListResult: &armagricultureplatform.AvailableAgriSolutionListResult{ + // Solutions: []*armagricultureplatform.DataManagerForAgricultureSolution{ + // { + // PartnerID: to.Ptr("dugq"), + // SolutionID: to.Ptr("sgdbaiygsffxcokkxygtepomgyspz"), + // PartnerTenantID: to.Ptr("nxvc"), + // DataAccessScopes: []*string{ + // to.Ptr("ognbthj"), + // }, + // MarketPlaceOfferDetails: &armagricultureplatform.MarketPlaceOfferDetails{ + // SaasOfferID: to.Ptr("xbzymkxqoggdcjrfyvpqaee"), + // PublisherID: to.Ptr("ihvsmtzqbgwudeicsawqovi"), + // }, + // SaasApplicationID: to.Ptr("ypzopzkbzukfxalmeu"), + // AccessAzureDataManagerForAgricultureApplicationID: to.Ptr("khzwsikjlokrhdhotartjeofpiw"), + // AccessAzureDataManagerForAgricultureApplicationName: to.Ptr("ztfnwoksuurzlizk"), + // IsValidateInput: to.Ptr(true), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2024-06-01-preview/AgriService_ListByResourceGroup_MaximumSet_Gen.json +func ExampleAgriServiceClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armagricultureplatform.NewClientFactory("83D293F5-DEFD-4D48-B120-1DC713BE338A", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAgriServiceClient().NewListByResourceGroupPager("rgopenapi", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armagricultureplatform.AgriServiceClientListByResourceGroupResponse{ + // AgriServiceResourceListResult: armagricultureplatform.AgriServiceResourceListResult{ + // Value: []*armagricultureplatform.AgriServiceResource{ + // { + // Properties: &armagricultureplatform.AgriServiceResourceProperties{ + // ProvisioningState: to.Ptr(armagricultureplatform.ProvisioningStateSucceeded), + // Config: &armagricultureplatform.AgriServiceConfig{ + // InstanceURI: to.Ptr("zwjvrpcyzxrsizerkzhwkergjrmxqe"), + // Version: to.Ptr("cwhczenyyxtmslccbv"), + // AppServiceResourceID: to.Ptr("icecbrltkdsresejoidqvlybwsbomotnbnmfa"), + // CosmosDbResourceID: to.Ptr("ygzwcdwitjqshybczyukwhaxkomgimvqdmqsdsx"), + // StorageAccountResourceID: to.Ptr("vdruhddgygpkcwngnvbstyitkzocrwnidpeowekohvisiprcmjzpe"), + // KeyVaultResourceID: to.Ptr("egw"), + // RedisCacheResourceID: to.Ptr("fxhznzcilbmqilgnryyazmhkssbhk"), + // }, + // ManagedOnBehalfOfConfiguration: &armagricultureplatform.ManagedOnBehalfOfConfiguration{ + // MoboBrokerResources: []*armagricultureplatform.MoboBrokerResource{ + // { + // ID: to.Ptr("bnthrkwfkfeorrzvtdxbfz"), + // }, + // }, + // }, + // DataConnectorCredentials: []*armagricultureplatform.DataConnectorCredentialMap{ + // { + // Key: to.Ptr("BackendAADApplicationCredentials"), + // Value: &armagricultureplatform.DataConnectorCredentials{ + // ClientID: to.Ptr("dce298a8-1eec-481a-a8f9-a3cd5a8257b2"), + // }, + // }, + // }, + // InstalledSolutions: []*armagricultureplatform.InstalledSolutionMap{ + // { + // Key: to.Ptr("bayerAgPowered.cwum"), + // Value: &armagricultureplatform.Solution{ + // ApplicationName: to.Ptr("bayerAgPowered.cwum"), + // }, + // }, + // }, + // }, + // Identity: &armagricultureplatform.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // TenantID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // Type: to.Ptr(armagricultureplatform.ManagedServiceIdentityTypeNone), + // UserAssignedIdentities: map[string]*armagricultureplatform.UserAssignedIdentity{ + // "key4955": &armagricultureplatform.UserAssignedIdentity{ + // PrincipalID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // ClientID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // }, + // }, + // }, + // SKU: &armagricultureplatform.SKU{ + // Name: to.Ptr("kfl"), + // Tier: to.Ptr(armagricultureplatform.SKUTierFree), + // Size: to.Ptr("r"), + // Family: to.Ptr("xerdhxyjwrypvxphavgrtjphtohf"), + // Capacity: to.Ptr[int32](20), + // }, + // Tags: map[string]*string{ + // "key137": to.Ptr("oxwansfetzzgdwl"), + // }, + // Location: to.Ptr("pkneuknooprpqirnugzwbkiie"), + // ID: to.Ptr("/subscriptions/E1D6D0B0-6FE4-45D5-9C3F-50F4D1AF2F39/resourceGroups/rgopenapi/providers/Microsoft.AgriculturePlatform/agriServices/TKXbP-22-NGGH-1Eh55xGX"), + // Name: to.Ptr("mnvxvlitiwbndijhbmgiejz"), + // Type: to.Ptr("fvvidjmentwsi"), + // SystemData: &armagricultureplatform.SystemData{ + // CreatedBy: to.Ptr("gthxegufst"), + // CreatedByType: to.Ptr(armagricultureplatform.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-16T11:47:57.784Z"); return t}()), + // LastModifiedBy: to.Ptr("ovgqctuakdgemocstvwqmhyufe"), + // LastModifiedByType: to.Ptr(armagricultureplatform.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-16T11:47:57.784Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-06-01-preview/AgriService_ListBySubscription_MaximumSet_Gen.json +func ExampleAgriServiceClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armagricultureplatform.NewClientFactory("83D293F5-DEFD-4D48-B120-1DC713BE338A", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewAgriServiceClient().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 = armagricultureplatform.AgriServiceClientListBySubscriptionResponse{ + // AgriServiceResourceListResult: armagricultureplatform.AgriServiceResourceListResult{ + // Value: []*armagricultureplatform.AgriServiceResource{ + // { + // Properties: &armagricultureplatform.AgriServiceResourceProperties{ + // ProvisioningState: to.Ptr(armagricultureplatform.ProvisioningStateSucceeded), + // Config: &armagricultureplatform.AgriServiceConfig{ + // InstanceURI: to.Ptr("zwjvrpcyzxrsizerkzhwkergjrmxqe"), + // Version: to.Ptr("cwhczenyyxtmslccbv"), + // AppServiceResourceID: to.Ptr("icecbrltkdsresejoidqvlybwsbomotnbnmfa"), + // CosmosDbResourceID: to.Ptr("ygzwcdwitjqshybczyukwhaxkomgimvqdmqsdsx"), + // StorageAccountResourceID: to.Ptr("vdruhddgygpkcwngnvbstyitkzocrwnidpeowekohvisiprcmjzpe"), + // KeyVaultResourceID: to.Ptr("egw"), + // RedisCacheResourceID: to.Ptr("fxhznzcilbmqilgnryyazmhkssbhk"), + // }, + // ManagedOnBehalfOfConfiguration: &armagricultureplatform.ManagedOnBehalfOfConfiguration{ + // MoboBrokerResources: []*armagricultureplatform.MoboBrokerResource{ + // { + // ID: to.Ptr("bnthrkwfkfeorrzvtdxbfz"), + // }, + // }, + // }, + // DataConnectorCredentials: []*armagricultureplatform.DataConnectorCredentialMap{ + // { + // Key: to.Ptr("BackendAADApplicationCredentials"), + // Value: &armagricultureplatform.DataConnectorCredentials{ + // ClientID: to.Ptr("dce298a8-1eec-481a-a8f9-a3cd5a8257b2"), + // }, + // }, + // }, + // InstalledSolutions: []*armagricultureplatform.InstalledSolutionMap{ + // { + // Key: to.Ptr("bayerAgPowered.cwum"), + // Value: &armagricultureplatform.Solution{ + // ApplicationName: to.Ptr("bayerAgPowered.cwum"), + // }, + // }, + // }, + // }, + // Identity: &armagricultureplatform.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // TenantID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // Type: to.Ptr(armagricultureplatform.ManagedServiceIdentityTypeNone), + // UserAssignedIdentities: map[string]*armagricultureplatform.UserAssignedIdentity{ + // "key4955": &armagricultureplatform.UserAssignedIdentity{ + // PrincipalID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // ClientID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // }, + // }, + // }, + // SKU: &armagricultureplatform.SKU{ + // Name: to.Ptr("kfl"), + // Tier: to.Ptr(armagricultureplatform.SKUTierFree), + // Size: to.Ptr("r"), + // Family: to.Ptr("xerdhxyjwrypvxphavgrtjphtohf"), + // Capacity: to.Ptr[int32](20), + // }, + // Tags: map[string]*string{ + // "key137": to.Ptr("oxwansfetzzgdwl"), + // }, + // Location: to.Ptr("pkneuknooprpqirnugzwbkiie"), + // ID: to.Ptr("/subscriptions/E1D6D0B0-6FE4-45D5-9C3F-50F4D1AF2F39/resourceGroups/rgopenapi/providers/Microsoft.AgriculturePlatform/agriServices/TKXbP-22-NGGH-1Eh55xGX"), + // Name: to.Ptr("mnvxvlitiwbndijhbmgiejz"), + // Type: to.Ptr("fvvidjmentwsi"), + // SystemData: &armagricultureplatform.SystemData{ + // CreatedBy: to.Ptr("gthxegufst"), + // CreatedByType: to.Ptr(armagricultureplatform.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-16T11:47:57.784Z"); return t}()), + // LastModifiedBy: to.Ptr("ovgqctuakdgemocstvwqmhyufe"), + // LastModifiedByType: to.Ptr(armagricultureplatform.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-16T11:47:57.784Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2024-06-01-preview/AgriService_Update_MaximumSet_Gen.json +func ExampleAgriServiceClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armagricultureplatform.NewClientFactory("83D293F5-DEFD-4D48-B120-1DC713BE338A", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewAgriServiceClient().BeginUpdate(ctx, "rgopenapi", "abc123", armagricultureplatform.AgriServiceResourceUpdate{ + Identity: &armagricultureplatform.ManagedServiceIdentity{ + Type: to.Ptr(armagricultureplatform.ManagedServiceIdentityTypeNone), + UserAssignedIdentities: map[string]*armagricultureplatform.UserAssignedIdentity{ + "key4771": {}, + }, + }, + SKU: &armagricultureplatform.SKU{ + Name: to.Ptr("tbdtdfffkar"), + Tier: to.Ptr(armagricultureplatform.SKUTierFree), + Size: to.Ptr("iusaqqj"), + Family: to.Ptr("hxojswlgs"), + Capacity: to.Ptr[int32](22), + }, + Tags: map[string]*string{ + "key9006": to.Ptr("kuzlwpujbql"), + }, + Properties: &armagricultureplatform.AgriServiceResourceUpdateProperties{ + Config: &armagricultureplatform.AgriServiceConfig{}, + DataConnectorCredentials: []*armagricultureplatform.DataConnectorCredentialMap{ + { + Key: to.Ptr("BackendAADApplicationCredentials"), + Value: &armagricultureplatform.DataConnectorCredentials{ + ClientID: to.Ptr("dce298a8-1eec-481a-a8f9-a3cd5a8257b2"), + }, + }, + }, + InstalledSolutions: []*armagricultureplatform.InstalledSolutionMap{ + { + Key: to.Ptr("bayerAgPowered.cwum"), + Value: &armagricultureplatform.Solution{ + ApplicationName: to.Ptr("bayerAgPowered.cwum"), + }, + }, + }, + }, + }, 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 = armagricultureplatform.AgriServiceClientUpdateResponse{ + // AgriServiceResource: &armagricultureplatform.AgriServiceResource{ + // Properties: &armagricultureplatform.AgriServiceResourceProperties{ + // ProvisioningState: to.Ptr(armagricultureplatform.ProvisioningStateSucceeded), + // Config: &armagricultureplatform.AgriServiceConfig{ + // InstanceURI: to.Ptr("zwjvrpcyzxrsizerkzhwkergjrmxqe"), + // Version: to.Ptr("cwhczenyyxtmslccbv"), + // AppServiceResourceID: to.Ptr("icecbrltkdsresejoidqvlybwsbomotnbnmfa"), + // CosmosDbResourceID: to.Ptr("ygzwcdwitjqshybczyukwhaxkomgimvqdmqsdsx"), + // StorageAccountResourceID: to.Ptr("vdruhddgygpkcwngnvbstyitkzocrwnidpeowekohvisiprcmjzpe"), + // KeyVaultResourceID: to.Ptr("egw"), + // RedisCacheResourceID: to.Ptr("fxhznzcilbmqilgnryyazmhkssbhk"), + // }, + // ManagedOnBehalfOfConfiguration: &armagricultureplatform.ManagedOnBehalfOfConfiguration{ + // MoboBrokerResources: []*armagricultureplatform.MoboBrokerResource{ + // { + // ID: to.Ptr("bnthrkwfkfeorrzvtdxbfz"), + // }, + // }, + // }, + // DataConnectorCredentials: []*armagricultureplatform.DataConnectorCredentialMap{ + // { + // Key: to.Ptr("BackendAADApplicationCredentials"), + // Value: &armagricultureplatform.DataConnectorCredentials{ + // ClientID: to.Ptr("dce298a8-1eec-481a-a8f9-a3cd5a8257b2"), + // }, + // }, + // }, + // InstalledSolutions: []*armagricultureplatform.InstalledSolutionMap{ + // { + // Key: to.Ptr("bayerAgPowered.cwum"), + // Value: &armagricultureplatform.Solution{ + // ApplicationName: to.Ptr("bayerAgPowered.cwum"), + // }, + // }, + // }, + // }, + // Identity: &armagricultureplatform.ManagedServiceIdentity{ + // PrincipalID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // TenantID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // Type: to.Ptr(armagricultureplatform.ManagedServiceIdentityTypeNone), + // UserAssignedIdentities: map[string]*armagricultureplatform.UserAssignedIdentity{ + // "key4955": &armagricultureplatform.UserAssignedIdentity{ + // PrincipalID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // ClientID: to.Ptr("16763be4-6022-406e-a950-fcd5018633ca"), + // }, + // }, + // }, + // SKU: &armagricultureplatform.SKU{ + // Name: to.Ptr("kfl"), + // Tier: to.Ptr(armagricultureplatform.SKUTierFree), + // Size: to.Ptr("r"), + // Family: to.Ptr("xerdhxyjwrypvxphavgrtjphtohf"), + // Capacity: to.Ptr[int32](20), + // }, + // Tags: map[string]*string{ + // "key137": to.Ptr("oxwansfetzzgdwl"), + // }, + // Location: to.Ptr("pkneuknooprpqirnugzwbkiie"), + // ID: to.Ptr("/subscriptions/E1D6D0B0-6FE4-45D5-9C3F-50F4D1AF2F39/resourceGroups/rgopenapi/providers/Microsoft.AgriculturePlatform/agriServices/TKXbP-22-NGGH-1Eh55xGX"), + // Name: to.Ptr("mnvxvlitiwbndijhbmgiejz"), + // Type: to.Ptr("fvvidjmentwsi"), + // SystemData: &armagricultureplatform.SystemData{ + // CreatedBy: to.Ptr("gthxegufst"), + // CreatedByType: to.Ptr(armagricultureplatform.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-16T11:47:57.784Z"); return t}()), + // LastModifiedBy: to.Ptr("ovgqctuakdgemocstvwqmhyufe"), + // LastModifiedByType: to.Ptr(armagricultureplatform.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-16T11:47:57.784Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/agricultureplatform/armagricultureplatform/ci.yml b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/ci.yml new file mode 100644 index 000000000000..a3768a147ebe --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/ci.yml @@ -0,0 +1,27 @@ +# 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/agricultureplatform/armagricultureplatform/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/agricultureplatform/armagricultureplatform/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/agricultureplatform/armagricultureplatform' diff --git a/sdk/resourcemanager/agricultureplatform/armagricultureplatform/client_factory.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/client_factory.go new file mode 100644 index 000000000000..fc4d5938554a --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/client_factory.go @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armagricultureplatform + +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 +} + +// NewAgriServiceClient creates a new instance of AgriServiceClient. +func (c *ClientFactory) NewAgriServiceClient() *AgriServiceClient { + return &AgriServiceClient{ + 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/agricultureplatform/armagricultureplatform/constants.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/constants.go new file mode 100644 index 000000000000..d653565928a4 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/constants.go @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armagricultureplatform + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agricultureplatform/armagricultureplatform" + 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, + } +} + +// AuthCredentialsKind - Types of different kind of Data connector auth credentials supported. +type AuthCredentialsKind string + +const ( + // AuthCredentialsKindAPIKeyAuthCredentials - API Key Auth Credential type + AuthCredentialsKindAPIKeyAuthCredentials AuthCredentialsKind = "ApiKeyAuthCredentials" + // AuthCredentialsKindOAuthClientCredentials - OAuth Client Credential type + AuthCredentialsKindOAuthClientCredentials AuthCredentialsKind = "OAuthClientCredentials" +) + +// PossibleAuthCredentialsKindValues returns the possible values for the AuthCredentialsKind const type. +func PossibleAuthCredentialsKindValues() []AuthCredentialsKind { + return []AuthCredentialsKind{ + AuthCredentialsKindAPIKeyAuthCredentials, + AuthCredentialsKindOAuthClientCredentials, + } +} + +// 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, + } +} + +// 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 - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProvisioningState - The status of the current operation. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - The resource create request has been accepted + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - The resource is being deleted + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - The resource is being provisioned + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - The resource is updating + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} + +// SKUTier - This field is required to be implemented by the Resource Provider if the service has more than one tier, but +// is not required on a PUT. +type SKUTier string + +const ( + // SKUTierBasic - The Basic service tier. + SKUTierBasic SKUTier = "Basic" + // SKUTierFree - The Free service tier. + SKUTierFree SKUTier = "Free" + // SKUTierPremium - The Premium service tier. + SKUTierPremium SKUTier = "Premium" + // SKUTierStandard - The Standard service tier. + SKUTierStandard SKUTier = "Standard" +) + +// PossibleSKUTierValues returns the possible values for the SKUTier const type. +func PossibleSKUTierValues() []SKUTier { + return []SKUTier{ + SKUTierBasic, + SKUTierFree, + SKUTierPremium, + SKUTierStandard, + } +} diff --git a/sdk/resourcemanager/agricultureplatform/armagricultureplatform/fake/agriservice_server.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/fake/agriservice_server.go new file mode 100644 index 000000000000..cfbcd463b901 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/fake/agriservice_server.go @@ -0,0 +1,413 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the 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/agricultureplatform/armagricultureplatform" + "net/http" + "net/url" + "regexp" +) + +// AgriServiceServer is a fake server for instances of the armagricultureplatform.AgriServiceClient type. +type AgriServiceServer struct { + // BeginCreateOrUpdate is the fake for method AgriServiceClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, agriServiceResourceName string, resource armagricultureplatform.AgriServiceResource, options *armagricultureplatform.AgriServiceClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armagricultureplatform.AgriServiceClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method AgriServiceClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, agriServiceResourceName string, options *armagricultureplatform.AgriServiceClientBeginDeleteOptions) (resp azfake.PollerResponder[armagricultureplatform.AgriServiceClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AgriServiceClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, agriServiceResourceName string, options *armagricultureplatform.AgriServiceClientGetOptions) (resp azfake.Responder[armagricultureplatform.AgriServiceClientGetResponse], errResp azfake.ErrorResponder) + + // ListAvailableSolutions is the fake for method AgriServiceClient.ListAvailableSolutions + // HTTP status codes to indicate success: http.StatusOK + ListAvailableSolutions func(ctx context.Context, resourceGroupName string, agriServiceResourceName string, options *armagricultureplatform.AgriServiceClientListAvailableSolutionsOptions) (resp azfake.Responder[armagricultureplatform.AgriServiceClientListAvailableSolutionsResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method AgriServiceClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armagricultureplatform.AgriServiceClientListByResourceGroupOptions) (resp azfake.PagerResponder[armagricultureplatform.AgriServiceClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method AgriServiceClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armagricultureplatform.AgriServiceClientListBySubscriptionOptions) (resp azfake.PagerResponder[armagricultureplatform.AgriServiceClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method AgriServiceClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, agriServiceResourceName string, properties armagricultureplatform.AgriServiceResourceUpdate, options *armagricultureplatform.AgriServiceClientBeginUpdateOptions) (resp azfake.PollerResponder[armagricultureplatform.AgriServiceClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewAgriServiceServerTransport creates a new instance of AgriServiceServerTransport with the provided implementation. +// The returned AgriServiceServerTransport instance is connected to an instance of armagricultureplatform.AgriServiceClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAgriServiceServerTransport(srv *AgriServiceServer) *AgriServiceServerTransport { + return &AgriServiceServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armagricultureplatform.AgriServiceClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armagricultureplatform.AgriServiceClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armagricultureplatform.AgriServiceClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armagricultureplatform.AgriServiceClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armagricultureplatform.AgriServiceClientUpdateResponse]](), + } +} + +// AgriServiceServerTransport connects instances of armagricultureplatform.AgriServiceClient to instances of AgriServiceServer. +// Don't use this type directly, use NewAgriServiceServerTransport instead. +type AgriServiceServerTransport struct { + srv *AgriServiceServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armagricultureplatform.AgriServiceClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armagricultureplatform.AgriServiceClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armagricultureplatform.AgriServiceClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armagricultureplatform.AgriServiceClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armagricultureplatform.AgriServiceClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for AgriServiceServerTransport. +func (a *AgriServiceServerTransport) 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 *AgriServiceServerTransport) 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 agriServiceServerTransportInterceptor != nil { + res.resp, res.err, intercepted = agriServiceServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AgriServiceClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AgriServiceClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AgriServiceClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AgriServiceClient.ListAvailableSolutions": + res.resp, res.err = a.dispatchListAvailableSolutions(req) + case "AgriServiceClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AgriServiceClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + case "AgriServiceClient.BeginUpdate": + res.resp, res.err = a.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 (a *AgriServiceServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := a.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AgriculturePlatform/agriServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armagricultureplatform.AgriServiceResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + agriServiceResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("agriServiceResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, agriServiceResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + a.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) { + a.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) { + a.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (a *AgriServiceServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if a.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := a.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AgriculturePlatform/agriServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + agriServiceResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("agriServiceResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginDelete(req.Context(), resourceGroupNameParam, agriServiceResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + a.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) { + a.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) { + a.beginDelete.remove(req) + } + + return resp, nil +} + +func (a *AgriServiceServerTransport) 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\.AgriculturePlatform/agriServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + agriServiceResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("agriServiceResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, agriServiceResourceNameParam, 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).AgriServiceResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AgriServiceServerTransport) dispatchListAvailableSolutions(req *http.Request) (*http.Response, error) { + if a.srv.ListAvailableSolutions == nil { + return nil, &nonRetriableError{errors.New("fake for method ListAvailableSolutions not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AgriculturePlatform/agriServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listAvailableSolutions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + agriServiceResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("agriServiceResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.ListAvailableSolutions(req.Context(), resourceGroupNameParam, agriServiceResourceNameParam, 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).AvailableAgriSolutionListResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AgriServiceServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := a.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AgriculturePlatform/agriServices` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + resp := a.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + a.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armagricultureplatform.AgriServiceClientListByResourceGroupResponse, 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) { + a.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + a.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (a *AgriServiceServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := a.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AgriculturePlatform/agriServices` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := a.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armagricultureplatform.AgriServiceClientListBySubscriptionResponse, 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) { + a.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + a.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (a *AgriServiceServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if a.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := a.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AgriculturePlatform/agriServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armagricultureplatform.AgriServiceResourceUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + agriServiceResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("agriServiceResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginUpdate(req.Context(), resourceGroupNameParam, agriServiceResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + a.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) { + a.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) { + a.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to AgriServiceServerTransport +var agriServiceServerTransportInterceptor 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/agricultureplatform/armagricultureplatform/fake/internal.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/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/agricultureplatform/armagricultureplatform/fake/operations_server.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/fake/operations_server.go new file mode 100644 index 000000000000..e48ead23e155 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/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/agricultureplatform/armagricultureplatform" + "net/http" +) + +// OperationsServer is a fake server for instances of the armagricultureplatform.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armagricultureplatform.OperationsClientListOptions) (resp azfake.PagerResponder[armagricultureplatform.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armagricultureplatform.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[armagricultureplatform.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armagricultureplatform.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armagricultureplatform.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 *armagricultureplatform.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/agricultureplatform/armagricultureplatform/fake/server_factory.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/fake/server_factory.go new file mode 100644 index 000000000000..cd51757cb195 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/fake/server_factory.go @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armagricultureplatform.ClientFactory type. +type ServerFactory struct { + // AgriServiceServer contains the fakes for client AgriServiceClient + AgriServiceServer AgriServiceServer + + // 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 armagricultureplatform.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 armagricultureplatform.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trAgriServiceServer *AgriServiceServerTransport + 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 "AgriServiceClient": + initServer(s, &s.trAgriServiceServer, func() *AgriServiceServerTransport { return NewAgriServiceServerTransport(&s.srv.AgriServiceServer) }) + resp, err = s.trAgriServiceServer.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/agricultureplatform/armagricultureplatform/go.mod b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/go.mod new file mode 100644 index 000000000000..3893dcf227b8 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/go.mod @@ -0,0 +1,23 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agricultureplatform/armagricultureplatform + +go 1.23.0 + +toolchain go1.23.8 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 + 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.36.0 // indirect + golang.org/x/net v0.37.0 // indirect + golang.org/x/sys v0.31.0 // indirect + golang.org/x/text v0.23.0 // indirect +) diff --git a/sdk/resourcemanager/agricultureplatform/armagricultureplatform/go.sum b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/go.sum new file mode 100644 index 000000000000..1f92486fbbcf --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/go.sum @@ -0,0 +1,33 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= +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/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= +golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/agricultureplatform/armagricultureplatform/models.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/models.go new file mode 100644 index 000000000000..d22110ec5f60 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/models.go @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armagricultureplatform + +import "time" + +// AgriServiceConfig - Config of the AgriService resource instance. +type AgriServiceConfig struct { + // READ-ONLY; App service resource Id. + AppServiceResourceID *string + + // READ-ONLY; Cosmos Db resource Id. + CosmosDbResourceID *string + + // READ-ONLY; Instance URI of the AgriService instance. + InstanceURI *string + + // READ-ONLY; Key vault resource Id. + KeyVaultResourceID *string + + // READ-ONLY; Redis cache resource Id. + RedisCacheResourceID *string + + // READ-ONLY; Storage account resource Id. + StorageAccountResourceID *string + + // READ-ONLY; Version of AgriService instance. + Version *string +} + +// AgriServiceResource - Schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. +type AgriServiceResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // READ-ONLY; The name of the AgriService resource. + Name *string + + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + + // The resource-specific properties for this resource. + Properties *AgriServiceResourceProperties + + // The SKU (Stock Keeping Unit) assigned to this resource. + SKU *SKU + + // 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 +} + +// AgriServiceResourceListResult - The response of a AgriServiceResource list operation. +type AgriServiceResourceListResult struct { + // REQUIRED; The AgriServiceResource items on this page + Value []*AgriServiceResource + + // The link to the next page of items + NextLink *string +} + +// AgriServiceResourceProperties - Details of the Agriculture AgriDataManager. +type AgriServiceResourceProperties struct { + // Config of the AgriService instance. + Config *AgriServiceConfig + + // Data connector credentials of AgriService instance. + DataConnectorCredentials []*DataConnectorCredentialMap + + // AgriService installed solutions. + InstalledSolutions []*InstalledSolutionMap + + // READ-ONLY; Managed On Behalf Of Configuration. + ManagedOnBehalfOfConfiguration *ManagedOnBehalfOfConfiguration + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// AgriServiceResourceUpdate - The type used for update operations of the AgriServiceResource. +type AgriServiceResourceUpdate struct { + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity + + // The resource-specific properties for this resource. + Properties *AgriServiceResourceUpdateProperties + + // The SKU (Stock Keeping Unit) assigned to this resource. + SKU *SKU + + // Resource tags. + Tags map[string]*string +} + +// AgriServiceResourceUpdateProperties - The updatable properties of the AgriServiceResource. +type AgriServiceResourceUpdateProperties struct { + // Config of the AgriService instance. + Config *AgriServiceConfig + + // Data connector credentials of AgriService instance. + DataConnectorCredentials []*DataConnectorCredentialMap + + // AgriService installed solutions. + InstalledSolutions []*InstalledSolutionMap +} + +// AvailableAgriSolutionListResult - The list of available agri solutions. +type AvailableAgriSolutionListResult struct { + // REQUIRED; Agri solutions list. + Solutions []*DataManagerForAgricultureSolution +} + +// DataConnectorCredentialMap - Mapping of data connector credentials. +type DataConnectorCredentialMap struct { + // REQUIRED; The key representing the credential. + Key *string + + // REQUIRED; The data connector credential value. + Value *DataConnectorCredentials +} + +// DataConnectorCredentials - The properties related to an AgriService data connector. +type DataConnectorCredentials struct { + // Client Id associated with the provider, if type of credentials is OAuthClientCredentials. + ClientID *string + + // Name of the key vault key. + KeyName *string + + // Uri of the key vault + KeyVaultURI *string + + // Version of the key vault key. + KeyVersion *string + + // Type of credential. + Kind *AuthCredentialsKind +} + +// DataManagerForAgricultureSolution - Data Manager for Agriculture solution. +type DataManagerForAgricultureSolution struct { + // REQUIRED; Entra application Id used to access azure data manager for agriculture instance. + AccessAzureDataManagerForAgricultureApplicationID *string + + // REQUIRED; Entra application name used to access azure data manager for agriculture instance. + AccessAzureDataManagerForAgricultureApplicationName *string + + // REQUIRED; Data access scopes. + DataAccessScopes []*string + + // REQUIRED; Whether solution inference will validate input. + IsValidateInput *bool + + // REQUIRED; Marketplace offer details. + MarketPlaceOfferDetails *MarketPlaceOfferDetails + + // REQUIRED; Partner Id. + PartnerID *string + + // REQUIRED; Partner tenant Id. + PartnerTenantID *string + + // REQUIRED; Saas application Id. + SaasApplicationID *string + + // REQUIRED; Solution Id. + SolutionID *string +} + +// InstalledSolutionMap - Mapping of installed solutions. +type InstalledSolutionMap struct { + // REQUIRED; The key representing the installed solution. + Key *string + + // REQUIRED; The installed solution value. + Value *Solution +} + +// ManagedOnBehalfOfConfiguration - Configuration of the managed on behalf of resource. +type ManagedOnBehalfOfConfiguration struct { + // READ-ONLY; Associated MoboBrokerResources. + MoboBrokerResources []*MoboBrokerResource +} + +// 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 +} + +// MarketPlaceOfferDetails - Marketplace offer details of Agri solution. +type MarketPlaceOfferDetails struct { + // REQUIRED; Publisher Id. + PublisherID *string + + // REQUIRED; Saas offer Id. + SaasOfferID *string +} + +// MoboBrokerResource - MoboBroker resource. +type MoboBrokerResource struct { + // READ-ONLY; The fully qualified resource ID of the MoboBroker resource. + // Example: `/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}` + ID *string +} + +// Operation - REST API 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 +} + +// SKU - The resource model definition representing SKU +type SKU struct { + // REQUIRED; The name of the SKU. Ex - P3. It is typically a letter+number code + Name *string + + // If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the + // resource this may be omitted. + Capacity *int32 + + // If the service has different generations of hardware, for the same SKU, then that can be captured here. + Family *string + + // The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + Size *string + + // This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required + // on a PUT. + Tier *SKUTier +} + +// Solution - Installed data manager for Agriculture solution detail. +type Solution struct { + // Application name of the solution. + ApplicationName *string + + // Marketplace publisher Id. + MarketPlacePublisherID *string + + // Partner Id. + PartnerID *string + + // Plan Id. + PlanID *string + + // Saas subscription Id. + SaasSubscriptionID *string + + // Saas subscription name. + SaasSubscriptionName *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 +} + +// 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 +} diff --git a/sdk/resourcemanager/agricultureplatform/armagricultureplatform/models_serde.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/models_serde.go new file mode 100644 index 000000000000..4d559c90cf17 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/models_serde.go @@ -0,0 +1,886 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armagricultureplatform + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AgriServiceConfig. +func (a AgriServiceConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appServiceResourceId", a.AppServiceResourceID) + populate(objectMap, "cosmosDbResourceId", a.CosmosDbResourceID) + populate(objectMap, "instanceUri", a.InstanceURI) + populate(objectMap, "keyVaultResourceId", a.KeyVaultResourceID) + populate(objectMap, "redisCacheResourceId", a.RedisCacheResourceID) + populate(objectMap, "storageAccountResourceId", a.StorageAccountResourceID) + populate(objectMap, "version", a.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgriServiceConfig. +func (a *AgriServiceConfig) UnmarshalJSON(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 "appServiceResourceId": + err = unpopulate(val, "AppServiceResourceID", &a.AppServiceResourceID) + delete(rawMsg, key) + case "cosmosDbResourceId": + err = unpopulate(val, "CosmosDbResourceID", &a.CosmosDbResourceID) + delete(rawMsg, key) + case "instanceUri": + err = unpopulate(val, "InstanceURI", &a.InstanceURI) + delete(rawMsg, key) + case "keyVaultResourceId": + err = unpopulate(val, "KeyVaultResourceID", &a.KeyVaultResourceID) + delete(rawMsg, key) + case "redisCacheResourceId": + err = unpopulate(val, "RedisCacheResourceID", &a.RedisCacheResourceID) + delete(rawMsg, key) + case "storageAccountResourceId": + err = unpopulate(val, "StorageAccountResourceID", &a.StorageAccountResourceID) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &a.Version) + 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 AgriServiceResource. +func (a AgriServiceResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "sku", a.SKU) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgriServiceResource. +func (a *AgriServiceResource) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + 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 "sku": + err = unpopulate(val, "SKU", &a.SKU) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + 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 AgriServiceResourceListResult. +func (a AgriServiceResourceListResult) 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 AgriServiceResourceListResult. +func (a *AgriServiceResourceListResult) UnmarshalJSON(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 AgriServiceResourceProperties. +func (a AgriServiceResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "config", a.Config) + populate(objectMap, "dataConnectorCredentials", a.DataConnectorCredentials) + populate(objectMap, "installedSolutions", a.InstalledSolutions) + populate(objectMap, "managedOnBehalfOfConfiguration", a.ManagedOnBehalfOfConfiguration) + populate(objectMap, "provisioningState", a.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgriServiceResourceProperties. +func (a *AgriServiceResourceProperties) UnmarshalJSON(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 "config": + err = unpopulate(val, "Config", &a.Config) + delete(rawMsg, key) + case "dataConnectorCredentials": + err = unpopulate(val, "DataConnectorCredentials", &a.DataConnectorCredentials) + delete(rawMsg, key) + case "installedSolutions": + err = unpopulate(val, "InstalledSolutions", &a.InstalledSolutions) + delete(rawMsg, key) + case "managedOnBehalfOfConfiguration": + err = unpopulate(val, "ManagedOnBehalfOfConfiguration", &a.ManagedOnBehalfOfConfiguration) + 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 AgriServiceResourceUpdate. +func (a AgriServiceResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "identity", a.Identity) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "sku", a.SKU) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgriServiceResourceUpdate. +func (a *AgriServiceResourceUpdate) UnmarshalJSON(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 "identity": + err = unpopulate(val, "Identity", &a.Identity) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &a.SKU) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + 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 AgriServiceResourceUpdateProperties. +func (a AgriServiceResourceUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "config", a.Config) + populate(objectMap, "dataConnectorCredentials", a.DataConnectorCredentials) + populate(objectMap, "installedSolutions", a.InstalledSolutions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AgriServiceResourceUpdateProperties. +func (a *AgriServiceResourceUpdateProperties) UnmarshalJSON(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 "config": + err = unpopulate(val, "Config", &a.Config) + delete(rawMsg, key) + case "dataConnectorCredentials": + err = unpopulate(val, "DataConnectorCredentials", &a.DataConnectorCredentials) + delete(rawMsg, key) + case "installedSolutions": + err = unpopulate(val, "InstalledSolutions", &a.InstalledSolutions) + 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 AvailableAgriSolutionListResult. +func (a AvailableAgriSolutionListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "solutions", a.Solutions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AvailableAgriSolutionListResult. +func (a *AvailableAgriSolutionListResult) UnmarshalJSON(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 "solutions": + err = unpopulate(val, "Solutions", &a.Solutions) + 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 DataConnectorCredentialMap. +func (d DataConnectorCredentialMap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", d.Key) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectorCredentialMap. +func (d *DataConnectorCredentialMap) UnmarshalJSON(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 "key": + err = unpopulate(val, "Key", &d.Key) + 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 DataConnectorCredentials. +func (d DataConnectorCredentials) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", d.ClientID) + populate(objectMap, "keyName", d.KeyName) + populate(objectMap, "keyVaultUri", d.KeyVaultURI) + populate(objectMap, "keyVersion", d.KeyVersion) + populate(objectMap, "kind", d.Kind) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataConnectorCredentials. +func (d *DataConnectorCredentials) UnmarshalJSON(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 "keyName": + err = unpopulate(val, "KeyName", &d.KeyName) + delete(rawMsg, key) + case "keyVaultUri": + err = unpopulate(val, "KeyVaultURI", &d.KeyVaultURI) + delete(rawMsg, key) + case "keyVersion": + err = unpopulate(val, "KeyVersion", &d.KeyVersion) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + 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 DataManagerForAgricultureSolution. +func (d DataManagerForAgricultureSolution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessAzureDataManagerForAgricultureApplicationId", d.AccessAzureDataManagerForAgricultureApplicationID) + populate(objectMap, "accessAzureDataManagerForAgricultureApplicationName", d.AccessAzureDataManagerForAgricultureApplicationName) + populate(objectMap, "dataAccessScopes", d.DataAccessScopes) + populate(objectMap, "isValidateInput", d.IsValidateInput) + populate(objectMap, "marketPlaceOfferDetails", d.MarketPlaceOfferDetails) + populate(objectMap, "partnerId", d.PartnerID) + populate(objectMap, "partnerTenantId", d.PartnerTenantID) + populate(objectMap, "saasApplicationId", d.SaasApplicationID) + populate(objectMap, "solutionId", d.SolutionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataManagerForAgricultureSolution. +func (d *DataManagerForAgricultureSolution) UnmarshalJSON(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 "accessAzureDataManagerForAgricultureApplicationId": + err = unpopulate(val, "AccessAzureDataManagerForAgricultureApplicationID", &d.AccessAzureDataManagerForAgricultureApplicationID) + delete(rawMsg, key) + case "accessAzureDataManagerForAgricultureApplicationName": + err = unpopulate(val, "AccessAzureDataManagerForAgricultureApplicationName", &d.AccessAzureDataManagerForAgricultureApplicationName) + delete(rawMsg, key) + case "dataAccessScopes": + err = unpopulate(val, "DataAccessScopes", &d.DataAccessScopes) + delete(rawMsg, key) + case "isValidateInput": + err = unpopulate(val, "IsValidateInput", &d.IsValidateInput) + delete(rawMsg, key) + case "marketPlaceOfferDetails": + err = unpopulate(val, "MarketPlaceOfferDetails", &d.MarketPlaceOfferDetails) + delete(rawMsg, key) + case "partnerId": + err = unpopulate(val, "PartnerID", &d.PartnerID) + delete(rawMsg, key) + case "partnerTenantId": + err = unpopulate(val, "PartnerTenantID", &d.PartnerTenantID) + delete(rawMsg, key) + case "saasApplicationId": + err = unpopulate(val, "SaasApplicationID", &d.SaasApplicationID) + delete(rawMsg, key) + case "solutionId": + err = unpopulate(val, "SolutionID", &d.SolutionID) + 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 InstalledSolutionMap. +func (i InstalledSolutionMap) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", i.Key) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InstalledSolutionMap. +func (i *InstalledSolutionMap) UnmarshalJSON(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 "key": + err = unpopulate(val, "Key", &i.Key) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", i, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedOnBehalfOfConfiguration. +func (m ManagedOnBehalfOfConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "moboBrokerResources", m.MoboBrokerResources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ManagedOnBehalfOfConfiguration. +func (m *ManagedOnBehalfOfConfiguration) UnmarshalJSON(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 "moboBrokerResources": + err = unpopulate(val, "MoboBrokerResources", &m.MoboBrokerResources) + 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 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 MarketPlaceOfferDetails. +func (m MarketPlaceOfferDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "publisherId", m.PublisherID) + populate(objectMap, "saasOfferId", m.SaasOfferID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MarketPlaceOfferDetails. +func (m *MarketPlaceOfferDetails) UnmarshalJSON(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 "publisherId": + err = unpopulate(val, "PublisherID", &m.PublisherID) + delete(rawMsg, key) + case "saasOfferId": + err = unpopulate(val, "SaasOfferID", &m.SaasOfferID) + 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 MoboBrokerResource. +func (m MoboBrokerResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MoboBrokerResource. +func (m *MoboBrokerResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + } + 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 SKU. +func (s SKU) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "capacity", s.Capacity) + populate(objectMap, "family", s.Family) + populate(objectMap, "name", s.Name) + populate(objectMap, "size", s.Size) + populate(objectMap, "tier", s.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SKU. +func (s *SKU) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "capacity": + err = unpopulate(val, "Capacity", &s.Capacity) + delete(rawMsg, key) + case "family": + err = unpopulate(val, "Family", &s.Family) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "size": + err = unpopulate(val, "Size", &s.Size) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &s.Tier) + 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 Solution. +func (s Solution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "applicationName", s.ApplicationName) + populate(objectMap, "marketPlacePublisherId", s.MarketPlacePublisherID) + populate(objectMap, "partnerId", s.PartnerID) + populate(objectMap, "planId", s.PlanID) + populate(objectMap, "saasSubscriptionId", s.SaasSubscriptionID) + populate(objectMap, "saasSubscriptionName", s.SaasSubscriptionName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Solution. +func (s *Solution) UnmarshalJSON(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 "applicationName": + err = unpopulate(val, "ApplicationName", &s.ApplicationName) + delete(rawMsg, key) + case "marketPlacePublisherId": + err = unpopulate(val, "MarketPlacePublisherID", &s.MarketPlacePublisherID) + delete(rawMsg, key) + case "partnerId": + err = unpopulate(val, "PartnerID", &s.PartnerID) + delete(rawMsg, key) + case "planId": + err = unpopulate(val, "PlanID", &s.PlanID) + delete(rawMsg, key) + case "saasSubscriptionId": + err = unpopulate(val, "SaasSubscriptionID", &s.SaasSubscriptionID) + delete(rawMsg, key) + case "saasSubscriptionName": + err = unpopulate(val, "SaasSubscriptionName", &s.SaasSubscriptionName) + 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 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 +} + +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/agricultureplatform/armagricultureplatform/operations_client.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/operations_client.go new file mode 100644 index 000000000000..c8e0bd56974a --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/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 armagricultureplatform + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2024-06-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.AgriculturePlatform/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-06-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/agricultureplatform/armagricultureplatform/operations_client_example_test.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/operations_client_example_test.go new file mode 100644 index 000000000000..435bc4cb184a --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/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 armagricultureplatform_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agricultureplatform/armagricultureplatform" + "log" +) + +// Generated from example definition: 2024-06-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 := armagricultureplatform.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 = armagricultureplatform.OperationsClientListResponse{ + // OperationListResult: armagricultureplatform.OperationListResult{ + // Value: []*armagricultureplatform.Operation{ + // { + // Name: to.Ptr("on"), + // IsDataAction: to.Ptr(true), + // Display: &armagricultureplatform.OperationDisplay{ + // Provider: to.Ptr("yvkmdseicusbpedotoit"), + // Resource: to.Ptr("gzqgh"), + // Operation: to.Ptr("wdvqfctmtffessbckulhoswzv"), + // Description: to.Ptr("xuvqlrnkwqsafmydwvywnpdxlsmnn"), + // }, + // Origin: to.Ptr(armagricultureplatform.OriginUser), + // ActionType: to.Ptr(armagricultureplatform.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/agricultureplatform/armagricultureplatform/options.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/options.go new file mode 100644 index 000000000000..9ea72f9c4123 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/options.go @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armagricultureplatform + +// AgriServiceClientBeginCreateOrUpdateOptions contains the optional parameters for the AgriServiceClient.BeginCreateOrUpdate +// method. +type AgriServiceClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// AgriServiceClientBeginDeleteOptions contains the optional parameters for the AgriServiceClient.BeginDelete method. +type AgriServiceClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// AgriServiceClientBeginUpdateOptions contains the optional parameters for the AgriServiceClient.BeginUpdate method. +type AgriServiceClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// AgriServiceClientGetOptions contains the optional parameters for the AgriServiceClient.Get method. +type AgriServiceClientGetOptions struct { + // placeholder for future optional parameters +} + +// AgriServiceClientListAvailableSolutionsOptions contains the optional parameters for the AgriServiceClient.ListAvailableSolutions +// method. +type AgriServiceClientListAvailableSolutionsOptions struct { + // placeholder for future optional parameters +} + +// AgriServiceClientListByResourceGroupOptions contains the optional parameters for the AgriServiceClient.NewListByResourceGroupPager +// method. +type AgriServiceClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// AgriServiceClientListBySubscriptionOptions contains the optional parameters for the AgriServiceClient.NewListBySubscriptionPager +// method. +type AgriServiceClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/agricultureplatform/armagricultureplatform/responses.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/responses.go new file mode 100644 index 000000000000..27d782bd7376 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/responses.go @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armagricultureplatform + +// AgriServiceClientCreateOrUpdateResponse contains the response from method AgriServiceClient.BeginCreateOrUpdate. +type AgriServiceClientCreateOrUpdateResponse struct { + // Schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + AgriServiceResource +} + +// AgriServiceClientDeleteResponse contains the response from method AgriServiceClient.BeginDelete. +type AgriServiceClientDeleteResponse struct { + // placeholder for future response values +} + +// AgriServiceClientGetResponse contains the response from method AgriServiceClient.Get. +type AgriServiceClientGetResponse struct { + // Schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + AgriServiceResource +} + +// AgriServiceClientListAvailableSolutionsResponse contains the response from method AgriServiceClient.ListAvailableSolutions. +type AgriServiceClientListAvailableSolutionsResponse struct { + // The list of available agri solutions. + AvailableAgriSolutionListResult +} + +// AgriServiceClientListByResourceGroupResponse contains the response from method AgriServiceClient.NewListByResourceGroupPager. +type AgriServiceClientListByResourceGroupResponse struct { + // The response of a AgriServiceResource list operation. + AgriServiceResourceListResult +} + +// AgriServiceClientListBySubscriptionResponse contains the response from method AgriServiceClient.NewListBySubscriptionPager. +type AgriServiceClientListBySubscriptionResponse struct { + // The response of a AgriServiceResource list operation. + AgriServiceResourceListResult +} + +// AgriServiceClientUpdateResponse contains the response from method AgriServiceClient.BeginUpdate. +type AgriServiceClientUpdateResponse struct { + // Schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + AgriServiceResource +} + +// 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/arizeaiobservabilityeval/armarizeaiobservabilityeval/fake/time_rfc3339.go b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/time_rfc3339.go similarity index 98% rename from sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/fake/time_rfc3339.go rename to sdk/resourcemanager/agricultureplatform/armagricultureplatform/time_rfc3339.go index 87ee11e83b32..6084d77153d5 100644 --- a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/fake/time_rfc3339.go +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/time_rfc3339.go @@ -2,7 +2,7 @@ // Licensed under the 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 +package armagricultureplatform import ( "encoding/json" diff --git a/sdk/resourcemanager/agricultureplatform/armagricultureplatform/tsp-location.yaml b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/tsp-location.yaml new file mode 100644 index 000000000000..4e683c28c7e0 --- /dev/null +++ b/sdk/resourcemanager/agricultureplatform/armagricultureplatform/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/agricultureplatform/AgriculturePlatform.Management +commit: 079f70d6f2b754db6b736e117196104efd2dd496 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/CHANGELOG.md b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/CHANGELOG.md index 03d056443f31..7bf650193193 100644 --- a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/CHANGELOG.md +++ b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.0 (2025-05-13) +### Other Changes + + ## 0.1.0 (2025-03-12) ### Other Changes diff --git a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/constants.go b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/constants.go index 9fe62f20b1f1..04ccfe8c5b4d 100644 --- a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/constants.go +++ b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/constants.go @@ -6,7 +6,7 @@ package armarizeaiobservabilityeval const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval" - moduleVersion = "v0.1.0" + moduleVersion = "v1.0.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/fake/organizations_server.go b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/fake/organizations_server.go index 6f07cde657bb..ac69b5e3b644 100644 --- a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/fake/organizations_server.go +++ b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/fake/organizations_server.go @@ -131,7 +131,7 @@ func (o *OrganizationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/ArizeAi\.ObservabilityEval/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armarizeaiobservabilityeval.OrganizationResource](req) @@ -179,7 +179,7 @@ func (o *OrganizationsServerTransport) dispatchBeginDelete(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/ArizeAi\.ObservabilityEval/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,7 +221,7 @@ func (o *OrganizationsServerTransport) dispatchGet(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/ArizeAi\.ObservabilityEval/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -256,7 +256,7 @@ func (o *OrganizationsServerTransport) dispatchNewListByResourceGroupPager(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/ArizeAi\.ObservabilityEval/organizations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -293,7 +293,7 @@ func (o *OrganizationsServerTransport) dispatchNewListBySubscriptionPager(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/ArizeAi\.ObservabilityEval/organizations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := o.srv.NewListBySubscriptionPager(nil) @@ -324,7 +324,7 @@ func (o *OrganizationsServerTransport) dispatchUpdate(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/ArizeAi\.ObservabilityEval/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armarizeaiobservabilityeval.OrganizationResourceUpdate](req) diff --git a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/models.go b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/models.go index 16f77e61af97..a254a7b0d446 100644 --- a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/models.go +++ b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/models.go @@ -55,7 +55,9 @@ type OfferDetails struct { TermUnit *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 @@ -109,12 +111,12 @@ type OrganizationProperties struct { // REQUIRED; Marketplace details of the resource. Marketplace *MarketplaceDetails + // REQUIRED; partner properties + PartnerProperties *PartnerProperties + // REQUIRED; Details of the user. User *UserDetails - // partner properties - PartnerProperties *PartnerProperties - // Single sign-on properties SingleSignOnProperties *SingleSignOnPropertiesV2 diff --git a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/operations_client.go b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/operations_client.go index 11728677fe13..dd06ad3cd999 100644 --- a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/operations_client.go +++ b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/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-01-preview +// Generated from API version 2024-10-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]{ @@ -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-01-preview") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/operations_client_example_test.go b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/operations_client_example_test.go index f981e218dbfd..08c776d47d92 100644 --- a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/operations_client_example_test.go +++ b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/operations_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2024-10-01-preview/Operations_List_MaximumSet_Gen.json +// Generated from example definition: 2024-10-01/Operations_List_MaximumSet_Gen.json func ExampleOperationsClient_NewListPager_operationsListGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -55,7 +55,7 @@ func ExampleOperationsClient_NewListPager_operationsListGeneratedByMaximumSetRul } } -// Generated from example definition: 2024-10-01-preview/Operations_List_MinimumSet_Gen.json +// Generated from example definition: 2024-10-01/Operations_List_MinimumSet_Gen.json func ExampleOperationsClient_NewListPager_operationsListGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/organizations_client.go b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/organizations_client.go index a0b6532d1489..3b2ac139eb54 100644 --- a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/organizations_client.go +++ b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/organizations_client.go @@ -42,7 +42,7 @@ func NewOrganizationsClient(subscriptionID string, credential azcore.TokenCreden // BeginCreateOrUpdate - Create a OrganizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01-preview +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - organizationname - Name of the Organization resource // - resource - Resource create parameters. @@ -68,7 +68,7 @@ func (client *OrganizationsClient) BeginCreateOrUpdate(ctx context.Context, reso // CreateOrUpdate - Create a OrganizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01-preview +// Generated from API version 2024-10-01 func (client *OrganizationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, organizationname string, resource OrganizationResource, options *OrganizationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "OrganizationsClient.BeginCreateOrUpdate" @@ -110,7 +110,7 @@ func (client *OrganizationsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01-preview") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -123,7 +123,7 @@ func (client *OrganizationsClient) createOrUpdateCreateRequest(ctx context.Conte // BeginDelete - Delete a OrganizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01-preview +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - organizationname - Name of the Organization resource // - options - OrganizationsClientBeginDeleteOptions contains the optional parameters for the OrganizationsClient.BeginDelete @@ -148,7 +148,7 @@ func (client *OrganizationsClient) BeginDelete(ctx context.Context, resourceGrou // Delete - Delete a OrganizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01-preview +// Generated from API version 2024-10-01 func (client *OrganizationsClient) deleteOperation(ctx context.Context, resourceGroupName string, organizationname string, options *OrganizationsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "OrganizationsClient.BeginDelete" @@ -190,7 +190,7 @@ func (client *OrganizationsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01-preview") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -199,7 +199,7 @@ func (client *OrganizationsClient) deleteCreateRequest(ctx context.Context, reso // Get - Get a OrganizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01-preview +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - organizationname - Name of the Organization resource // - options - OrganizationsClientGetOptions contains the optional parameters for the OrganizationsClient.Get method. @@ -245,7 +245,7 @@ func (client *OrganizationsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01-preview") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,7 +262,7 @@ func (client *OrganizationsClient) getHandleResponse(resp *http.Response) (Organ // NewListByResourceGroupPager - List OrganizationResource resources by resource group // -// Generated from API version 2024-10-01-preview +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - OrganizationsClientListByResourceGroupOptions contains the optional parameters for the OrganizationsClient.NewListByResourceGroupPager // method. @@ -305,7 +305,7 @@ func (client *OrganizationsClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01-preview") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -322,7 +322,7 @@ func (client *OrganizationsClient) listByResourceGroupHandleResponse(resp *http. // NewListBySubscriptionPager - List OrganizationResource resources by subscription ID // -// Generated from API version 2024-10-01-preview +// Generated from API version 2024-10-01 // - options - OrganizationsClientListBySubscriptionOptions contains the optional parameters for the OrganizationsClient.NewListBySubscriptionPager // method. func (client *OrganizationsClient) NewListBySubscriptionPager(options *OrganizationsClientListBySubscriptionOptions) *runtime.Pager[OrganizationsClientListBySubscriptionResponse] { @@ -360,7 +360,7 @@ func (client *OrganizationsClient) listBySubscriptionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01-preview") + reqQP.Set("api-version", "2024-10-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -378,7 +378,7 @@ func (client *OrganizationsClient) listBySubscriptionHandleResponse(resp *http.R // Update - Update a OrganizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01-preview +// Generated from API version 2024-10-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - organizationname - Name of the Organization resource // - properties - The resource properties to be updated. @@ -425,7 +425,7 @@ func (client *OrganizationsClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01-preview") + reqQP.Set("api-version", "2024-10-01") 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/arizeaiobservabilityeval/armarizeaiobservabilityeval/organizations_client_example_test.go b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/organizations_client_example_test.go index 0ceb9b291de9..46f97a90d31b 100644 --- a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/organizations_client_example_test.go +++ b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/organizations_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2024-10-01-preview/Organizations_CreateOrUpdate_MaximumSet_Gen.json +// Generated from example definition: 2024-10-01/Organizations_CreateOrUpdate_MaximumSet_Gen.json func ExampleOrganizationsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -135,7 +135,7 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: 2024-10-01-preview/Organizations_Delete_MaximumSet_Gen.json +// Generated from example definition: 2024-10-01/Organizations_Delete_MaximumSet_Gen.json func ExampleOrganizationsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -156,7 +156,7 @@ func ExampleOrganizationsClient_BeginDelete() { } } -// Generated from example definition: 2024-10-01-preview/Organizations_Get_MaximumSet_Gen.json +// Generated from example definition: 2024-10-01/Organizations_Get_MaximumSet_Gen.json func ExampleOrganizationsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -235,7 +235,7 @@ func ExampleOrganizationsClient_Get() { // } } -// Generated from example definition: 2024-10-01-preview/Organizations_ListByResourceGroup_MaximumSet_Gen.json +// Generated from example definition: 2024-10-01/Organizations_ListByResourceGroup_MaximumSet_Gen.json func ExampleOrganizationsClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -324,7 +324,7 @@ func ExampleOrganizationsClient_NewListByResourceGroupPager() { } } -// Generated from example definition: 2024-10-01-preview/Organizations_ListBySubscription_MaximumSet_Gen.json +// Generated from example definition: 2024-10-01/Organizations_ListBySubscription_MaximumSet_Gen.json func ExampleOrganizationsClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -413,7 +413,7 @@ func ExampleOrganizationsClient_NewListBySubscriptionPager() { } } -// Generated from example definition: 2024-10-01-preview/Organizations_Update_MaximumSet_Gen.json +// Generated from example definition: 2024-10-01/Organizations_Update_MaximumSet_Gen.json func ExampleOrganizationsClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/tsp-location.yaml b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/tsp-location.yaml index 5006ea427838..7ff906c04953 100644 --- a/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/tsp-location.yaml +++ b/sdk/resourcemanager/arizeaiobservabilityeval/armarizeaiobservabilityeval/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/liftrarize/ArizeAi.ObservabilityEval.Management -commit: 237c2500daac3752cafd855c35e86e14a73586b3 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/CHANGELOG.md b/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/CHANGELOG.md index 27211c5f1ddd..1750a16c70a1 100644 --- a/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/CHANGELOG.md +++ b/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.0 (2025-05-13) +### Other Changes + + ## 0.1.0 (2025-05-02) ### Other Changes diff --git a/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/carbonservice_client_example_test.go b/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/carbonservice_client_example_test.go index 42c8acf27a64..ea8cfbde3e9f 100644 --- a/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/carbonservice_client_example_test.go +++ b/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/carbonservice_client_example_test.go @@ -50,7 +50,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionLo if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.ItemDetailsQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.ItemDetailsQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumItemDetailsReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -185,7 +185,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionOv if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.MonthlySummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.MonthlySummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumMonthlySummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -257,7 +257,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionMo if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.MonthlySummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.MonthlySummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumMonthlySummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -340,7 +340,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionOv if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.OverallSummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.OverallSummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumOverallSummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -392,7 +392,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionOv if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.OverallSummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.OverallSummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumOverallSummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -455,7 +455,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionRe if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.ItemDetailsQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.ItemDetailsQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumItemDetailsReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -600,7 +600,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionRe if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.ItemDetailsQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.ItemDetailsQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumItemDetailsReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -761,7 +761,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionRe if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.ItemDetailsQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.ItemDetailsQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumItemDetailsReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -922,7 +922,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionRe if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.ItemDetailsQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.ItemDetailsQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumItemDetailsReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -1057,7 +1057,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionSu if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.ItemDetailsQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.ItemDetailsQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumItemDetailsReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -1192,7 +1192,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionTo if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.TopItemsMonthlySummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.TopItemsMonthlySummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumTopItemsMonthlySummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -1340,7 +1340,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionTo if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.TopItemsSummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.TopItemsSummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumTopItemsSummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -1473,7 +1473,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionTo if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.TopItemsMonthlySummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.TopItemsMonthlySummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumTopItemsMonthlySummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -1633,7 +1633,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionTo if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.TopItemsSummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.TopItemsSummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumTopItemsSummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -1776,7 +1776,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionTo if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.TopItemsMonthlySummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.TopItemsMonthlySummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumTopItemsMonthlySummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -1942,7 +1942,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionTo if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.TopItemsSummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.TopItemsSummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumTopItemsSummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -2090,7 +2090,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionTo if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.TopItemsMonthlySummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.TopItemsMonthlySummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumTopItemsMonthlySummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -2238,7 +2238,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionTo if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.TopItemsSummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.TopItemsSummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumTopItemsSummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -2371,7 +2371,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionTo if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.TopItemsMonthlySummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.TopItemsMonthlySummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumTopItemsMonthlySummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -2519,7 +2519,7 @@ func ExampleCarbonServiceClient_QueryCarbonEmissionReports_queryCarbonEmissionTo if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, &armcarbonoptimization.TopItemsSummaryReportQueryFilter{ + res, err := clientFactory.NewCarbonServiceClient().QueryCarbonEmissionReports(ctx, armcarbonoptimization.TopItemsSummaryReportQueryFilter{ ReportType: to.Ptr(armcarbonoptimization.ReportTypeEnumTopItemsSummaryReport), SubscriptionList: []*string{ to.Ptr("00000000-0000-0000-0000-000000000000"), diff --git a/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/constants.go b/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/constants.go index 38c6191238d3..541fbbe500f9 100644 --- a/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/constants.go +++ b/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/constants.go @@ -6,7 +6,7 @@ package armcarbonoptimization const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/carbonoptimization/armcarbonoptimization" - moduleVersion = "v0.1.0" + moduleVersion = "v1.0.0" ) // AccessDecisionEnum - Enum for Access Decision diff --git a/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/fake/date_type.go b/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/fake/date_type.go deleted file mode 100644 index 1364caea1a04..000000000000 --- a/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/fake/date_type.go +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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" - "time" -) - -const ( - fullDateJSON = `"2006-01-02"` - jsonFormat = `"%04d-%02d-%02d"` -) - -type dateType time.Time - -func (t dateType) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf(jsonFormat, time.Time(t).Year(), time.Time(t).Month(), time.Time(t).Day())), nil -} - -func (d *dateType) UnmarshalJSON(data []byte) (err error) { - t, err := time.Parse(fullDateJSON, string(data)) - *d = (dateType)(t) - return err -} - -func populateDateType(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] = (*dateType)(t) -} - -func unpopulateDateType(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateType - 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/carbonoptimization/armcarbonoptimization/models.go b/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/models.go index 1c79bd9ede25..1f5672615789 100644 --- a/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/models.go +++ b/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/models.go @@ -366,7 +366,9 @@ func (m *MonthlySummaryReportQueryFilter) GetQueryFilter() *QueryFilter { } } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 diff --git a/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/tsp-location.yaml b/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/tsp-location.yaml index 99e25184b16c..71dd0de3cb09 100644 --- a/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/tsp-location.yaml +++ b/sdk/resourcemanager/carbonoptimization/armcarbonoptimization/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/carbon/Carbon.Management -commit: f826fcc6b9affea959b4c0f0f781b9413c776f20 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/chaos/armchaos/CHANGELOG.md b/sdk/resourcemanager/chaos/armchaos/CHANGELOG.md index 66d880b0bc91..671273dc7a35 100644 --- a/sdk/resourcemanager/chaos/armchaos/CHANGELOG.md +++ b/sdk/resourcemanager/chaos/armchaos/CHANGELOG.md @@ -1,5 +1,50 @@ # Release History +## 2.0.0 (2025-05-13) +### Breaking Changes + +- Type of `ContinuousAction.Type` has been changed from `*string` to `*ExperimentActionType` +- Type of `DelayAction.Type` has been changed from `*string` to `*ExperimentActionType` +- Type of `DiscreteAction.Type` has been changed from `*string` to `*ExperimentActionType` +- Type of `ErrorAdditionalInfo.Info` has been changed from `any` to `*ErrorAdditionalInfoInfo` +- Type of `Experiment.Identity` has been changed from `*ResourceIdentity` to `*ManagedServiceIdentity` +- Type of `ExperimentAction.Type` has been changed from `*string` to `*ExperimentActionType` +- Type of `ExperimentUpdate.Identity` has been changed from `*ResourceIdentity` to `*ManagedServiceIdentity` +- Enum `ResourceIdentityType` has been removed +- Function `*ExperimentsClient.ExecutionDetails` has been removed +- Function `*ExperimentsClient.GetExecution` has been removed +- Function `*ExperimentsClient.NewListAllExecutionsPager` has been removed +- Function `*OperationsClient.NewListAllPager` has been removed +- Struct `ErrorResponse` has been removed +- Struct `OperationStatus` has been removed +- Struct `Resource` has been removed +- Struct `ResourceIdentity` has been removed +- Struct `TrackedResource` has been removed +- Field `Location` of struct `CapabilityType` has been removed +- Field `OperationStatus` of struct `OperationStatusesClientGetResponse` has been removed +- Field `AdditionalProperties` of struct `TargetListSelector` has been removed +- Field `AdditionalProperties` of struct `TargetQuerySelector` has been removed +- Field `AdditionalProperties` of struct `TargetSelector` has been removed +- Field `Location` of struct `TargetType` has been removed + +### Features Added + +- New enum type `ExperimentActionType` with values `ExperimentActionTypeContinuous`, `ExperimentActionTypeDelay`, `ExperimentActionTypeDiscrete` +- New enum type `ManagedServiceIdentityType` with values `ManagedServiceIdentityTypeNone`, `ManagedServiceIdentityTypeSystemAssigned`, `ManagedServiceIdentityTypeSystemAssignedUserAssigned`, `ManagedServiceIdentityTypeUserAssigned` +- New function `*ClientFactory.NewExperimentExecutionsClient() *ExperimentExecutionsClient` +- New function `NewExperimentExecutionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ExperimentExecutionsClient, error)` +- New function `*ExperimentExecutionsClient.GetExecution(context.Context, string, string, string, *ExperimentExecutionsClientGetExecutionOptions) (ExperimentExecutionsClientGetExecutionResponse, error)` +- New function `*ExperimentExecutionsClient.GetExecutionDetails(context.Context, string, string, string, *ExperimentExecutionsClientGetExecutionDetailsOptions) (ExperimentExecutionsClientGetExecutionDetailsResponse, error)` +- New function `*ExperimentExecutionsClient.NewListAllExecutionsPager(string, string, *ExperimentExecutionsClientListAllExecutionsOptions) *runtime.Pager[ExperimentExecutionsClientListAllExecutionsResponse]` +- New function `*OperationsClient.NewListPager(*OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse]` +- New struct `ErrorAdditionalInfoInfo` +- New struct `ManagedServiceIdentity` +- New struct `OperationStatusResult` +- New field `RequiredAzureRoleDefinitionIDs` in struct `CapabilityTypeProperties` +- New field `SystemData` in struct `ExperimentExecution` +- New anonymous field `OperationStatusResult` in struct `OperationStatusesClientGetResponse` + + ## 1.1.0 (2024-03-22) ### Features Added diff --git a/sdk/resourcemanager/chaos/armchaos/README.md b/sdk/resourcemanager/chaos/armchaos/README.md index f2f15e905827..b527df1268d1 100644 --- a/sdk/resourcemanager/chaos/armchaos/README.md +++ b/sdk/resourcemanager/chaos/armchaos/README.md @@ -19,7 +19,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Chaos module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/chaos/armchaos/autorest.md b/sdk/resourcemanager/chaos/armchaos/autorest.md deleted file mode 100644 index b9f219695dcc..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/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/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.1.0 -tag: package-2024-01 -``` \ No newline at end of file diff --git a/sdk/resourcemanager/chaos/armchaos/build.go b/sdk/resourcemanager/chaos/armchaos/build.go deleted file mode 100644 index 87e4894b9e63..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/chaos/armchaos - -package armchaos diff --git a/sdk/resourcemanager/chaos/armchaos/capabilities_client.go b/sdk/resourcemanager/chaos/armchaos/capabilities_client.go index 74d548e166ec..fd03bbca018d 100644 --- a/sdk/resourcemanager/chaos/armchaos/capabilities_client.go +++ b/sdk/resourcemanager/chaos/armchaos/capabilities_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 armchaos @@ -28,7 +24,7 @@ type CapabilitiesClient struct { } // NewCapabilitiesClient creates a new instance of CapabilitiesClient with the specified values. -// - subscriptionID - GUID that represents an Azure subscription ID. +// - 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 NewCapabilitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CapabilitiesClient, error) { @@ -46,23 +42,23 @@ func NewCapabilitiesClient(subscriptionID string, credential azcore.TokenCredent // CreateOrUpdate - Create or update a Capability resource that extends a Target resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. // - capabilityName - String that represents a Capability resource name. -// - capability - Capability resource to be created or updated. +// - resource - Capability resource to be created or updated. // - options - CapabilitiesClientCreateOrUpdateOptions contains the optional parameters for the CapabilitiesClient.CreateOrUpdate // method. -func (client *CapabilitiesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, capability Capability, options *CapabilitiesClientCreateOrUpdateOptions) (CapabilitiesClientCreateOrUpdateResponse, error) { +func (client *CapabilitiesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, resource Capability, options *CapabilitiesClientCreateOrUpdateOptions) (CapabilitiesClientCreateOrUpdateResponse, error) { var err error const operationName = "CapabilitiesClient.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, parentProviderNamespace, parentResourceType, parentResourceName, targetName, capabilityName, capability, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, capabilityName, resource, options) if err != nil { return CapabilitiesClientCreateOrUpdateResponse{}, err } @@ -70,7 +66,7 @@ func (client *CapabilitiesClient) CreateOrUpdate(ctx context.Context, resourceGr if err != nil { return CapabilitiesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { err = runtime.NewResponseError(httpResp) return CapabilitiesClientCreateOrUpdateResponse{}, err } @@ -79,7 +75,7 @@ func (client *CapabilitiesClient) CreateOrUpdate(ctx context.Context, resourceGr } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *CapabilitiesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, capability Capability, options *CapabilitiesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *CapabilitiesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, resource Capability, _ *CapabilitiesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -114,10 +110,11 @@ func (client *CapabilitiesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, capability); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -135,11 +132,11 @@ func (client *CapabilitiesClient) createOrUpdateHandleResponse(resp *http.Respon // Delete - Delete a Capability that extends a Target resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. // - capabilityName - String that represents a Capability resource name. // - options - CapabilitiesClientDeleteOptions contains the optional parameters for the CapabilitiesClient.Delete method. @@ -165,7 +162,7 @@ func (client *CapabilitiesClient) Delete(ctx context.Context, resourceGroupName } // deleteCreateRequest creates the Delete request. -func (client *CapabilitiesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, options *CapabilitiesClientDeleteOptions) (*policy.Request, error) { +func (client *CapabilitiesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, _ *CapabilitiesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -200,7 +197,7 @@ func (client *CapabilitiesClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -209,11 +206,11 @@ func (client *CapabilitiesClient) deleteCreateRequest(ctx context.Context, resou // Get - Get a Capability resource that extends a Target resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. // - capabilityName - String that represents a Capability resource name. // - options - CapabilitiesClientGetOptions contains the optional parameters for the CapabilitiesClient.Get method. @@ -240,7 +237,7 @@ func (client *CapabilitiesClient) Get(ctx context.Context, resourceGroupName str } // getCreateRequest creates the Get request. -func (client *CapabilitiesClient) getCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, options *CapabilitiesClientGetOptions) (*policy.Request, error) { +func (client *CapabilitiesClient) getCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, _ *CapabilitiesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -275,7 +272,7 @@ func (client *CapabilitiesClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -290,13 +287,13 @@ func (client *CapabilitiesClient) getHandleResponse(resp *http.Response) (Capabi return result, nil } -// NewListPager - Get a list of Capability resources that extend a Target resource.. +// NewListPager - Get a list of Capability resources that extend a Target resource. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. // - options - CapabilitiesClientListOptions contains the optional parameters for the CapabilitiesClient.NewListPager method. func (client *CapabilitiesClient) NewListPager(resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, options *CapabilitiesClientListOptions) *runtime.Pager[CapabilitiesClientListResponse] { @@ -354,7 +351,7 @@ func (client *CapabilitiesClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } diff --git a/sdk/resourcemanager/chaos/armchaos/capabilities_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/capabilities_client_example_test.go index b4d2220e83e1..5ce39b17dfcc 100644 --- a/sdk/resourcemanager/chaos/armchaos/capabilities_client_example_test.go +++ b/sdk/resourcemanager/chaos/armchaos/capabilities_client_example_test.go @@ -1,153 +1,160 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights 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 armchaos_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListCapabilities.json -func ExampleCapabilitiesClient_NewListPager() { +// Generated from example definition: 2025-01-01/Capabilities_CreateOrUpdate.json +func ExampleCapabilitiesClient_CreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewCapabilitiesClient().NewListPager("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", &armchaos.CapabilitiesClientListOptions{ContinuationToken: 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.CapabilityListResult = armchaos.CapabilityListResult{ - // Value: []*armchaos.Capability{ - // { - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/targets/capabilities"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"), - // Properties: &armchaos.CapabilityProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()), - // }, - // }}, - // } + res, err := clientFactory.NewCapabilitiesClient().CreateOrUpdate(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", armchaos.Capability{ + Properties: &armchaos.CapabilityProperties{}, + }, 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 = armchaos.CapabilitiesClientCreateOrUpdateResponse{ + // Capability: &armchaos.Capability{ + // Name: to.Ptr("Shutdown-1.0"), + // Type: to.Ptr("Microsoft.Chaos/targets/capabilities"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"), + // Properties: &armchaos.CapabilityProperties{ + // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), + // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), + // Publisher: to.Ptr("Microsoft"), + // TargetType: to.Ptr("VirtualMachine"), + // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), + // }, + // SystemData: &armchaos.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.4662189Z"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.4662189Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetCapability.json -func ExampleCapabilitiesClient_Get() { +// Generated from example definition: 2025-01-01/Capabilities_Delete.json +func ExampleCapabilitiesClient_Delete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCapabilitiesClient().Get(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", nil) + res, err := clientFactory.NewCapabilitiesClient().Delete(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.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.Capability = armchaos.Capability{ - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/targets/capabilities"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"), - // Properties: &armchaos.CapabilityProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()), - // }, + // res = armchaos.CapabilitiesClientDeleteResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteCapability.json -func ExampleCapabilitiesClient_Delete() { +// Generated from example definition: 2025-01-01/Capabilities_Get.json +func ExampleCapabilitiesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewCapabilitiesClient().Delete(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", nil) + res, err := clientFactory.NewCapabilitiesClient().Get(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.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 = armchaos.CapabilitiesClientGetResponse{ + // Capability: &armchaos.Capability{ + // Name: to.Ptr("Shutdown-1.0"), + // Type: to.Ptr("Microsoft.Chaos/targets/capabilities"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"), + // Properties: &armchaos.CapabilityProperties{ + // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), + // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), + // Publisher: to.Ptr("Microsoft"), + // TargetType: to.Ptr("VirtualMachine"), + // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), + // }, + // SystemData: &armchaos.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.4662189Z"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.4662189Z"); return t}()), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateCapability.json -func ExampleCapabilitiesClient_CreateOrUpdate() { +// Generated from example definition: 2025-01-01/Capabilities_List.json +func ExampleCapabilitiesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewCapabilitiesClient().CreateOrUpdate(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", "Shutdown-1.0", armchaos.Capability{ - Properties: &armchaos.CapabilityProperties{}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) + pager := clientFactory.NewCapabilitiesClient().NewListPager("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", 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 = armchaos.CapabilitiesClientListResponse{ + // CapabilityListResult: armchaos.CapabilityListResult{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities?continuationToken=&api-version=2024-11-01-preview"), + // Value: []*armchaos.Capability{ + // { + // Name: to.Ptr("Shutdown-1.0"), + // Type: to.Ptr("Microsoft.Chaos/targets/capabilities"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"), + // Properties: &armchaos.CapabilityProperties{ + // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), + // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), + // Publisher: to.Ptr("Microsoft"), + // TargetType: to.Ptr("VirtualMachine"), + // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), + // }, + // SystemData: &armchaos.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.4662189Z"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.4662189Z"); return t}()), + // }, + // }, + // }, + // }, + // } } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Capability = armchaos.Capability{ - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/targets/capabilities"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0"), - // Properties: &armchaos.CapabilityProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-05-14T05:08:38.466Z"); return t}()), - // }, - // } } diff --git a/sdk/resourcemanager/chaos/armchaos/capabilities_live_test.go b/sdk/resourcemanager/chaos/armchaos/capabilities_live_test.go index a81b322e53d5..d29576907918 100644 --- a/sdk/resourcemanager/chaos/armchaos/capabilities_live_test.go +++ b/sdk/resourcemanager/chaos/armchaos/capabilities_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/stretchr/testify/suite" diff --git a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client.go b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client.go index e5573ac5209b..c42329958d65 100644 --- a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client.go +++ b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_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 armchaos @@ -28,7 +24,7 @@ type CapabilityTypesClient struct { } // NewCapabilityTypesClient creates a new instance of CapabilityTypesClient with the specified values. -// - subscriptionID - GUID that represents an Azure subscription ID. +// - 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 NewCapabilityTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CapabilityTypesClient, error) { @@ -46,18 +42,18 @@ func NewCapabilityTypesClient(subscriptionID string, credential azcore.TokenCred // Get - Get a Capability Type resource for given Target Type and location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - locationName - String that represents a Location resource name. +// Generated from API version 2025-01-01 +// - location - The name of the Azure region. // - targetTypeName - String that represents a Target Type resource name. // - capabilityTypeName - String that represents a Capability Type resource name. // - options - CapabilityTypesClientGetOptions contains the optional parameters for the CapabilityTypesClient.Get method. -func (client *CapabilityTypesClient) Get(ctx context.Context, locationName string, targetTypeName string, capabilityTypeName string, options *CapabilityTypesClientGetOptions) (CapabilityTypesClientGetResponse, error) { +func (client *CapabilityTypesClient) Get(ctx context.Context, location string, targetTypeName string, capabilityTypeName string, options *CapabilityTypesClientGetOptions) (CapabilityTypesClientGetResponse, error) { var err error const operationName = "CapabilityTypesClient.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, locationName, targetTypeName, capabilityTypeName, options) + req, err := client.getCreateRequest(ctx, location, targetTypeName, capabilityTypeName, options) if err != nil { return CapabilityTypesClientGetResponse{}, err } @@ -74,16 +70,16 @@ func (client *CapabilityTypesClient) Get(ctx context.Context, locationName strin } // getCreateRequest creates the Get request. -func (client *CapabilityTypesClient) getCreateRequest(ctx context.Context, locationName string, targetTypeName string, capabilityTypeName string, options *CapabilityTypesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}" +func (client *CapabilityTypesClient) getCreateRequest(ctx context.Context, location string, targetTypeName string, capabilityTypeName string, _ *CapabilityTypesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if locationName == "" { - return nil, errors.New("parameter locationName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) if targetTypeName == "" { return nil, errors.New("parameter targetTypeName cannot be empty") } @@ -97,7 +93,7 @@ func (client *CapabilityTypesClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,12 +110,12 @@ func (client *CapabilityTypesClient) getHandleResponse(resp *http.Response) (Cap // NewListPager - Get a list of Capability Type resources for given Target Type and location. // -// Generated from API version 2024-01-01 -// - locationName - String that represents a Location resource name. +// Generated from API version 2025-01-01 +// - location - The name of the Azure region. // - targetTypeName - String that represents a Target Type resource name. // - options - CapabilityTypesClientListOptions contains the optional parameters for the CapabilityTypesClient.NewListPager // method. -func (client *CapabilityTypesClient) NewListPager(locationName string, targetTypeName string, options *CapabilityTypesClientListOptions) *runtime.Pager[CapabilityTypesClientListResponse] { +func (client *CapabilityTypesClient) NewListPager(location string, targetTypeName string, options *CapabilityTypesClientListOptions) *runtime.Pager[CapabilityTypesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[CapabilityTypesClientListResponse]{ More: func(page CapabilityTypesClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -131,7 +127,7 @@ func (client *CapabilityTypesClient) NewListPager(locationName string, targetTyp nextLink = *page.NextLink } resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, locationName, targetTypeName, options) + return client.listCreateRequest(ctx, location, targetTypeName, options) }, nil) if err != nil { return CapabilityTypesClientListResponse{}, err @@ -143,16 +139,16 @@ func (client *CapabilityTypesClient) NewListPager(locationName string, targetTyp } // listCreateRequest creates the List request. -func (client *CapabilityTypesClient) listCreateRequest(ctx context.Context, locationName string, targetTypeName string, options *CapabilityTypesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes" +func (client *CapabilityTypesClient) listCreateRequest(ctx context.Context, location string, targetTypeName string, options *CapabilityTypesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}/capabilityTypes" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if locationName == "" { - return nil, errors.New("parameter locationName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) if targetTypeName == "" { return nil, errors.New("parameter targetTypeName cannot be empty") } @@ -162,7 +158,7 @@ func (client *CapabilityTypesClient) listCreateRequest(ctx context.Context, loca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } diff --git a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client_example_test.go index 8c3ecedd0c1a..5cb16e6a3081 100644 --- a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client_example_test.go +++ b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_client_example_test.go @@ -1,34 +1,77 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights 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 armchaos_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListCapabilityTypes.json +// Generated from example definition: 2025-01-01/CapabilityTypes_Get.json +func ExampleCapabilityTypesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewCapabilityTypesClient().Get(ctx, "westus2", "Microsoft-VirtualMachine", "Shutdown-1.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 = armchaos.CapabilityTypesClientGetResponse{ + // CapabilityType: &armchaos.CapabilityType{ + // Name: to.Ptr("Shutdown-1.0"), + // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes/capabilityTypes"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes/Shutdown-1.0"), + // Properties: &armchaos.CapabilityTypeProperties{ + // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), + // DisplayName: to.Ptr("Shutdown VM"), + // Kind: to.Ptr("fault"), + // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), + // Publisher: to.Ptr("Microsoft"), + // RuntimeProperties: &armchaos.CapabilityTypePropertiesRuntimeProperties{ + // Kind: to.Ptr("continuous"), + // }, + // TargetType: to.Ptr("VirtualMachine"), + // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), + // AzureRbacActions: []*string{ + // to.Ptr("Microsoft.Compute/virtualMachines/poweroff/action"), + // to.Ptr("Microsoft.Compute/virtualMachines/start/action"), + // to.Ptr("Microsoft.Compute/virtualMachines/instanceView/read"), + // to.Ptr("Microsoft.Compute/virtualMachines/read"), + // to.Ptr("Microsoft.Compute/locations/operations/read"), + // }, + // RequiredAzureRoleDefinitionIDs: []*string{ + // to.Ptr("acdd72a7-3385-48ef-bd42-f606fba81ae0"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-01/CapabilityTypes_List.json func ExampleCapabilityTypesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewCapabilityTypesClient().NewListPager("westus2", "Microsoft-VirtualMachine", &armchaos.CapabilityTypesClientListOptions{ContinuationToken: nil}) + pager := clientFactory.NewCapabilityTypesClient().NewListPager("westus2", "Microsoft-VirtualMachine", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -39,62 +82,39 @@ func ExampleCapabilityTypesClient_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.CapabilityTypeListResult = armchaos.CapabilityTypeListResult{ - // Value: []*armchaos.CapabilityType{ - // { - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes/capabilityTypes"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes/Shutdown-1.0"), - // Properties: &armchaos.CapabilityTypeProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // DisplayName: to.Ptr("Shutdown VM"), - // Kind: to.Ptr("fault"), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // RuntimeProperties: &armchaos.CapabilityTypePropertiesRuntimeProperties{ - // Kind: to.Ptr("continuous"), + // page = armchaos.CapabilityTypesClientListResponse{ + // CapabilityTypeListResult: armchaos.CapabilityTypeListResult{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes?continuationToken=&api-version=2024-11-01-preview"), + // Value: []*armchaos.CapabilityType{ + // { + // Name: to.Ptr("Shutdown-1.0"), + // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes/capabilityTypes"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes/Shutdown-1.0"), + // Properties: &armchaos.CapabilityTypeProperties{ + // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), + // DisplayName: to.Ptr("Shutdown VM"), + // Kind: to.Ptr("fault"), + // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), + // Publisher: to.Ptr("Microsoft"), + // RuntimeProperties: &armchaos.CapabilityTypePropertiesRuntimeProperties{ + // Kind: to.Ptr("continuous"), + // }, + // TargetType: to.Ptr("VirtualMachine"), + // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), + // AzureRbacActions: []*string{ + // to.Ptr("Microsoft.Compute/virtualMachines/poweroff/action"), + // to.Ptr("Microsoft.Compute/virtualMachines/start/action"), + // to.Ptr("Microsoft.Compute/virtualMachines/instanceView/read"), + // to.Ptr("Microsoft.Compute/virtualMachines/read"), + // to.Ptr("Microsoft.Compute/locations/operations/read"), + // }, + // RequiredAzureRoleDefinitionIDs: []*string{ + // to.Ptr("acdd72a7-3385-48ef-bd42-f606fba81ae0"), + // }, // }, - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), // }, - // }}, + // }, + // }, // } } } - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetCapabilityType.json -func ExampleCapabilityTypesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCapabilityTypesClient().Get(ctx, "westus2", "Microsoft-VirtualMachine", "Shutdown-1.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.CapabilityType = armchaos.CapabilityType{ - // Name: to.Ptr("Shutdown-1.0"), - // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes/capabilityTypes"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-VirtualMachine/capabilityTypes/Shutdown-1.0"), - // Properties: &armchaos.CapabilityTypeProperties{ - // Description: to.Ptr("Shutdown an Azure Virtual Machine for a defined period of time."), - // DisplayName: to.Ptr("Shutdown VM"), - // Kind: to.Ptr("fault"), - // ParametersSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine/capabilities/Shutdown-1.0.json"), - // Publisher: to.Ptr("Microsoft"), - // RuntimeProperties: &armchaos.CapabilityTypePropertiesRuntimeProperties{ - // Kind: to.Ptr("continuous"), - // }, - // TargetType: to.Ptr("VirtualMachine"), - // Urn: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // }, - // } -} diff --git a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_live_test.go b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_live_test.go index 645111fd6af6..8f9d703db531 100644 --- a/sdk/resourcemanager/chaos/armchaos/capabilitytypes_live_test.go +++ b/sdk/resourcemanager/chaos/armchaos/capabilitytypes_live_test.go @@ -14,7 +14,7 @@ import ( "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/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/chaos/armchaos/client_factory.go b/sdk/resourcemanager/chaos/armchaos/client_factory.go index 6f27987f337c..7ed7c657b30d 100644 --- a/sdk/resourcemanager/chaos/armchaos/client_factory.go +++ b/sdk/resourcemanager/chaos/armchaos/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 armchaos @@ -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 - GUID that represents an Azure subscription ID. +// - 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) { @@ -52,6 +48,14 @@ func (c *ClientFactory) NewCapabilityTypesClient() *CapabilityTypesClient { } } +// NewExperimentExecutionsClient creates a new instance of ExperimentExecutionsClient. +func (c *ClientFactory) NewExperimentExecutionsClient() *ExperimentExecutionsClient { + return &ExperimentExecutionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewExperimentsClient creates a new instance of ExperimentsClient. func (c *ClientFactory) NewExperimentsClient() *ExperimentsClient { return &ExperimentsClient{ diff --git a/sdk/resourcemanager/chaos/armchaos/constants.go b/sdk/resourcemanager/chaos/armchaos/constants.go index c3bb6f1fd184..1d6bae485cc8 100644 --- a/sdk/resourcemanager/chaos/armchaos/constants.go +++ b/sdk/resourcemanager/chaos/armchaos/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 armchaos const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" - moduleVersion = "v1.1.0" + moduleVersion = "v2.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,14 +24,18 @@ func PossibleActionTypeValues() []ActionType { } } -// CreatedByType - The type of identity that created the resource. +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -47,10 +48,29 @@ func PossibleCreatedByTypeValues() []CreatedByType { } } -// FilterType - Enum that discriminates between filter types. Currently only Simple type is supported. +// ExperimentActionType - Enum union of Chaos experiment action types. +type ExperimentActionType string + +const ( + ExperimentActionTypeContinuous ExperimentActionType = "continuous" + ExperimentActionTypeDelay ExperimentActionType = "delay" + ExperimentActionTypeDiscrete ExperimentActionType = "discrete" +) + +// PossibleExperimentActionTypeValues returns the possible values for the ExperimentActionType const type. +func PossibleExperimentActionTypeValues() []ExperimentActionType { + return []ExperimentActionType{ + ExperimentActionTypeContinuous, + ExperimentActionTypeDelay, + ExperimentActionTypeDiscrete, + } +} + +// FilterType - Enum that discriminates between filter types. Currently only `Simple` type is supported. type FilterType string const ( + // FilterTypeSimple - Simple filter type. FilterTypeSimple FilterType = "Simple" ) @@ -61,13 +81,40 @@ func PossibleFilterTypeValues() []FilterType { } } +// 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" ) @@ -84,12 +131,18 @@ func PossibleOriginValues() []Origin { type ProvisioningState string const ( - ProvisioningStateCanceled ProvisioningState = "Canceled" - ProvisioningStateCreating ProvisioningState = "Creating" - ProvisioningStateDeleting ProvisioningState = "Deleting" - ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating - Initial creation in progress. + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting - Deletion in progress. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateSucceeded - Resource has been created. ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" + // ProvisioningStateUpdating - Update in progress. + ProvisioningStateUpdating ProvisioningState = "Updating" ) // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. @@ -104,29 +157,13 @@ func PossibleProvisioningStateValues() []ProvisioningState { } } -// ResourceIdentityType - String of the resource identity type. -type ResourceIdentityType string - -const ( - ResourceIdentityTypeNone ResourceIdentityType = "None" - ResourceIdentityTypeSystemAssigned ResourceIdentityType = "SystemAssigned" - ResourceIdentityTypeUserAssigned ResourceIdentityType = "UserAssigned" -) - -// PossibleResourceIdentityTypeValues returns the possible values for the ResourceIdentityType const type. -func PossibleResourceIdentityTypeValues() []ResourceIdentityType { - return []ResourceIdentityType{ - ResourceIdentityTypeNone, - ResourceIdentityTypeSystemAssigned, - ResourceIdentityTypeUserAssigned, - } -} - // SelectorType - Enum of the selector type. type SelectorType string const ( - SelectorTypeList SelectorType = "List" + // SelectorTypeList - List selector type. + SelectorTypeList SelectorType = "List" + // SelectorTypeQuery - Query selector type. SelectorTypeQuery SelectorType = "Query" ) @@ -142,6 +179,7 @@ func PossibleSelectorTypeValues() []SelectorType { type TargetReferenceType string const ( + // TargetReferenceTypeChaosTarget - Chaos target reference type. TargetReferenceTypeChaosTarget TargetReferenceType = "ChaosTarget" ) diff --git a/sdk/resourcemanager/chaos/armchaos/experimentexecutions_client.go b/sdk/resourcemanager/chaos/armchaos/experimentexecutions_client.go new file mode 100644 index 000000000000..f8b9669c3fc7 --- /dev/null +++ b/sdk/resourcemanager/chaos/armchaos/experimentexecutions_client.go @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armchaos + +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" +) + +// ExperimentExecutionsClient contains the methods for the ExperimentExecutions group. +// Don't use this type directly, use NewExperimentExecutionsClient() instead. +type ExperimentExecutionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewExperimentExecutionsClient creates a new instance of ExperimentExecutionsClient 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 NewExperimentExecutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExperimentExecutionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExperimentExecutionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// GetExecution - Get an execution of an Experiment resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - experimentName - String that represents a Experiment resource name. +// - executionID - GUID that represents a Experiment execution detail. +// - options - ExperimentExecutionsClientGetExecutionOptions contains the optional parameters for the ExperimentExecutionsClient.GetExecution +// method. +func (client *ExperimentExecutionsClient) GetExecution(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentExecutionsClientGetExecutionOptions) (ExperimentExecutionsClientGetExecutionResponse, error) { + var err error + const operationName = "ExperimentExecutionsClient.GetExecution" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getExecutionCreateRequest(ctx, resourceGroupName, experimentName, executionID, options) + if err != nil { + return ExperimentExecutionsClientGetExecutionResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExperimentExecutionsClientGetExecutionResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExperimentExecutionsClientGetExecutionResponse{}, err + } + resp, err := client.getExecutionHandleResponse(httpResp) + return resp, err +} + +// getExecutionCreateRequest creates the GetExecution request. +func (client *ExperimentExecutionsClient) getExecutionCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, executionID string, _ *ExperimentExecutionsClientGetExecutionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if experimentName == "" { + return nil, errors.New("parameter experimentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{experimentName}", url.PathEscape(experimentName)) + if executionID == "" { + return nil, errors.New("parameter executionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{executionId}", url.PathEscape(executionID)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getExecutionHandleResponse handles the GetExecution response. +func (client *ExperimentExecutionsClient) getExecutionHandleResponse(resp *http.Response) (ExperimentExecutionsClientGetExecutionResponse, error) { + result := ExperimentExecutionsClientGetExecutionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentExecution); err != nil { + return ExperimentExecutionsClientGetExecutionResponse{}, err + } + return result, nil +} + +// GetExecutionDetails - Execution details of an experiment resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - experimentName - String that represents a Experiment resource name. +// - executionID - GUID that represents a Experiment execution detail. +// - options - ExperimentExecutionsClientGetExecutionDetailsOptions contains the optional parameters for the ExperimentExecutionsClient.GetExecutionDetails +// method. +func (client *ExperimentExecutionsClient) GetExecutionDetails(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentExecutionsClientGetExecutionDetailsOptions) (ExperimentExecutionsClientGetExecutionDetailsResponse, error) { + var err error + const operationName = "ExperimentExecutionsClient.GetExecutionDetails" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getExecutionDetailsCreateRequest(ctx, resourceGroupName, experimentName, executionID, options) + if err != nil { + return ExperimentExecutionsClientGetExecutionDetailsResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExperimentExecutionsClientGetExecutionDetailsResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExperimentExecutionsClientGetExecutionDetailsResponse{}, err + } + resp, err := client.getExecutionDetailsHandleResponse(httpResp) + return resp, err +} + +// getExecutionDetailsCreateRequest creates the GetExecutionDetails request. +func (client *ExperimentExecutionsClient) getExecutionDetailsCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, executionID string, _ *ExperimentExecutionsClientGetExecutionDetailsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}/getExecutionDetails" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if experimentName == "" { + return nil, errors.New("parameter experimentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{experimentName}", url.PathEscape(experimentName)) + if executionID == "" { + return nil, errors.New("parameter executionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{executionId}", url.PathEscape(executionID)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getExecutionDetailsHandleResponse handles the GetExecutionDetails response. +func (client *ExperimentExecutionsClient) getExecutionDetailsHandleResponse(resp *http.Response) (ExperimentExecutionsClientGetExecutionDetailsResponse, error) { + result := ExperimentExecutionsClientGetExecutionDetailsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentExecutionDetails); err != nil { + return ExperimentExecutionsClientGetExecutionDetailsResponse{}, err + } + return result, nil +} + +// NewListAllExecutionsPager - Get a list of executions of an Experiment resource. +// +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - experimentName - String that represents a Experiment resource name. +// - options - ExperimentExecutionsClientListAllExecutionsOptions contains the optional parameters for the ExperimentExecutionsClient.NewListAllExecutionsPager +// method. +func (client *ExperimentExecutionsClient) NewListAllExecutionsPager(resourceGroupName string, experimentName string, options *ExperimentExecutionsClientListAllExecutionsOptions) *runtime.Pager[ExperimentExecutionsClientListAllExecutionsResponse] { + return runtime.NewPager(runtime.PagingHandler[ExperimentExecutionsClientListAllExecutionsResponse]{ + More: func(page ExperimentExecutionsClientListAllExecutionsResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExperimentExecutionsClientListAllExecutionsResponse) (ExperimentExecutionsClientListAllExecutionsResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExperimentExecutionsClient.NewListAllExecutionsPager") + 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.listAllExecutionsCreateRequest(ctx, resourceGroupName, experimentName, options) + }, nil) + if err != nil { + return ExperimentExecutionsClientListAllExecutionsResponse{}, err + } + return client.listAllExecutionsHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listAllExecutionsCreateRequest creates the ListAllExecutions request. +func (client *ExperimentExecutionsClient) listAllExecutionsCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, _ *ExperimentExecutionsClientListAllExecutionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if experimentName == "" { + return nil, errors.New("parameter experimentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{experimentName}", url.PathEscape(experimentName)) + 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-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listAllExecutionsHandleResponse handles the ListAllExecutions response. +func (client *ExperimentExecutionsClient) listAllExecutionsHandleResponse(resp *http.Response) (ExperimentExecutionsClientListAllExecutionsResponse, error) { + result := ExperimentExecutionsClientListAllExecutionsResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentExecutionListResult); err != nil { + return ExperimentExecutionsClientListAllExecutionsResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/chaos/armchaos/experimentexecutions_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/experimentexecutions_client_example_test.go new file mode 100644 index 000000000000..e37b758d2baa --- /dev/null +++ b/sdk/resourcemanager/chaos/armchaos/experimentexecutions_client_example_test.go @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armchaos_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" + "log" +) + +// Generated from example definition: 2025-01-01/Experiments_GetExecution.json +func ExampleExperimentExecutionsClient_GetExecution() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExperimentExecutionsClient().GetExecution(ctx, "exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", 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 = armchaos.ExperimentExecutionsClientGetExecutionResponse{ + // ExperimentExecution: &armchaos.ExperimentExecution{ + // Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"), + // Type: to.Ptr("Microsoft.Chaos/experiments/executions"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executions/f24500ad-744e-4a26-864b-b76199eac333"), + // Properties: &armchaos.ExperimentExecutionProperties{ + // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()), + // Status: to.Ptr("failed"), + // StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.9281956Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-01/Experiments_ExecutionDetails.json +func ExampleExperimentExecutionsClient_GetExecutionDetails() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExperimentExecutionsClient().GetExecutionDetails(ctx, "exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", 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 = armchaos.ExperimentExecutionsClientGetExecutionDetailsResponse{ + // ExperimentExecutionDetails: &armchaos.ExperimentExecutionDetails{ + // Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"), + // Type: to.Ptr("Microsoft.Chaos/experiments/executions/getExecutionDetails"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executions/f24500ad-744e-4a26-864b-b76199eac333/getExecutionDetails"), + // Properties: &armchaos.ExperimentExecutionDetailsProperties{ + // FailureReason: to.Ptr("Dependency failure"), + // LastActionAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()), + // RunInformation: &armchaos.ExperimentExecutionDetailsPropertiesRunInformation{ + // Steps: []*armchaos.StepStatus{ + // { + // Branches: []*armchaos.BranchStatus{ + // { + // Actions: []*armchaos.ActionStatus{ + // { + // ActionID: to.Ptr("59499d33-6751-4b6e-a1f6-58f4d56a040a"), + // ActionName: to.Ptr("urn:provider:agent-v2:Microsoft.Azure.Chaos.Fault.CPUPressureAllProcessors"), + // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T13:56:13.6270153-08:00"); return t}()), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T13:56:13.6270153-08:00"); return t}()), + // Status: to.Ptr("failed"), + // Targets: []*armchaos.ExperimentExecutionActionTargetDetailsProperties{ + // { + // Status: to.Ptr("succeeded"), + // Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"), + // TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55+00:00"); return t}()), + // TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55+00:00"); return t}()), + // }, + // { + // Status: to.Ptr("failed"), + // Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"), + // TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55+00:00"); return t}()), + // TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55+00:00"); return t}()), + // }, + // }, + // }, + // }, + // BranchID: to.Ptr("FirstBranch"), + // BranchName: to.Ptr("FirstBranch"), + // Status: to.Ptr("failed"), + // }, + // }, + // Status: to.Ptr("failed"), + // StepID: to.Ptr("FirstStep"), + // StepName: to.Ptr("FirstStep"), + // }, + // }, + // }, + // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()), + // Status: to.Ptr("failed"), + // StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.9281956Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-01/Experiments_ListAllExecutions.json +func ExampleExperimentExecutionsClient_NewListAllExecutionsPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewExperimentExecutionsClient().NewListAllExecutionsPager("exampleRG", "exampleExperiment", 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 = armchaos.ExperimentExecutionsClientListAllExecutionsResponse{ + // ExperimentExecutionListResult: armchaos.ExperimentExecutionListResult{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executionDetails?continuationToken=&api-version=2025-01-01"), + // Value: []*armchaos.ExperimentExecution{ + // { + // Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"), + // Type: to.Ptr("Microsoft.Chaos/experiments/executions"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executions/f24500ad-744e-4a26-864b-b76199eac333"), + // Properties: &armchaos.ExperimentExecutionProperties{ + // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()), + // Status: to.Ptr("failed"), + // StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.9281956Z"); return t}()), + // }, + // }, + // { + // Name: to.Ptr("14d98367-52ef-4596-be4f-53fc81bbfc33"), + // Type: to.Ptr("Microsoft.Chaos/experiments/executions"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executions/14d98367-52ef-4596-be4f-53fc81bbfc33"), + // Properties: &armchaos.ExperimentExecutionProperties{ + // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.2552574Z"); return t}()), + // Status: to.Ptr("success"), + // StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.9281956Z"); return t}()), + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/chaos/armchaos/experiments_client.go b/sdk/resourcemanager/chaos/armchaos/experiments_client.go index 404257553384..5a9f88ee4ca7 100644 --- a/sdk/resourcemanager/chaos/armchaos/experiments_client.go +++ b/sdk/resourcemanager/chaos/armchaos/experiments_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 armchaos @@ -29,7 +25,7 @@ type ExperimentsClient struct { } // NewExperimentsClient creates a new instance of ExperimentsClient with the specified values. -// - subscriptionID - GUID that represents an Azure subscription ID. +// - 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 NewExperimentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExperimentsClient, error) { @@ -47,8 +43,8 @@ func NewExperimentsClient(subscriptionID string, credential azcore.TokenCredenti // BeginCancel - Cancel a running Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. // - options - ExperimentsClientBeginCancelOptions contains the optional parameters for the ExperimentsClient.BeginCancel method. func (client *ExperimentsClient) BeginCancel(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginCancelOptions) (*runtime.Poller[ExperimentsClientCancelResponse], error) { @@ -58,8 +54,7 @@ func (client *ExperimentsClient) BeginCancel(ctx context.Context, resourceGroupN return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExperimentsClientCancelResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -72,7 +67,7 @@ func (client *ExperimentsClient) BeginCancel(ctx context.Context, resourceGroupN // Cancel - Cancel a running Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 +// Generated from API version 2025-01-01 func (client *ExperimentsClient) cancel(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginCancelOptions) (*http.Response, error) { var err error const operationName = "ExperimentsClient.BeginCancel" @@ -95,7 +90,7 @@ func (client *ExperimentsClient) cancel(ctx context.Context, resourceGroupName s } // cancelCreateRequest creates the Cancel request. -func (client *ExperimentsClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginCancelOptions) (*policy.Request, error) { +func (client *ExperimentsClient) cancelCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, _ *ExperimentsClientBeginCancelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -114,7 +109,7 @@ func (client *ExperimentsClient) cancelCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -123,21 +118,20 @@ func (client *ExperimentsClient) cancelCreateRequest(ctx context.Context, resour // BeginCreateOrUpdate - Create or update a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. -// - experiment - Experiment resource to be created or updated. +// - resource - Experiment resource to be created or updated. // - options - ExperimentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExperimentsClient.BeginCreateOrUpdate // method. -func (client *ExperimentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, experimentName string, experiment Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExperimentsClientCreateOrUpdateResponse], error) { +func (client *ExperimentsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, experimentName string, resource Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExperimentsClientCreateOrUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, experimentName, experiment, options) + resp, err := client.createOrUpdate(ctx, resourceGroupName, experimentName, resource, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExperimentsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -150,14 +144,14 @@ func (client *ExperimentsClient) BeginCreateOrUpdate(ctx context.Context, resour // CreateOrUpdate - Create or update a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -func (client *ExperimentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, experimentName string, experiment Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { +// Generated from API version 2025-01-01 +func (client *ExperimentsClient) createOrUpdate(ctx context.Context, resourceGroupName string, experimentName string, resource Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "ExperimentsClient.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, experimentName, experiment, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, experimentName, resource, options) if err != nil { return nil, err } @@ -173,7 +167,7 @@ func (client *ExperimentsClient) createOrUpdate(ctx context.Context, resourceGro } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ExperimentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, experiment Experiment, options *ExperimentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ExperimentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, resource Experiment, _ *ExperimentsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -192,10 +186,11 @@ func (client *ExperimentsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, experiment); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -204,8 +199,8 @@ func (client *ExperimentsClient) createOrUpdateCreateRequest(ctx context.Context // BeginDelete - Delete a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. // - options - ExperimentsClientBeginDeleteOptions contains the optional parameters for the ExperimentsClient.BeginDelete method. func (client *ExperimentsClient) BeginDelete(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginDeleteOptions) (*runtime.Poller[ExperimentsClientDeleteResponse], error) { @@ -215,8 +210,7 @@ func (client *ExperimentsClient) BeginDelete(ctx context.Context, resourceGroupN return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExperimentsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -229,7 +223,7 @@ func (client *ExperimentsClient) BeginDelete(ctx context.Context, resourceGroupN // Delete - Delete a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 +// Generated from API version 2025-01-01 func (client *ExperimentsClient) deleteOperation(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "ExperimentsClient.BeginDelete" @@ -244,7 +238,7 @@ func (client *ExperimentsClient) deleteOperation(ctx context.Context, resourceGr if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -252,7 +246,7 @@ func (client *ExperimentsClient) deleteOperation(ctx context.Context, resourceGr } // deleteCreateRequest creates the Delete request. -func (client *ExperimentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ExperimentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, _ *ExperimentsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -271,87 +265,17 @@ func (client *ExperimentsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// ExecutionDetails - Execution details of an experiment resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - experimentName - String that represents a Experiment resource name. -// - executionID - GUID that represents a Experiment execution detail. -// - options - ExperimentsClientExecutionDetailsOptions contains the optional parameters for the ExperimentsClient.ExecutionDetails -// method. -func (client *ExperimentsClient) ExecutionDetails(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentsClientExecutionDetailsOptions) (ExperimentsClientExecutionDetailsResponse, error) { - var err error - const operationName = "ExperimentsClient.ExecutionDetails" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.executionDetailsCreateRequest(ctx, resourceGroupName, experimentName, executionID, options) - if err != nil { - return ExperimentsClientExecutionDetailsResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ExperimentsClientExecutionDetailsResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ExperimentsClientExecutionDetailsResponse{}, err - } - resp, err := client.executionDetailsHandleResponse(httpResp) - return resp, err -} - -// executionDetailsCreateRequest creates the ExecutionDetails request. -func (client *ExperimentsClient) executionDetailsCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentsClientExecutionDetailsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}/getExecutionDetails" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if experimentName == "" { - return nil, errors.New("parameter experimentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{experimentName}", url.PathEscape(experimentName)) - if executionID == "" { - return nil, errors.New("parameter executionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{executionId}", url.PathEscape(executionID)) - 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-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// executionDetailsHandleResponse handles the ExecutionDetails response. -func (client *ExperimentsClient) executionDetailsHandleResponse(resp *http.Response) (ExperimentsClientExecutionDetailsResponse, error) { - result := ExperimentsClientExecutionDetailsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentExecutionDetails); err != nil { - return ExperimentsClientExecutionDetailsResponse{}, err - } - return result, nil -} - // Get - Get a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. // - options - ExperimentsClientGetOptions contains the optional parameters for the ExperimentsClient.Get method. func (client *ExperimentsClient) Get(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientGetOptions) (ExperimentsClientGetResponse, error) { @@ -377,7 +301,7 @@ func (client *ExperimentsClient) Get(ctx context.Context, resourceGroupName stri } // getCreateRequest creates the Get request. -func (client *ExperimentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientGetOptions) (*policy.Request, error) { +func (client *ExperimentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, _ *ExperimentsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -396,7 +320,7 @@ func (client *ExperimentsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -411,80 +335,10 @@ func (client *ExperimentsClient) getHandleResponse(resp *http.Response) (Experim return result, nil } -// GetExecution - Get an execution of an Experiment resource. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - experimentName - String that represents a Experiment resource name. -// - executionID - GUID that represents a Experiment execution detail. -// - options - ExperimentsClientGetExecutionOptions contains the optional parameters for the ExperimentsClient.GetExecution -// method. -func (client *ExperimentsClient) GetExecution(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentsClientGetExecutionOptions) (ExperimentsClientGetExecutionResponse, error) { - var err error - const operationName = "ExperimentsClient.GetExecution" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getExecutionCreateRequest(ctx, resourceGroupName, experimentName, executionID, options) - if err != nil { - return ExperimentsClientGetExecutionResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ExperimentsClientGetExecutionResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ExperimentsClientGetExecutionResponse{}, err - } - resp, err := client.getExecutionHandleResponse(httpResp) - return resp, err -} - -// getExecutionCreateRequest creates the GetExecution request. -func (client *ExperimentsClient) getExecutionCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *ExperimentsClientGetExecutionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions/{executionId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if experimentName == "" { - return nil, errors.New("parameter experimentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{experimentName}", url.PathEscape(experimentName)) - if executionID == "" { - return nil, errors.New("parameter executionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{executionId}", url.PathEscape(executionID)) - 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-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getExecutionHandleResponse handles the GetExecution response. -func (client *ExperimentsClient) getExecutionHandleResponse(resp *http.Response) (ExperimentsClientGetExecutionResponse, error) { - result := ExperimentsClientGetExecutionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentExecution); err != nil { - return ExperimentsClientGetExecutionResponse{}, err - } - return result, nil -} - // NewListPager - Get a list of Experiment resources in a resource group. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ExperimentsClientListOptions contains the optional parameters for the ExperimentsClient.NewListPager method. func (client *ExperimentsClient) NewListPager(resourceGroupName string, options *ExperimentsClientListOptions) *runtime.Pager[ExperimentsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ExperimentsClientListResponse]{ @@ -525,7 +379,7 @@ func (client *ExperimentsClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } @@ -548,7 +402,7 @@ func (client *ExperimentsClient) listHandleResponse(resp *http.Response) (Experi // NewListAllPager - Get a list of Experiment resources in a subscription. // -// Generated from API version 2024-01-01 +// Generated from API version 2025-01-01 // - options - ExperimentsClientListAllOptions contains the optional parameters for the ExperimentsClient.NewListAllPager method. func (client *ExperimentsClient) NewListAllPager(options *ExperimentsClientListAllOptions) *runtime.Pager[ExperimentsClientListAllResponse] { return runtime.NewPager(runtime.PagingHandler[ExperimentsClientListAllResponse]{ @@ -585,7 +439,7 @@ func (client *ExperimentsClient) listAllCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } @@ -606,76 +460,11 @@ func (client *ExperimentsClient) listAllHandleResponse(resp *http.Response) (Exp return result, nil } -// NewListAllExecutionsPager - Get a list of executions of an Experiment resource. -// -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - experimentName - String that represents a Experiment resource name. -// - options - ExperimentsClientListAllExecutionsOptions contains the optional parameters for the ExperimentsClient.NewListAllExecutionsPager -// method. -func (client *ExperimentsClient) NewListAllExecutionsPager(resourceGroupName string, experimentName string, options *ExperimentsClientListAllExecutionsOptions) *runtime.Pager[ExperimentsClientListAllExecutionsResponse] { - return runtime.NewPager(runtime.PagingHandler[ExperimentsClientListAllExecutionsResponse]{ - More: func(page ExperimentsClientListAllExecutionsResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *ExperimentsClientListAllExecutionsResponse) (ExperimentsClientListAllExecutionsResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExperimentsClient.NewListAllExecutionsPager") - 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.listAllExecutionsCreateRequest(ctx, resourceGroupName, experimentName, options) - }, nil) - if err != nil { - return ExperimentsClientListAllExecutionsResponse{}, err - } - return client.listAllExecutionsHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listAllExecutionsCreateRequest creates the ListAllExecutions request. -func (client *ExperimentsClient) listAllExecutionsCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientListAllExecutionsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executions" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if experimentName == "" { - return nil, errors.New("parameter experimentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{experimentName}", url.PathEscape(experimentName)) - 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-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listAllExecutionsHandleResponse handles the ListAllExecutions response. -func (client *ExperimentsClient) listAllExecutionsHandleResponse(resp *http.Response) (ExperimentsClientListAllExecutionsResponse, error) { - result := ExperimentsClientListAllExecutionsResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ExperimentExecutionListResult); err != nil { - return ExperimentsClientListAllExecutionsResponse{}, err - } - return result, nil -} - // BeginStart - Start a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. // - options - ExperimentsClientBeginStartOptions contains the optional parameters for the ExperimentsClient.BeginStart method. func (client *ExperimentsClient) BeginStart(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginStartOptions) (*runtime.Poller[ExperimentsClientStartResponse], error) { @@ -685,8 +474,7 @@ func (client *ExperimentsClient) BeginStart(ctx context.Context, resourceGroupNa return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExperimentsClientStartResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -699,7 +487,7 @@ func (client *ExperimentsClient) BeginStart(ctx context.Context, resourceGroupNa // Start - Start a Experiment resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 +// Generated from API version 2025-01-01 func (client *ExperimentsClient) start(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginStartOptions) (*http.Response, error) { var err error const operationName = "ExperimentsClient.BeginStart" @@ -722,7 +510,7 @@ func (client *ExperimentsClient) start(ctx context.Context, resourceGroupName st } // startCreateRequest creates the Start request. -func (client *ExperimentsClient) startCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, options *ExperimentsClientBeginStartOptions) (*policy.Request, error) { +func (client *ExperimentsClient) startCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, _ *ExperimentsClientBeginStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -741,7 +529,7 @@ func (client *ExperimentsClient) startCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -750,20 +538,19 @@ func (client *ExperimentsClient) startCreateRequest(ctx context.Context, resourc // BeginUpdate - The operation to update an experiment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - experimentName - String that represents a Experiment resource name. -// - experiment - Parameters supplied to the Update experiment operation. +// - properties - Parameters supplied to the Update experiment operation. // - options - ExperimentsClientBeginUpdateOptions contains the optional parameters for the ExperimentsClient.BeginUpdate method. -func (client *ExperimentsClient) BeginUpdate(ctx context.Context, resourceGroupName string, experimentName string, experiment ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*runtime.Poller[ExperimentsClientUpdateResponse], error) { +func (client *ExperimentsClient) BeginUpdate(ctx context.Context, resourceGroupName string, experimentName string, properties ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*runtime.Poller[ExperimentsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, experimentName, experiment, options) + resp, err := client.update(ctx, resourceGroupName, experimentName, properties, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExperimentsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -776,14 +563,14 @@ func (client *ExperimentsClient) BeginUpdate(ctx context.Context, resourceGroupN // Update - The operation to update an experiment. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -func (client *ExperimentsClient) update(ctx context.Context, resourceGroupName string, experimentName string, experiment ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2025-01-01 +func (client *ExperimentsClient) update(ctx context.Context, resourceGroupName string, experimentName string, properties ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "ExperimentsClient.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, experimentName, experiment, options) + req, err := client.updateCreateRequest(ctx, resourceGroupName, experimentName, properties, options) if err != nil { return nil, err } @@ -791,7 +578,7 @@ func (client *ExperimentsClient) update(ctx context.Context, resourceGroupName s if err != nil { return nil, err } - if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { err = runtime.NewResponseError(httpResp) return nil, err } @@ -799,7 +586,7 @@ func (client *ExperimentsClient) update(ctx context.Context, resourceGroupName s } // updateCreateRequest creates the Update request. -func (client *ExperimentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, experiment ExperimentUpdate, options *ExperimentsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *ExperimentsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, experimentName string, properties ExperimentUpdate, _ *ExperimentsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -818,10 +605,11 @@ func (client *ExperimentsClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, experiment); 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/chaos/armchaos/experiments_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/experiments_client_example_test.go index fb537dbc74ef..7737c506aa3a 100644 --- a/sdk/resourcemanager/chaos/armchaos/experiments_client_example_test.go +++ b/sdk/resourcemanager/chaos/armchaos/experiments_client_example_test.go @@ -1,197 +1,29 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights 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 armchaos_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/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInASubscription.json -func ExampleExperimentsClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExperimentsClient().NewListAllPager(&armchaos.ExperimentsClientListAllOptions{Running: nil, - ContinuationToken: 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.ExperimentListResult = armchaos.ExperimentListResult{ - // Value: []*armchaos.Experiment{ - // { - // Name: to.Ptr("exampleExperiment"), - // Type: to.Ptr("Microsoft.Chaos/experiments"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), - // Location: to.Ptr("centraluseuap"), - // Identity: &armchaos.ResourceIdentity{ - // Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), - // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), - // }, - // Properties: &armchaos.ExperimentProperties{ - // Selectors: []armchaos.TargetSelectorClassification{ - // &armchaos.TargetListSelector{ - // Type: to.Ptr(armchaos.SelectorTypeList), - // ID: to.Ptr("selector1"), - // Targets: []*armchaos.TargetReference{ - // { - // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - // }}, - // }}, - // Steps: []*armchaos.ExperimentStep{ - // { - // Name: to.Ptr("step1"), - // Branches: []*armchaos.ExperimentBranch{ - // { - // Name: to.Ptr("branch1"), - // Actions: []armchaos.ExperimentActionClassification{ - // &armchaos.ContinuousAction{ - // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), - // Type: to.Ptr("continuous"), - // Duration: to.Ptr("PT10M"), - // Parameters: []*armchaos.KeyValuePair{ - // { - // Key: to.Ptr("abruptShutdown"), - // Value: to.Ptr("false"), - // }}, - // SelectorID: to.Ptr("selector1"), - // }}, - // }}, - // }}, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // CreatedBy: to.Ptr("User"), - // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedBy: to.Ptr("User"), - // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentsInAResourceGroup.json -func ExampleExperimentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewExperimentsClient().NewListPager("exampleRG", &armchaos.ExperimentsClientListOptions{Running: nil, - ContinuationToken: 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.ExperimentListResult = armchaos.ExperimentListResult{ - // Value: []*armchaos.Experiment{ - // { - // Name: to.Ptr("exampleExperiment"), - // Type: to.Ptr("Microsoft.Chaos/experiments"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), - // Location: to.Ptr("centraluseuap"), - // Identity: &armchaos.ResourceIdentity{ - // Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), - // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), - // }, - // Properties: &armchaos.ExperimentProperties{ - // Selectors: []armchaos.TargetSelectorClassification{ - // &armchaos.TargetListSelector{ - // Type: to.Ptr(armchaos.SelectorTypeList), - // ID: to.Ptr("selector1"), - // Targets: []*armchaos.TargetReference{ - // { - // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - // }}, - // }}, - // Steps: []*armchaos.ExperimentStep{ - // { - // Name: to.Ptr("step1"), - // Branches: []*armchaos.ExperimentBranch{ - // { - // Name: to.Ptr("branch1"), - // Actions: []armchaos.ExperimentActionClassification{ - // &armchaos.ContinuousAction{ - // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), - // Type: to.Ptr("continuous"), - // Duration: to.Ptr("PT10M"), - // Parameters: []*armchaos.KeyValuePair{ - // { - // Key: to.Ptr("abruptShutdown"), - // Value: to.Ptr("false"), - // }}, - // SelectorID: to.Ptr("selector1"), - // }}, - // }}, - // }}, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // CreatedBy: to.Ptr("User"), - // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedBy: to.Ptr("User"), - // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteExperiment.json -func ExampleExperimentsClient_BeginDelete() { +// Generated from example definition: 2025-01-01/Experiments_Cancel.json +func ExampleExperimentsClient_BeginCancel() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewExperimentsClient().BeginDelete(ctx, "exampleRG", "exampleExperiment", nil) + poller, err := clientFactory.NewExperimentsClient().BeginCancel(ctx, "exampleRG", "exampleExperiment", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -201,93 +33,26 @@ func ExampleExperimentsClient_BeginDelete() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperiment.json -func ExampleExperimentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewExperimentsClient().Get(ctx, "exampleRG", "exampleExperiment", 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.Experiment = armchaos.Experiment{ - // Name: to.Ptr("exampleExperiment"), - // Type: to.Ptr("Microsoft.Chaos/experiments"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), - // Location: to.Ptr("centraluseuap"), - // Identity: &armchaos.ResourceIdentity{ - // Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), - // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), - // }, - // Properties: &armchaos.ExperimentProperties{ - // Selectors: []armchaos.TargetSelectorClassification{ - // &armchaos.TargetListSelector{ - // Type: to.Ptr(armchaos.SelectorTypeList), - // ID: to.Ptr("selector1"), - // Targets: []*armchaos.TargetReference{ - // { - // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - // }}, - // }}, - // Steps: []*armchaos.ExperimentStep{ - // { - // Name: to.Ptr("step1"), - // Branches: []*armchaos.ExperimentBranch{ - // { - // Name: to.Ptr("branch1"), - // Actions: []armchaos.ExperimentActionClassification{ - // &armchaos.ContinuousAction{ - // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), - // Type: to.Ptr("continuous"), - // Duration: to.Ptr("PT10M"), - // Parameters: []*armchaos.KeyValuePair{ - // { - // Key: to.Ptr("abruptShutdown"), - // Value: to.Ptr("false"), - // }}, - // SelectorID: to.Ptr("selector1"), - // }}, - // }}, - // }}, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // CreatedBy: to.Ptr("User"), - // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedBy: to.Ptr("User"), - // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateExperiment.json +// Generated from example definition: 2025-01-01/Experiments_CreateOrUpdate.json func ExampleExperimentsClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewExperimentsClient().BeginCreateOrUpdate(ctx, "exampleRG", "exampleExperiment", armchaos.Experiment{ - Location: to.Ptr("eastus2euap"), - Identity: &armchaos.ResourceIdentity{ - Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), + Identity: &armchaos.ManagedServiceIdentity{ + Type: to.Ptr(armchaos.ManagedServiceIdentityTypeSystemAssigned), }, + Tags: map[string]*string{ + "key7131": to.Ptr("ryohwcoiccwsnewjigfmijz"), + "key2138": to.Ptr("fjaeecgnvqd"), + }, + Location: to.Ptr("eastus2euap"), Properties: &armchaos.ExperimentProperties{ Selectors: []armchaos.TargetSelectorClassification{ &armchaos.TargetListSelector{ @@ -297,8 +62,10 @@ func ExampleExperimentsClient_BeginCreateOrUpdate() { { Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - }}, - }}, + }, + }, + }, + }, Steps: []*armchaos.ExperimentStep{ { Name: to.Ptr("step1"), @@ -308,17 +75,21 @@ func ExampleExperimentsClient_BeginCreateOrUpdate() { Actions: []armchaos.ExperimentActionClassification{ &armchaos.ContinuousAction{ Name: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - Type: to.Ptr("continuous"), + Type: to.Ptr(armchaos.ExperimentActionTypeContinuous), Duration: to.Ptr("PT10M"), Parameters: []*armchaos.KeyValuePair{ { Key: to.Ptr("abruptShutdown"), Value: to.Ptr("false"), - }}, + }, + }, SelectorID: to.Ptr("selector1"), - }}, - }}, - }}, + }, + }, + }, + }, + }, + }, }, }, nil) if err != nil { @@ -331,83 +102,84 @@ func ExampleExperimentsClient_BeginCreateOrUpdate() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Experiment = armchaos.Experiment{ - // Name: to.Ptr("exampleExperiment"), - // Type: to.Ptr("Microsoft.Chaos/experiments"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), - // Location: to.Ptr("eastus2euap"), - // Identity: &armchaos.ResourceIdentity{ - // Type: to.Ptr(armchaos.ResourceIdentityTypeSystemAssigned), - // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), - // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), - // }, - // Properties: &armchaos.ExperimentProperties{ - // ProvisioningState: to.Ptr(armchaos.ProvisioningStateSucceeded), - // Selectors: []armchaos.TargetSelectorClassification{ - // &armchaos.TargetListSelector{ - // Type: to.Ptr(armchaos.SelectorTypeList), - // ID: to.Ptr("selector1"), - // Targets: []*armchaos.TargetReference{ - // { - // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), - // }}, - // }}, - // Steps: []*armchaos.ExperimentStep{ - // { - // Name: to.Ptr("step1"), - // Branches: []*armchaos.ExperimentBranch{ - // { - // Name: to.Ptr("branch1"), - // Actions: []armchaos.ExperimentActionClassification{ - // &armchaos.ContinuousAction{ - // Name: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), - // Type: to.Ptr("continuous"), - // Duration: to.Ptr("PT10M"), - // Parameters: []*armchaos.KeyValuePair{ - // { - // Key: to.Ptr("abruptShutdown"), - // Value: to.Ptr("false"), - // }}, - // SelectorID: to.Ptr("selector1"), - // }}, - // }}, - // }}, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // CreatedBy: to.Ptr("User"), - // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedBy: to.Ptr("User"), - // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), + // res = armchaos.ExperimentsClientCreateOrUpdateResponse{ + // Experiment: &armchaos.Experiment{ + // Name: to.Ptr("exampleExperiment"), + // Type: to.Ptr("Microsoft.Chaos/experiments"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), + // Identity: &armchaos.ManagedServiceIdentity{ + // Type: to.Ptr(armchaos.ManagedServiceIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), + // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), + // }, + // Tags: map[string]*string{ + // "key7131": to.Ptr("ryohwcoiccwsnewjigfmijz"), + // "key2138": to.Ptr("fjaeecgnvqd"), + // }, + // Location: to.Ptr("eastus2euap"), + // Properties: &armchaos.ExperimentProperties{ + // ProvisioningState: to.Ptr(armchaos.ProvisioningStateUpdating), + // Selectors: []armchaos.TargetSelectorClassification{ + // &armchaos.TargetListSelector{ + // Type: to.Ptr(armchaos.SelectorTypeList), + // ID: to.Ptr("selector1"), + // Targets: []*armchaos.TargetReference{ + // { + // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), + // }, + // }, + // }, + // }, + // Steps: []*armchaos.ExperimentStep{ + // { + // Name: to.Ptr("step1"), + // Branches: []*armchaos.ExperimentBranch{ + // { + // Name: to.Ptr("branch1"), + // Actions: []armchaos.ExperimentActionClassification{ + // &armchaos.ContinuousAction{ + // Name: to.Ptr("urn:csci:microsoft:virtualMachine:shutdown/1.0"), + // Type: to.Ptr(armchaos.ExperimentActionTypeContinuous), + // Duration: to.Ptr("PT10M"), + // Parameters: []*armchaos.KeyValuePair{ + // { + // Key: to.Ptr("abruptShutdown"), + // Value: to.Ptr("false"), + // }, + // }, + // SelectorID: to.Ptr("selector1"), + // }, + // }, + // }, + // }, + // }, + // }, + // }, + // SystemData: &armchaos.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // CreatedBy: to.Ptr("User"), + // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // LastModifiedBy: to.Ptr("User"), + // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), + // }, // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/UpdateExperiment.json -func ExampleExperimentsClient_BeginUpdate() { +// Generated from example definition: 2025-01-01/Experiments_Delete.json +func ExampleExperimentsClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewExperimentsClient().BeginUpdate(ctx, "exampleRG", "exampleExperiment", armchaos.ExperimentUpdate{ - Identity: &armchaos.ResourceIdentity{ - Type: to.Ptr(armchaos.ResourceIdentityTypeUserAssigned), - UserAssignedIdentities: map[string]*armchaos.UserAssignedIdentity{ - "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI": {}, - }, - }, - Tags: map[string]*string{ - "key1": to.Ptr("value1"), - "key2": to.Ptr("value2"), - }, - }, nil) + poller, err := clientFactory.NewExperimentsClient().BeginDelete(ctx, "exampleRG", "exampleExperiment", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -417,60 +189,186 @@ func ExampleExperimentsClient_BeginUpdate() { } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CancelExperiment.json -func ExampleExperimentsClient_BeginCancel() { +// Generated from example definition: 2025-01-01/Experiments_Get.json +func ExampleExperimentsClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewExperimentsClient().BeginCancel(ctx, "exampleRG", "exampleExperiment", nil) + res, err := clientFactory.NewExperimentsClient().Get(ctx, "exampleRG", "exampleExperiment", 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 = armchaos.ExperimentsClientGetResponse{ + // Experiment: &armchaos.Experiment{ + // Name: to.Ptr("exampleExperiment"), + // Type: to.Ptr("Microsoft.Chaos/experiments"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), + // Identity: &armchaos.ManagedServiceIdentity{ + // Type: to.Ptr(armchaos.ManagedServiceIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), + // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), + // }, + // Location: to.Ptr("centraluseuap"), + // Properties: &armchaos.ExperimentProperties{ + // Selectors: []armchaos.TargetSelectorClassification{ + // &armchaos.TargetListSelector{ + // Type: to.Ptr(armchaos.SelectorTypeList), + // ID: to.Ptr("selector1"), + // Targets: []*armchaos.TargetReference{ + // { + // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), + // }, + // }, + // }, + // }, + // Steps: []*armchaos.ExperimentStep{ + // { + // Name: to.Ptr("step1"), + // Branches: []*armchaos.ExperimentBranch{ + // { + // Name: to.Ptr("branch1"), + // Actions: []armchaos.ExperimentActionClassification{ + // &armchaos.ContinuousAction{ + // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), + // Type: to.Ptr(armchaos.ExperimentActionTypeContinuous), + // Duration: to.Ptr("PT10M"), + // Parameters: []*armchaos.KeyValuePair{ + // { + // Key: to.Ptr("abruptShutdown"), + // Value: to.Ptr("false"), + // }, + // }, + // SelectorID: to.Ptr("selector1"), + // }, + // }, + // }, + // }, + // }, + // }, + // }, + // SystemData: &armchaos.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // CreatedBy: to.Ptr("User"), + // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // LastModifiedBy: to.Ptr("User"), + // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/StartExperiment.json -func ExampleExperimentsClient_BeginStart() { +// Generated from example definition: 2025-01-01/Experiments_List.json +func ExampleExperimentsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewExperimentsClient().BeginStart(ctx, "exampleRG", "exampleExperiment", 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) + pager := clientFactory.NewExperimentsClient().NewListPager("exampleRG", 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 = armchaos.ExperimentsClientListResponse{ + // ExperimentListResult: armchaos.ExperimentListResult{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments?continuationToken=&api-version=2024-11-01-preview"), + // Value: []*armchaos.Experiment{ + // { + // Name: to.Ptr("exampleExperiment"), + // Type: to.Ptr("Microsoft.Chaos/experiments"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), + // Identity: &armchaos.ManagedServiceIdentity{ + // Type: to.Ptr(armchaos.ManagedServiceIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), + // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), + // }, + // Location: to.Ptr("centraluseuap"), + // Properties: &armchaos.ExperimentProperties{ + // Selectors: []armchaos.TargetSelectorClassification{ + // &armchaos.TargetListSelector{ + // Type: to.Ptr(armchaos.SelectorTypeList), + // ID: to.Ptr("selector1"), + // Targets: []*armchaos.TargetReference{ + // { + // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), + // }, + // }, + // }, + // }, + // Steps: []*armchaos.ExperimentStep{ + // { + // Name: to.Ptr("step1"), + // Branches: []*armchaos.ExperimentBranch{ + // { + // Name: to.Ptr("branch1"), + // Actions: []armchaos.ExperimentActionClassification{ + // &armchaos.ContinuousAction{ + // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), + // Type: to.Ptr(armchaos.ExperimentActionTypeContinuous), + // Duration: to.Ptr("PT10M"), + // Parameters: []*armchaos.KeyValuePair{ + // { + // Key: to.Ptr("abruptShutdown"), + // Value: to.Ptr("false"), + // }, + // }, + // SelectorID: to.Ptr("selector1"), + // }, + // }, + // }, + // }, + // }, + // }, + // }, + // SystemData: &armchaos.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // CreatedBy: to.Ptr("User"), + // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // LastModifiedBy: to.Ptr("User"), + // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), + // }, + // }, + // }, + // }, + // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListExperimentExecutions.json -func ExampleExperimentsClient_NewListAllExecutionsPager() { +// Generated from example definition: 2025-01-01/Experiments_ListAll.json +func ExampleExperimentsClient_NewListAllPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewExperimentsClient().NewListAllExecutionsPager("exampleRG", "exampleExperiment", nil) + pager := clientFactory.NewExperimentsClient().NewListAllPager(nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -481,124 +379,191 @@ func ExampleExperimentsClient_NewListAllExecutionsPager() { _ = 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.ExperimentExecutionListResult = armchaos.ExperimentExecutionListResult{ - // Value: []*armchaos.ExperimentExecution{ - // { - // Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"), - // Type: to.Ptr("Microsoft.Chaos/experiments/executions"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executions/"), - // Properties: &armchaos.ExperimentExecutionProperties{ - // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()), - // Status: to.Ptr("failed"), - // StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.928Z"); return t}()), + // page = armchaos.ExperimentsClientListAllResponse{ + // ExperimentListResult: armchaos.ExperimentListResult{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/experiments?continuationToken=&api-version=2024-11-01-preview"), + // Value: []*armchaos.Experiment{ + // { + // Name: to.Ptr("exampleExperiment"), + // Type: to.Ptr("Microsoft.Chaos/experiments"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), + // Identity: &armchaos.ManagedServiceIdentity{ + // Type: to.Ptr(armchaos.ManagedServiceIdentityTypeSystemAssigned), + // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), + // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), + // }, + // Location: to.Ptr("centraluseuap"), + // Properties: &armchaos.ExperimentProperties{ + // Selectors: []armchaos.TargetSelectorClassification{ + // &armchaos.TargetListSelector{ + // Type: to.Ptr(armchaos.SelectorTypeList), + // ID: to.Ptr("selector1"), + // Targets: []*armchaos.TargetReference{ + // { + // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), + // }, + // }, + // }, + // }, + // Steps: []*armchaos.ExperimentStep{ + // { + // Name: to.Ptr("step1"), + // Branches: []*armchaos.ExperimentBranch{ + // { + // Name: to.Ptr("branch1"), + // Actions: []armchaos.ExperimentActionClassification{ + // &armchaos.ContinuousAction{ + // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), + // Type: to.Ptr(armchaos.ExperimentActionTypeContinuous), + // Duration: to.Ptr("PT10M"), + // Parameters: []*armchaos.KeyValuePair{ + // { + // Key: to.Ptr("abruptShutdown"), + // Value: to.Ptr("false"), + // }, + // }, + // SelectorID: to.Ptr("selector1"), + // }, + // }, + // }, + // }, + // }, + // }, + // }, + // SystemData: &armchaos.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // CreatedBy: to.Ptr("User"), + // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // LastModifiedBy: to.Ptr("User"), + // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), + // }, // }, // }, - // { - // Name: to.Ptr("14d98367-52ef-4596-be4f-53fc81bbfc33"), - // Type: to.Ptr("Microsoft.Chaos/experiments/executions"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executionDetails/14d98367-52ef-4596-be4f-53fc81bbfc33"), - // Properties: &armchaos.ExperimentExecutionProperties{ - // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()), - // Status: to.Ptr("success"), - // StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.928Z"); return t}()), - // }, - // }}, + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetExperimentExecution.json -func ExampleExperimentsClient_GetExecution() { +// Generated from example definition: 2025-01-01/Experiments_Start.json +func ExampleExperimentsClient_BeginStart() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewExperimentsClient().GetExecution(ctx, "exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", nil) + poller, err := clientFactory.NewExperimentsClient().BeginStart(ctx, "exampleRG", "exampleExperiment", 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.ExperimentExecution = armchaos.ExperimentExecution{ - // Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"), - // Type: to.Ptr("Microsoft.Chaos/experiments/executions"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executions/f24500ad-744e-4a26-864b-b76199eac333"), - // Properties: &armchaos.ExperimentExecutionProperties{ - // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()), - // Status: to.Ptr("failed"), - // StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.928Z"); return t}()), - // }, - // } + _, 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/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DetailsExperiment.json -func ExampleExperimentsClient_ExecutionDetails() { +// Generated from example definition: 2025-01-01/Experiments_Update.json +func ExampleExperimentsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewExperimentsClient().ExecutionDetails(ctx, "exampleRG", "exampleExperiment", "f24500ad-744e-4a26-864b-b76199eac333", nil) + poller, err := clientFactory.NewExperimentsClient().BeginUpdate(ctx, "exampleRG", "exampleExperiment", armchaos.ExperimentUpdate{ + Identity: &armchaos.ManagedServiceIdentity{ + Type: to.Ptr(armchaos.ManagedServiceIdentityTypeUserAssigned), + UserAssignedIdentities: map[string]*armchaos.UserAssignedIdentity{ + "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI": {}, + }, + }, + Tags: map[string]*string{ + "key1": to.Ptr("value1"), + "key2": to.Ptr("value2"), + }, + }, 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.ExperimentExecutionDetails = armchaos.ExperimentExecutionDetails{ - // Name: to.Ptr("f24500ad-744e-4a26-864b-b76199eac333"), - // Type: to.Ptr("Microsoft.Chaos/experiments/executions/getExecutionDetails"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment/executions/f24500ad-744e-4a26-864b-b76199eac333/getExecutionDetails"), - // Properties: &armchaos.ExperimentExecutionDetailsProperties{ - // StartedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()), - // Status: to.Ptr("failed"), - // StoppedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:18.928Z"); return t}()), - // FailureReason: to.Ptr("Dependency failure"), - // LastActionAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:52:52.255Z"); return t}()), - // RunInformation: &armchaos.ExperimentExecutionDetailsPropertiesRunInformation{ - // Steps: []*armchaos.StepStatus{ + // res = armchaos.ExperimentsClientUpdateResponse{ + // Experiment: &armchaos.Experiment{ + // Name: to.Ptr("exampleExperiment"), + // Type: to.Ptr("Microsoft.Chaos/experiments"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Chaos/experiments/exampleExperiment"), + // Identity: &armchaos.ManagedServiceIdentity{ + // Type: to.Ptr(armchaos.ManagedServiceIdentityTypeUserAssigned), + // PrincipalID: to.Ptr("d04ab567-2c07-43ef-a7f4-4527626b7f56"), + // TenantID: to.Ptr("8c3e2fb2-fe7a-4bf1-b779-d73990782fe6"), + // UserAssignedIdentities: map[string]*armchaos.UserAssignedIdentity{ + // "/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.ManagedIdentity/userAssignedIdentity/exampleUMI": &armchaos.UserAssignedIdentity{ + // }, + // }, + // }, + // Location: to.Ptr("centraluseuap"), + // Properties: &armchaos.ExperimentProperties{ + // Selectors: []armchaos.TargetSelectorClassification{ + // &armchaos.TargetListSelector{ + // Type: to.Ptr(armchaos.SelectorTypeList), + // ID: to.Ptr("selector1"), + // Targets: []*armchaos.TargetReference{ + // { + // Type: to.Ptr(armchaos.TargetReferenceTypeChaosTarget), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), + // }, + // }, + // }, + // }, + // Steps: []*armchaos.ExperimentStep{ // { - // Branches: []*armchaos.BranchStatus{ + // Name: to.Ptr("step1"), + // Branches: []*armchaos.ExperimentBranch{ // { - // Actions: []*armchaos.ActionStatus{ - // { - // ActionID: to.Ptr("59499d33-6751-4b6e-a1f6-58f4d56a040a"), - // ActionName: to.Ptr("urn:provider:agent-v2:Microsoft.Azure.Chaos.Fault.CPUPressureAllProcessors"), - // EndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:13.627Z"); return t}()), - // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-12-14T21:56:13.627Z"); return t}()), - // Status: to.Ptr("failed"), - // Targets: []*armchaos.ExperimentExecutionActionTargetDetailsProperties{ + // Name: to.Ptr("branch1"), + // Actions: []armchaos.ExperimentActionClassification{ + // &armchaos.ContinuousAction{ + // Name: to.Ptr("urn:csci:provider:providername:Shutdown/1.0"), + // Type: to.Ptr(armchaos.ExperimentActionTypeContinuous), + // Duration: to.Ptr("PT10M"), + // Parameters: []*armchaos.KeyValuePair{ // { - // Status: to.Ptr("succeeded"), - // Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"), - // TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55.000Z"); return t}()), - // TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55.000Z"); return t}()), + // Key: to.Ptr("abruptShutdown"), + // Value: to.Ptr("false"), // }, - // { - // Status: to.Ptr("failed"), - // Target: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/VM1"), - // TargetCompletedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T17:30:55.000Z"); return t}()), - // TargetFailedTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-04-02T16:30:55.000Z"); return t}()), - // }}, - // }}, - // BranchID: to.Ptr("FirstBranch"), - // BranchName: to.Ptr("FirstBranch"), - // Status: to.Ptr("failed"), - // }}, - // Status: to.Ptr("failed"), - // StepID: to.Ptr("FirstStep"), - // StepName: to.Ptr("FirstStep"), - // }}, + // }, + // SelectorID: to.Ptr("selector1"), + // }, + // }, + // }, + // }, + // }, + // }, + // }, + // SystemData: &armchaos.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // CreatedBy: to.Ptr("User"), + // CreatedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // LastModifiedBy: to.Ptr("User"), + // LastModifiedByType: to.Ptr(armchaos.CreatedByType("b3a41dba-4415-4d36-9ee8-e5eaa86db976")), + // }, + // Tags: map[string]*string{ + // "key1": to.Ptr("value1"), + // "key2": to.Ptr("value2"), // }, // }, // } diff --git a/sdk/resourcemanager/chaos/armchaos/experiments_live_test.go b/sdk/resourcemanager/chaos/armchaos/experiments_live_test.go index 8d7d1dd2ff2c..365482e238c0 100644 --- a/sdk/resourcemanager/chaos/armchaos/experiments_live_test.go +++ b/sdk/resourcemanager/chaos/armchaos/experiments_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/stretchr/testify/suite" diff --git a/sdk/resourcemanager/chaos/armchaos/fake/capabilities_server.go b/sdk/resourcemanager/chaos/armchaos/fake/capabilities_server.go index 859cfec668df..c5cd74168a7e 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/capabilities_server.go +++ b/sdk/resourcemanager/chaos/armchaos/fake/capabilities_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 @@ -16,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/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "net/http" "net/url" "regexp" @@ -25,8 +21,8 @@ import ( // CapabilitiesServer is a fake server for instances of the armchaos.CapabilitiesClient type. type CapabilitiesServer struct { // CreateOrUpdate is the fake for method CapabilitiesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, capability armchaos.Capability, options *armchaos.CapabilitiesClientCreateOrUpdateOptions) (resp azfake.Responder[armchaos.CapabilitiesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, capabilityName string, resource armchaos.Capability, options *armchaos.CapabilitiesClientCreateOrUpdateOptions) (resp azfake.Responder[armchaos.CapabilitiesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // Delete is the fake for method CapabilitiesClient.Delete // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent @@ -66,27 +62,46 @@ func (c *CapabilitiesServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "CapabilitiesClient.CreateOrUpdate": - resp, err = c.dispatchCreateOrUpdate(req) - case "CapabilitiesClient.Delete": - resp, err = c.dispatchDelete(req) - case "CapabilitiesClient.Get": - resp, err = c.dispatchGet(req) - case "CapabilitiesClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *CapabilitiesServerTransport) 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 capabilitiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = capabilitiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CapabilitiesClient.CreateOrUpdate": + res.resp, res.err = c.dispatchCreateOrUpdate(req) + case "CapabilitiesClient.Delete": + res.resp, res.err = c.dispatchDelete(req) + case "CapabilitiesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CapabilitiesClient.NewListPager": + res.resp, res.err = c.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 (c *CapabilitiesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -96,7 +111,7 @@ func (c *CapabilitiesServerTransport) dispatchCreateOrUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/targets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 7 { + if len(matches) < 8 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armchaos.Capability](req) @@ -132,8 +147,8 @@ func (c *CapabilitiesServerTransport) dispatchCreateOrUpdate(req *http.Request) 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)} + 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).Capability, req) if err != nil { @@ -149,7 +164,7 @@ func (c *CapabilitiesServerTransport) dispatchDelete(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/targets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 7 { + if len(matches) < 8 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -198,7 +213,7 @@ func (c *CapabilitiesServerTransport) dispatchGet(req *http.Request) (*http.Resp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/targets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 7 { + if len(matches) < 8 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -249,7 +264,7 @@ func (c *CapabilitiesServerTransport) dispatchNewListPager(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/targets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilities` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { + if len(matches) < 7 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -269,15 +284,15 @@ func (c *CapabilitiesServerTransport) dispatchNewListPager(req *http.Request) (* if err != nil { return nil, err } - targetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("targetName")]) + continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) if err != nil { return nil, err } - continuationTokenUnescaped, err := url.QueryUnescape(qp.Get("continuationToken")) + continuationTokenParam := getOptional(continuationTokenUnescaped) + targetNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("targetName")]) if err != nil { return nil, err } - continuationTokenParam := getOptional(continuationTokenUnescaped) var options *armchaos.CapabilitiesClientListOptions if continuationTokenParam != nil { options = &armchaos.CapabilitiesClientListOptions{ @@ -304,3 +319,9 @@ func (c *CapabilitiesServerTransport) dispatchNewListPager(req *http.Request) (* } return resp, nil } + +// set this to conditionally intercept incoming requests to CapabilitiesServerTransport +var capabilitiesServerTransportInterceptor 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/chaos/armchaos/fake/capabilitytypes_server.go b/sdk/resourcemanager/chaos/armchaos/fake/capabilitytypes_server.go index 4ab582c9e43f..d24ad1c52183 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/capabilitytypes_server.go +++ b/sdk/resourcemanager/chaos/armchaos/fake/capabilitytypes_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 @@ -16,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/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "net/http" "net/url" "regexp" @@ -26,11 +22,11 @@ import ( type CapabilityTypesServer struct { // Get is the fake for method CapabilityTypesClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, locationName string, targetTypeName string, capabilityTypeName string, options *armchaos.CapabilityTypesClientGetOptions) (resp azfake.Responder[armchaos.CapabilityTypesClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, location string, targetTypeName string, capabilityTypeName string, options *armchaos.CapabilityTypesClientGetOptions) (resp azfake.Responder[armchaos.CapabilityTypesClientGetResponse], errResp azfake.ErrorResponder) // NewListPager is the fake for method CapabilityTypesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(locationName string, targetTypeName string, options *armchaos.CapabilityTypesClientListOptions) (resp azfake.PagerResponder[armchaos.CapabilityTypesClientListResponse]) + NewListPager func(location string, targetTypeName string, options *armchaos.CapabilityTypesClientListOptions) (resp azfake.PagerResponder[armchaos.CapabilityTypesClientListResponse]) } // NewCapabilityTypesServerTransport creates a new instance of CapabilityTypesServerTransport with the provided implementation. @@ -58,36 +54,55 @@ func (c *CapabilityTypesServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "CapabilityTypesClient.Get": - resp, err = c.dispatchGet(req) - case "CapabilityTypesClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *CapabilityTypesServerTransport) 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 capabilityTypesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = capabilityTypesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CapabilityTypesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CapabilityTypesClient.NewListPager": + res.resp, res.err = c.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 (c *CapabilityTypesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if c.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } @@ -99,7 +114,7 @@ func (c *CapabilityTypesServerTransport) dispatchGet(req *http.Request) (*http.R if err != nil { return nil, err } - respr, errRespr := c.srv.Get(req.Context(), locationNameParam, targetTypeNameParam, capabilityTypeNameParam, nil) + respr, errRespr := c.srv.Get(req.Context(), locationParam, targetTypeNameParam, capabilityTypeNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -120,14 +135,14 @@ func (c *CapabilityTypesServerTransport) dispatchNewListPager(req *http.Request) } newListPager := c.newListPager.get(req) if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityTypes` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/capabilityTypes` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } @@ -146,7 +161,7 @@ func (c *CapabilityTypesServerTransport) dispatchNewListPager(req *http.Request) ContinuationToken: continuationTokenParam, } } - resp := c.srv.NewListPager(locationNameParam, targetTypeNameParam, options) + resp := c.srv.NewListPager(locationParam, targetTypeNameParam, options) newListPager = &resp c.newListPager.add(req, newListPager) server.PagerResponderInjectNextLinks(newListPager, req, func(page *armchaos.CapabilityTypesClientListResponse, createLink func() string) { @@ -166,3 +181,9 @@ func (c *CapabilityTypesServerTransport) dispatchNewListPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to CapabilityTypesServerTransport +var capabilityTypesServerTransportInterceptor 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/chaos/armchaos/fake/experimentexecutions_server.go b/sdk/resourcemanager/chaos/armchaos/fake/experimentexecutions_server.go new file mode 100644 index 000000000000..0df0f645cd77 --- /dev/null +++ b/sdk/resourcemanager/chaos/armchaos/fake/experimentexecutions_server.go @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the 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/chaos/armchaos/v2" + "net/http" + "net/url" + "regexp" +) + +// ExperimentExecutionsServer is a fake server for instances of the armchaos.ExperimentExecutionsClient type. +type ExperimentExecutionsServer struct { + // GetExecution is the fake for method ExperimentExecutionsClient.GetExecution + // HTTP status codes to indicate success: http.StatusOK + GetExecution func(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *armchaos.ExperimentExecutionsClientGetExecutionOptions) (resp azfake.Responder[armchaos.ExperimentExecutionsClientGetExecutionResponse], errResp azfake.ErrorResponder) + + // GetExecutionDetails is the fake for method ExperimentExecutionsClient.GetExecutionDetails + // HTTP status codes to indicate success: http.StatusOK + GetExecutionDetails func(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *armchaos.ExperimentExecutionsClientGetExecutionDetailsOptions) (resp azfake.Responder[armchaos.ExperimentExecutionsClientGetExecutionDetailsResponse], errResp azfake.ErrorResponder) + + // NewListAllExecutionsPager is the fake for method ExperimentExecutionsClient.NewListAllExecutionsPager + // HTTP status codes to indicate success: http.StatusOK + NewListAllExecutionsPager func(resourceGroupName string, experimentName string, options *armchaos.ExperimentExecutionsClientListAllExecutionsOptions) (resp azfake.PagerResponder[armchaos.ExperimentExecutionsClientListAllExecutionsResponse]) +} + +// NewExperimentExecutionsServerTransport creates a new instance of ExperimentExecutionsServerTransport with the provided implementation. +// The returned ExperimentExecutionsServerTransport instance is connected to an instance of armchaos.ExperimentExecutionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewExperimentExecutionsServerTransport(srv *ExperimentExecutionsServer) *ExperimentExecutionsServerTransport { + return &ExperimentExecutionsServerTransport{ + srv: srv, + newListAllExecutionsPager: newTracker[azfake.PagerResponder[armchaos.ExperimentExecutionsClientListAllExecutionsResponse]](), + } +} + +// ExperimentExecutionsServerTransport connects instances of armchaos.ExperimentExecutionsClient to instances of ExperimentExecutionsServer. +// Don't use this type directly, use NewExperimentExecutionsServerTransport instead. +type ExperimentExecutionsServerTransport struct { + srv *ExperimentExecutionsServer + newListAllExecutionsPager *tracker[azfake.PagerResponder[armchaos.ExperimentExecutionsClientListAllExecutionsResponse]] +} + +// Do implements the policy.Transporter interface for ExperimentExecutionsServerTransport. +func (e *ExperimentExecutionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *ExperimentExecutionsServerTransport) 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 experimentExecutionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = experimentExecutionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ExperimentExecutionsClient.GetExecution": + res.resp, res.err = e.dispatchGetExecution(req) + case "ExperimentExecutionsClient.GetExecutionDetails": + res.resp, res.err = e.dispatchGetExecutionDetails(req) + case "ExperimentExecutionsClient.NewListAllExecutionsPager": + res.resp, res.err = e.dispatchNewListAllExecutionsPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (e *ExperimentExecutionsServerTransport) dispatchGetExecution(req *http.Request) (*http.Response, error) { + if e.srv.GetExecution == nil { + return nil, &nonRetriableError{errors.New("fake for method GetExecution not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/executions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + experimentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("experimentName")]) + if err != nil { + return nil, err + } + executionIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("executionId")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.GetExecution(req.Context(), resourceGroupNameParam, experimentNameParam, executionIDParam, 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).ExperimentExecution, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *ExperimentExecutionsServerTransport) dispatchGetExecutionDetails(req *http.Request) (*http.Response, error) { + if e.srv.GetExecutionDetails == nil { + return nil, &nonRetriableError{errors.New("fake for method GetExecutionDetails not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/executions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getExecutionDetails` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + experimentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("experimentName")]) + if err != nil { + return nil, err + } + executionIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("executionId")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.GetExecutionDetails(req.Context(), resourceGroupNameParam, experimentNameParam, executionIDParam, 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).ExperimentExecutionDetails, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *ExperimentExecutionsServerTransport) dispatchNewListAllExecutionsPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListAllExecutionsPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListAllExecutionsPager not implemented")} + } + newListAllExecutionsPager := e.newListAllExecutionsPager.get(req) + if newListAllExecutionsPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/executions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + experimentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("experimentName")]) + if err != nil { + return nil, err + } + resp := e.srv.NewListAllExecutionsPager(resourceGroupNameParam, experimentNameParam, nil) + newListAllExecutionsPager = &resp + e.newListAllExecutionsPager.add(req, newListAllExecutionsPager) + server.PagerResponderInjectNextLinks(newListAllExecutionsPager, req, func(page *armchaos.ExperimentExecutionsClientListAllExecutionsResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListAllExecutionsPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListAllExecutionsPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListAllExecutionsPager) { + e.newListAllExecutionsPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ExperimentExecutionsServerTransport +var experimentExecutionsServerTransportInterceptor 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/chaos/armchaos/fake/experiments_server.go b/sdk/resourcemanager/chaos/armchaos/fake/experiments_server.go index 110967111c7d..b6511c3cca3f 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/experiments_server.go +++ b/sdk/resourcemanager/chaos/armchaos/fake/experiments_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 @@ -16,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/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "net/http" "net/url" "regexp" @@ -26,29 +22,21 @@ import ( // ExperimentsServer is a fake server for instances of the armchaos.ExperimentsClient type. type ExperimentsServer struct { // BeginCancel is the fake for method ExperimentsClient.BeginCancel - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginCancel func(ctx context.Context, resourceGroupName string, experimentName string, options *armchaos.ExperimentsClientBeginCancelOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientCancelResponse], errResp azfake.ErrorResponder) // BeginCreateOrUpdate is the fake for method ExperimentsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, experimentName string, experiment armchaos.Experiment, options *armchaos.ExperimentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, experimentName string, resource armchaos.Experiment, options *armchaos.ExperimentsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method ExperimentsClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, experimentName string, options *armchaos.ExperimentsClientBeginDeleteOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientDeleteResponse], errResp azfake.ErrorResponder) - // ExecutionDetails is the fake for method ExperimentsClient.ExecutionDetails - // HTTP status codes to indicate success: http.StatusOK - ExecutionDetails func(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *armchaos.ExperimentsClientExecutionDetailsOptions) (resp azfake.Responder[armchaos.ExperimentsClientExecutionDetailsResponse], errResp azfake.ErrorResponder) - // Get is the fake for method ExperimentsClient.Get // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, experimentName string, options *armchaos.ExperimentsClientGetOptions) (resp azfake.Responder[armchaos.ExperimentsClientGetResponse], errResp azfake.ErrorResponder) - // GetExecution is the fake for method ExperimentsClient.GetExecution - // HTTP status codes to indicate success: http.StatusOK - GetExecution func(ctx context.Context, resourceGroupName string, experimentName string, executionID string, options *armchaos.ExperimentsClientGetExecutionOptions) (resp azfake.Responder[armchaos.ExperimentsClientGetExecutionResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method ExperimentsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, options *armchaos.ExperimentsClientListOptions) (resp azfake.PagerResponder[armchaos.ExperimentsClientListResponse]) @@ -57,17 +45,13 @@ type ExperimentsServer struct { // HTTP status codes to indicate success: http.StatusOK NewListAllPager func(options *armchaos.ExperimentsClientListAllOptions) (resp azfake.PagerResponder[armchaos.ExperimentsClientListAllResponse]) - // NewListAllExecutionsPager is the fake for method ExperimentsClient.NewListAllExecutionsPager - // HTTP status codes to indicate success: http.StatusOK - NewListAllExecutionsPager func(resourceGroupName string, experimentName string, options *armchaos.ExperimentsClientListAllExecutionsOptions) (resp azfake.PagerResponder[armchaos.ExperimentsClientListAllExecutionsResponse]) - // BeginStart is the fake for method ExperimentsClient.BeginStart - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginStart func(ctx context.Context, resourceGroupName string, experimentName string, options *armchaos.ExperimentsClientBeginStartOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientStartResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method ExperimentsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, experimentName string, experiment armchaos.ExperimentUpdate, options *armchaos.ExperimentsClientBeginUpdateOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientUpdateResponse], errResp azfake.ErrorResponder) + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, experimentName string, properties armchaos.ExperimentUpdate, options *armchaos.ExperimentsClientBeginUpdateOptions) (resp azfake.PollerResponder[armchaos.ExperimentsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewExperimentsServerTransport creates a new instance of ExperimentsServerTransport with the provided implementation. @@ -75,30 +59,28 @@ type ExperimentsServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewExperimentsServerTransport(srv *ExperimentsServer) *ExperimentsServerTransport { return &ExperimentsServerTransport{ - srv: srv, - beginCancel: newTracker[azfake.PollerResponder[armchaos.ExperimentsClientCancelResponse]](), - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armchaos.ExperimentsClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armchaos.ExperimentsClientDeleteResponse]](), - newListPager: newTracker[azfake.PagerResponder[armchaos.ExperimentsClientListResponse]](), - newListAllPager: newTracker[azfake.PagerResponder[armchaos.ExperimentsClientListAllResponse]](), - newListAllExecutionsPager: newTracker[azfake.PagerResponder[armchaos.ExperimentsClientListAllExecutionsResponse]](), - beginStart: newTracker[azfake.PollerResponder[armchaos.ExperimentsClientStartResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armchaos.ExperimentsClientUpdateResponse]](), + srv: srv, + beginCancel: newTracker[azfake.PollerResponder[armchaos.ExperimentsClientCancelResponse]](), + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armchaos.ExperimentsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armchaos.ExperimentsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armchaos.ExperimentsClientListResponse]](), + newListAllPager: newTracker[azfake.PagerResponder[armchaos.ExperimentsClientListAllResponse]](), + beginStart: newTracker[azfake.PollerResponder[armchaos.ExperimentsClientStartResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armchaos.ExperimentsClientUpdateResponse]](), } } // ExperimentsServerTransport connects instances of armchaos.ExperimentsClient to instances of ExperimentsServer. // Don't use this type directly, use NewExperimentsServerTransport instead. type ExperimentsServerTransport struct { - srv *ExperimentsServer - beginCancel *tracker[azfake.PollerResponder[armchaos.ExperimentsClientCancelResponse]] - beginCreateOrUpdate *tracker[azfake.PollerResponder[armchaos.ExperimentsClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[armchaos.ExperimentsClientDeleteResponse]] - newListPager *tracker[azfake.PagerResponder[armchaos.ExperimentsClientListResponse]] - newListAllPager *tracker[azfake.PagerResponder[armchaos.ExperimentsClientListAllResponse]] - newListAllExecutionsPager *tracker[azfake.PagerResponder[armchaos.ExperimentsClientListAllExecutionsResponse]] - beginStart *tracker[azfake.PollerResponder[armchaos.ExperimentsClientStartResponse]] - beginUpdate *tracker[azfake.PollerResponder[armchaos.ExperimentsClientUpdateResponse]] + srv *ExperimentsServer + beginCancel *tracker[azfake.PollerResponder[armchaos.ExperimentsClientCancelResponse]] + beginCreateOrUpdate *tracker[azfake.PollerResponder[armchaos.ExperimentsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armchaos.ExperimentsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armchaos.ExperimentsClientListResponse]] + newListAllPager *tracker[azfake.PagerResponder[armchaos.ExperimentsClientListAllResponse]] + beginStart *tracker[azfake.PollerResponder[armchaos.ExperimentsClientStartResponse]] + beginUpdate *tracker[azfake.PollerResponder[armchaos.ExperimentsClientUpdateResponse]] } // Do implements the policy.Transporter interface for ExperimentsServerTransport. @@ -109,41 +91,54 @@ func (e *ExperimentsServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "ExperimentsClient.BeginCancel": - resp, err = e.dispatchBeginCancel(req) - case "ExperimentsClient.BeginCreateOrUpdate": - resp, err = e.dispatchBeginCreateOrUpdate(req) - case "ExperimentsClient.BeginDelete": - resp, err = e.dispatchBeginDelete(req) - case "ExperimentsClient.ExecutionDetails": - resp, err = e.dispatchExecutionDetails(req) - case "ExperimentsClient.Get": - resp, err = e.dispatchGet(req) - case "ExperimentsClient.GetExecution": - resp, err = e.dispatchGetExecution(req) - case "ExperimentsClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - case "ExperimentsClient.NewListAllPager": - resp, err = e.dispatchNewListAllPager(req) - case "ExperimentsClient.NewListAllExecutionsPager": - resp, err = e.dispatchNewListAllExecutionsPager(req) - case "ExperimentsClient.BeginStart": - resp, err = e.dispatchBeginStart(req) - case "ExperimentsClient.BeginUpdate": - resp, err = e.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return e.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (e *ExperimentsServerTransport) 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 experimentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = experimentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ExperimentsClient.BeginCancel": + res.resp, res.err = e.dispatchBeginCancel(req) + case "ExperimentsClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "ExperimentsClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "ExperimentsClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "ExperimentsClient.NewListPager": + res.resp, res.err = e.dispatchNewListPager(req) + case "ExperimentsClient.NewListAllPager": + res.resp, res.err = e.dispatchNewListAllPager(req) + case "ExperimentsClient.BeginStart": + res.resp, res.err = e.dispatchBeginStart(req) + case "ExperimentsClient.BeginUpdate": + res.resp, res.err = e.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 (e *ExperimentsServerTransport) dispatchBeginCancel(req *http.Request) (*http.Response, error) { @@ -155,7 +150,7 @@ func (e *ExperimentsServerTransport) dispatchBeginCancel(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cancel` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -179,9 +174,9 @@ func (e *ExperimentsServerTransport) dispatchBeginCancel(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { e.beginCancel.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(beginCancel) { e.beginCancel.remove(req) @@ -199,7 +194,7 @@ func (e *ExperimentsServerTransport) dispatchBeginCreateOrUpdate(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armchaos.Experiment](req) @@ -247,7 +242,7 @@ func (e *ExperimentsServerTransport) dispatchBeginDelete(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -271,9 +266,9 @@ func (e *ExperimentsServerTransport) dispatchBeginDelete(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { e.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.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(beginDelete) { e.beginDelete.remove(req) @@ -282,43 +277,6 @@ func (e *ExperimentsServerTransport) dispatchBeginDelete(req *http.Request) (*ht return resp, nil } -func (e *ExperimentsServerTransport) dispatchExecutionDetails(req *http.Request) (*http.Response, error) { - if e.srv.ExecutionDetails == nil { - return nil, &nonRetriableError{errors.New("fake for method ExecutionDetails not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/executions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getExecutionDetails` - 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 - } - experimentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("experimentName")]) - if err != nil { - return nil, err - } - executionIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("executionId")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.ExecutionDetails(req.Context(), resourceGroupNameParam, experimentNameParam, executionIDParam, 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).ExperimentExecutionDetails, req) - if err != nil { - return nil, err - } - return resp, nil -} - func (e *ExperimentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { if e.srv.Get == nil { return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} @@ -326,7 +284,7 @@ func (e *ExperimentsServerTransport) dispatchGet(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -352,43 +310,6 @@ func (e *ExperimentsServerTransport) dispatchGet(req *http.Request) (*http.Respo return resp, nil } -func (e *ExperimentsServerTransport) dispatchGetExecution(req *http.Request) (*http.Response, error) { - if e.srv.GetExecution == nil { - return nil, &nonRetriableError{errors.New("fake for method GetExecution not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/executions/(?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 - } - experimentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("experimentName")]) - if err != nil { - return nil, err - } - executionIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("executionId")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.GetExecution(req.Context(), resourceGroupNameParam, experimentNameParam, executionIDParam, 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).ExperimentExecution, req) - if err != nil { - return nil, err - } - return resp, nil -} - func (e *ExperimentsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if e.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} @@ -398,7 +319,7 @@ func (e *ExperimentsServerTransport) dispatchNewListPager(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -456,7 +377,7 @@ func (e *ExperimentsServerTransport) dispatchNewListAllPager(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -501,47 +422,6 @@ func (e *ExperimentsServerTransport) dispatchNewListAllPager(req *http.Request) return resp, nil } -func (e *ExperimentsServerTransport) dispatchNewListAllExecutionsPager(req *http.Request) (*http.Response, error) { - if e.srv.NewListAllExecutionsPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListAllExecutionsPager not implemented")} - } - newListAllExecutionsPager := e.newListAllExecutionsPager.get(req) - if newListAllExecutionsPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/executions` - 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 - } - experimentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("experimentName")]) - if err != nil { - return nil, err - } - resp := e.srv.NewListAllExecutionsPager(resourceGroupNameParam, experimentNameParam, nil) - newListAllExecutionsPager = &resp - e.newListAllExecutionsPager.add(req, newListAllExecutionsPager) - server.PagerResponderInjectNextLinks(newListAllExecutionsPager, req, func(page *armchaos.ExperimentsClientListAllExecutionsResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListAllExecutionsPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - e.newListAllExecutionsPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListAllExecutionsPager) { - e.newListAllExecutionsPager.remove(req) - } - return resp, nil -} - func (e *ExperimentsServerTransport) dispatchBeginStart(req *http.Request) (*http.Response, error) { if e.srv.BeginStart == nil { return nil, &nonRetriableError{errors.New("fake for method BeginStart not implemented")} @@ -551,7 +431,7 @@ func (e *ExperimentsServerTransport) dispatchBeginStart(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -575,9 +455,9 @@ func (e *ExperimentsServerTransport) dispatchBeginStart(req *http.Request) (*htt return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { e.beginStart.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(beginStart) { e.beginStart.remove(req) @@ -595,7 +475,7 @@ func (e *ExperimentsServerTransport) dispatchBeginUpdate(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/experiments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armchaos.ExperimentUpdate](req) @@ -623,9 +503,9 @@ func (e *ExperimentsServerTransport) dispatchBeginUpdate(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { e.beginUpdate.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", resp.StatusCode)} } if !server.PollerResponderMore(beginUpdate) { e.beginUpdate.remove(req) @@ -633,3 +513,9 @@ func (e *ExperimentsServerTransport) dispatchBeginUpdate(req *http.Request) (*ht return resp, nil } + +// set this to conditionally intercept incoming requests to ExperimentsServerTransport +var experimentsServerTransportInterceptor 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/chaos/armchaos/fake/internal.go b/sdk/resourcemanager/chaos/armchaos/fake/internal.go index 7d2f89ba4bb2..41e62ec29233 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/internal.go +++ b/sdk/resourcemanager/chaos/armchaos/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/chaos/armchaos/fake/operations_server.go b/sdk/resourcemanager/chaos/armchaos/fake/operations_server.go index fa65ac87d409..dc5306aa30d4 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/operations_server.go +++ b/sdk/resourcemanager/chaos/armchaos/fake/operations_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -15,15 +11,15 @@ 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/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "net/http" ) // OperationsServer is a fake server for instances of the armchaos.OperationsClient type. type OperationsServer struct { - // NewListAllPager is the fake for method OperationsClient.NewListAllPager + // NewListPager is the fake for method OperationsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListAllPager func(options *armchaos.OperationsClientListAllOptions) (resp azfake.PagerResponder[armchaos.OperationsClientListAllResponse]) + NewListPager func(options *armchaos.OperationsClientListOptions) (resp azfake.PagerResponder[armchaos.OperationsClientListResponse]) } // NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. @@ -31,16 +27,16 @@ type OperationsServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { return &OperationsServerTransport{ - srv: srv, - newListAllPager: newTracker[azfake.PagerResponder[armchaos.OperationsClientListAllResponse]](), + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armchaos.OperationsClientListResponse]](), } } // OperationsServerTransport connects instances of armchaos.OperationsClient to instances of OperationsServer. // Don't use this type directly, use NewOperationsServerTransport instead. type OperationsServerTransport struct { - srv *OperationsServer - newListAllPager *tracker[azfake.PagerResponder[armchaos.OperationsClientListAllResponse]] + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armchaos.OperationsClientListResponse]] } // Do implements the policy.Transporter interface for OperationsServerTransport. @@ -51,46 +47,71 @@ 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.NewListAllPager": - resp, err = o.dispatchNewListAllPager(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) dispatchNewListAllPager(req *http.Request) (*http.Response, error) { - if o.srv.NewListAllPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListAllPager not implemented")} +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")} } - newListAllPager := o.newListAllPager.get(req) - if newListAllPager == nil { - resp := o.srv.NewListAllPager(nil) - newListAllPager = &resp - o.newListAllPager.add(req, newListAllPager) - server.PagerResponderInjectNextLinks(newListAllPager, req, func(page *armchaos.OperationsClientListAllResponse, createLink func() string) { + 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 *armchaos.OperationsClientListResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } - resp, err := server.PagerResponderNext(newListAllPager, req) + resp, err := server.PagerResponderNext(newListPager, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - o.newListAllPager.remove(req) + o.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } - if !server.PagerResponderMore(newListAllPager) { - o.newListAllPager.remove(req) + 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/chaos/armchaos/fake/operationstatuses_server.go b/sdk/resourcemanager/chaos/armchaos/fake/operationstatuses_server.go index 86d938265b0b..a86cd5e199d1 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/operationstatuses_server.go +++ b/sdk/resourcemanager/chaos/armchaos/fake/operationstatuses_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -15,7 +11,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "net/http" "net/url" "regexp" @@ -25,7 +21,7 @@ import ( type OperationStatusesServer struct { // Get is the fake for method OperationStatusesClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, location string, asyncOperationID string, options *armchaos.OperationStatusesClientGetOptions) (resp azfake.Responder[armchaos.OperationStatusesClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, location string, operationID string, options *armchaos.OperationStatusesClientGetOptions) (resp azfake.Responder[armchaos.OperationStatusesClientGetResponse], errResp azfake.ErrorResponder) } // NewOperationStatusesServerTransport creates a new instance of OperationStatusesServerTransport with the provided implementation. @@ -49,42 +45,61 @@ func (o *OperationStatusesServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationStatusesClient.Get": - resp, err = o.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationStatusesServerTransport) 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 operationStatusesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationStatusesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationStatusesClient.Get": + res.resp, res.err = o.dispatchGet(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 *OperationStatusesServerTransport) 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~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationStatuses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationStatuses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } - asyncOperationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("asyncOperationId")]) + operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) if err != nil { return nil, err } - respr, errRespr := o.srv.Get(req.Context(), locationParam, asyncOperationIDParam, nil) + respr, errRespr := o.srv.Get(req.Context(), locationParam, operationIDParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -92,9 +107,15 @@ func (o *OperationStatusesServerTransport) dispatchGet(req *http.Request) (*http 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) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatusResult, req) if err != nil { return nil, err } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationStatusesServerTransport +var operationStatusesServerTransportInterceptor 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/chaos/armchaos/fake/server_factory.go b/sdk/resourcemanager/chaos/armchaos/fake/server_factory.go index b2c30adf1bb3..daa29f62552f 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/server_factory.go +++ b/sdk/resourcemanager/chaos/armchaos/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,13 +15,29 @@ import ( // ServerFactory is a fake server for instances of the armchaos.ClientFactory type. type ServerFactory struct { - CapabilitiesServer CapabilitiesServer - CapabilityTypesServer CapabilityTypesServer - ExperimentsServer ExperimentsServer + // CapabilitiesServer contains the fakes for client CapabilitiesClient + CapabilitiesServer CapabilitiesServer + + // CapabilityTypesServer contains the fakes for client CapabilityTypesClient + CapabilityTypesServer CapabilityTypesServer + + // ExperimentExecutionsServer contains the fakes for client ExperimentExecutionsClient + ExperimentExecutionsServer ExperimentExecutionsServer + + // ExperimentsServer contains the fakes for client ExperimentsClient + ExperimentsServer ExperimentsServer + + // OperationStatusesServer contains the fakes for client OperationStatusesClient OperationStatusesServer OperationStatusesServer - OperationsServer OperationsServer - TargetTypesServer TargetTypesServer - TargetsServer TargetsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // TargetTypesServer contains the fakes for client TargetTypesClient + TargetTypesServer TargetTypesServer + + // TargetsServer contains the fakes for client TargetsClient + TargetsServer TargetsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -40,15 +52,16 @@ func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { // ServerFactoryTransport connects instances of armchaos.ClientFactory to instances of ServerFactory. // Don't use this type directly, use NewServerFactoryTransport instead. type ServerFactoryTransport struct { - srv *ServerFactory - trMu sync.Mutex - trCapabilitiesServer *CapabilitiesServerTransport - trCapabilityTypesServer *CapabilityTypesServerTransport - trExperimentsServer *ExperimentsServerTransport - trOperationStatusesServer *OperationStatusesServerTransport - trOperationsServer *OperationsServerTransport - trTargetTypesServer *TargetTypesServerTransport - trTargetsServer *TargetsServerTransport + srv *ServerFactory + trMu sync.Mutex + trCapabilitiesServer *CapabilitiesServerTransport + trCapabilityTypesServer *CapabilityTypesServerTransport + trExperimentExecutionsServer *ExperimentExecutionsServerTransport + trExperimentsServer *ExperimentsServerTransport + trOperationStatusesServer *OperationStatusesServerTransport + trOperationsServer *OperationsServerTransport + trTargetTypesServer *TargetTypesServerTransport + trTargetsServer *TargetsServerTransport } // Do implements the policy.Transporter interface for ServerFactoryTransport. @@ -72,6 +85,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewCapabilityTypesServerTransport(&s.srv.CapabilityTypesServer) }) resp, err = s.trCapabilityTypesServer.Do(req) + case "ExperimentExecutionsClient": + initServer(s, &s.trExperimentExecutionsServer, func() *ExperimentExecutionsServerTransport { + return NewExperimentExecutionsServerTransport(&s.srv.ExperimentExecutionsServer) + }) + resp, err = s.trExperimentExecutionsServer.Do(req) case "ExperimentsClient": initServer(s, &s.trExperimentsServer, func() *ExperimentsServerTransport { return NewExperimentsServerTransport(&s.srv.ExperimentsServer) }) resp, err = s.trExperimentsServer.Do(req) diff --git a/sdk/resourcemanager/chaos/armchaos/fake/targets_server.go b/sdk/resourcemanager/chaos/armchaos/fake/targets_server.go index d2045d013f23..83fc5bdae2a9 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/targets_server.go +++ b/sdk/resourcemanager/chaos/armchaos/fake/targets_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 @@ -16,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/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "net/http" "net/url" "regexp" @@ -25,8 +21,8 @@ import ( // TargetsServer is a fake server for instances of the armchaos.TargetsClient type. type TargetsServer struct { // CreateOrUpdate is the fake for method TargetsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, target armchaos.Target, options *armchaos.TargetsClientCreateOrUpdateOptions) (resp azfake.Responder[armchaos.TargetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, resource armchaos.Target, options *armchaos.TargetsClientCreateOrUpdateOptions) (resp azfake.Responder[armchaos.TargetsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // Delete is the fake for method TargetsClient.Delete // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent @@ -66,27 +62,46 @@ func (t *TargetsServerTransport) 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 t.dispatchToMethodFake(req, method) +} - switch method { - case "TargetsClient.CreateOrUpdate": - resp, err = t.dispatchCreateOrUpdate(req) - case "TargetsClient.Delete": - resp, err = t.dispatchDelete(req) - case "TargetsClient.Get": - resp, err = t.dispatchGet(req) - case "TargetsClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (t *TargetsServerTransport) 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 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.NewListPager": + res.resp, res.err = t.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 (t *TargetsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -96,7 +111,7 @@ func (t *TargetsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/targets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { + if len(matches) < 7 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armchaos.Target](req) @@ -128,8 +143,8 @@ func (t *TargetsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*htt 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)} + 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 { @@ -145,7 +160,7 @@ func (t *TargetsServerTransport) dispatchDelete(req *http.Request) (*http.Respon const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/targets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { + if len(matches) < 7 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -190,7 +205,7 @@ func (t *TargetsServerTransport) dispatchGet(req *http.Request) (*http.Response, const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/targets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { + if len(matches) < 7 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -237,7 +252,7 @@ func (t *TargetsServerTransport) dispatchNewListPager(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/targets` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -288,3 +303,9 @@ func (t *TargetsServerTransport) dispatchNewListPager(req *http.Request) (*http. } 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/chaos/armchaos/fake/targettypes_server.go b/sdk/resourcemanager/chaos/armchaos/fake/targettypes_server.go index d3a7428a0477..6d0660a2847f 100644 --- a/sdk/resourcemanager/chaos/armchaos/fake/targettypes_server.go +++ b/sdk/resourcemanager/chaos/armchaos/fake/targettypes_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 @@ -16,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/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "net/http" "net/url" "regexp" @@ -26,11 +22,11 @@ import ( type TargetTypesServer struct { // Get is the fake for method TargetTypesClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, locationName string, targetTypeName string, options *armchaos.TargetTypesClientGetOptions) (resp azfake.Responder[armchaos.TargetTypesClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, location string, targetTypeName string, options *armchaos.TargetTypesClientGetOptions) (resp azfake.Responder[armchaos.TargetTypesClientGetResponse], errResp azfake.ErrorResponder) // NewListPager is the fake for method TargetTypesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - NewListPager func(locationName string, options *armchaos.TargetTypesClientListOptions) (resp azfake.PagerResponder[armchaos.TargetTypesClientListResponse]) + NewListPager func(location string, options *armchaos.TargetTypesClientListOptions) (resp azfake.PagerResponder[armchaos.TargetTypesClientListResponse]) } // NewTargetTypesServerTransport creates a new instance of TargetTypesServerTransport with the provided implementation. @@ -58,36 +54,55 @@ func (t *TargetTypesServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return t.dispatchToMethodFake(req, method) +} - switch method { - case "TargetTypesClient.Get": - resp, err = t.dispatchGet(req) - case "TargetTypesClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (t *TargetTypesServerTransport) 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 targetTypesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = targetTypesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "TargetTypesClient.Get": + res.resp, res.err = t.dispatchGet(req) + case "TargetTypesClient.NewListPager": + res.resp, res.err = t.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 (t *TargetTypesServerTransport) 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~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } @@ -95,7 +110,7 @@ func (t *TargetTypesServerTransport) dispatchGet(req *http.Request) (*http.Respo if err != nil { return nil, err } - respr, errRespr := t.srv.Get(req.Context(), locationNameParam, targetTypeNameParam, nil) + respr, errRespr := t.srv.Get(req.Context(), locationParam, targetTypeNameParam, nil) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } @@ -116,14 +131,14 @@ func (t *TargetTypesServerTransport) dispatchNewListPager(req *http.Request) (*h } newListPager := t.newListPager.get(req) if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes` + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Chaos/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/targetTypes` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } @@ -138,7 +153,7 @@ func (t *TargetTypesServerTransport) dispatchNewListPager(req *http.Request) (*h ContinuationToken: continuationTokenParam, } } - resp := t.srv.NewListPager(locationNameParam, options) + resp := t.srv.NewListPager(locationParam, options) newListPager = &resp t.newListPager.add(req, newListPager) server.PagerResponderInjectNextLinks(newListPager, req, func(page *armchaos.TargetTypesClientListResponse, createLink func() string) { @@ -158,3 +173,9 @@ func (t *TargetTypesServerTransport) dispatchNewListPager(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to TargetTypesServerTransport +var targetTypesServerTransportInterceptor 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/chaos/armchaos/fake/time_rfc3339.go b/sdk/resourcemanager/chaos/armchaos/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/chaos/armchaos/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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 ( - "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 { - 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/chaos/armchaos/go.mod b/sdk/resourcemanager/chaos/armchaos/go.mod index 33ee3f5921ed..dbb606233e31 100644 --- a/sdk/resourcemanager/chaos/armchaos/go.mod +++ b/sdk/resourcemanager/chaos/armchaos/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2 go 1.23.0 diff --git a/sdk/resourcemanager/chaos/armchaos/interfaces.go b/sdk/resourcemanager/chaos/armchaos/interfaces.go index e75b88834683..c509305b4a7e 100644 --- a/sdk/resourcemanager/chaos/armchaos/interfaces.go +++ b/sdk/resourcemanager/chaos/armchaos/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 armchaos diff --git a/sdk/resourcemanager/chaos/armchaos/models.go b/sdk/resourcemanager/chaos/armchaos/models.go index 20da634461d9..60f103d92cca 100644 --- a/sdk/resourcemanager/chaos/armchaos/models.go +++ b/sdk/resourcemanager/chaos/armchaos/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 armchaos @@ -48,16 +44,16 @@ type BranchStatus struct { // Capability - Model that represents a Capability resource. type Capability struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string + // The properties of a capability resource. + Properties *CapabilityProperties - // READ-ONLY; The name of the resource + // READ-ONLY; String that represents a Capability resource name. Name *string - // READ-ONLY; The properties of a capability resource. - Properties *CapabilityProperties + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; The standard system metadata of a resource type. + // 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" @@ -66,11 +62,11 @@ type Capability struct { // CapabilityListResult - Model that represents a list of Capability resources and a link for pagination. type CapabilityListResult struct { - // READ-ONLY; URL to retrieve the next page of Capability resources. - NextLink *string - - // READ-ONLY; List of Capability resources. + // REQUIRED; The Capability items on this page Value []*Capability + + // The link to the next page of items + NextLink *string } // CapabilityProperties - Model that represents the Capability properties model. @@ -93,19 +89,16 @@ type CapabilityProperties struct { // CapabilityType - Model that represents a Capability Type resource. type CapabilityType struct { - // Location of the Capability Type resource. - Location *string - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string + // The properties of the capability type resource. + Properties *CapabilityTypeProperties - // READ-ONLY; The name of the resource + // READ-ONLY; String that represents a Capability Type resource name. Name *string - // READ-ONLY; The properties of the capability type resource. - Properties *CapabilityTypeProperties + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; The system metadata properties of the capability type resource. + // 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" @@ -114,24 +107,21 @@ type CapabilityType struct { // CapabilityTypeListResult - Model that represents a list of Capability Type resources and a link for pagination. type CapabilityTypeListResult struct { - // READ-ONLY; URL to retrieve the next page of Capability Type resources. - NextLink *string - - // READ-ONLY; List of Capability Type resources. + // REQUIRED; The CapabilityType items on this page Value []*CapabilityType + + // The link to the next page of items + NextLink *string } // CapabilityTypeProperties - Model that represents the Capability Type properties model. type CapabilityTypeProperties struct { - // Control plane actions necessary to execute capability type. + // READ-ONLY; Control plane actions necessary to execute capability type. AzureRbacActions []*string - // Data plane actions necessary to execute capability type. + // READ-ONLY; Data plane actions necessary to execute capability type. AzureRbacDataActions []*string - // Runtime properties of this Capability Type. - RuntimeProperties *CapabilityTypePropertiesRuntimeProperties - // READ-ONLY; Localized string of the description. Description *string @@ -147,6 +137,12 @@ type CapabilityTypeProperties struct { // READ-ONLY; String of the Publisher that this Capability Type extends. Publisher *string + // READ-ONLY; Required Azure Role Definition Ids to execute capability type. + RequiredAzureRoleDefinitionIDs []*string + + // READ-ONLY; Runtime properties of this Capability Type. + RuntimeProperties *CapabilityTypePropertiesRuntimeProperties + // READ-ONLY; String of the Target Type that this Capability Type extends. TargetType *string @@ -174,8 +170,9 @@ type ContinuousAction struct { // REQUIRED; String that represents a selector. SelectorID *string - // REQUIRED; Enum that discriminates between action models. - Type *string + // CONSTANT; Enum that discriminates between action models. + // Field has constant value ExperimentActionTypeContinuous, any specified value is ignored. + Type *ExperimentActionType } // GetExperimentAction implements the ExperimentActionClassification interface for type ContinuousAction. @@ -194,8 +191,9 @@ type DelayAction struct { // REQUIRED; String that represents a Capability URN. Name *string - // REQUIRED; Enum that discriminates between action models. - Type *string + // CONSTANT; Enum that discriminates between action models. + // Field has constant value ExperimentActionTypeDelay, any specified value is ignored. + Type *ExperimentActionType } // GetExperimentAction implements the ExperimentActionClassification interface for type DelayAction. @@ -217,8 +215,9 @@ type DiscreteAction struct { // REQUIRED; String that represents a selector. SelectorID *string - // REQUIRED; Enum that discriminates between action models. - Type *string + // CONSTANT; Enum that discriminates between action models. + // Field has constant value ExperimentActionTypeDiscrete, any specified value is ignored. + Type *ExperimentActionType } // GetExperimentAction implements the ExperimentActionClassification interface for type DiscreteAction. @@ -232,12 +231,15 @@ func (d *DiscreteAction) GetExperimentAction() *ExperimentAction { // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. - Info any + Info *ErrorAdditionalInfoInfo // READ-ONLY; The additional info type. Type *string } +type ErrorAdditionalInfoInfo struct { +} + // ErrorDetail - The error detail. type ErrorDetail struct { // READ-ONLY; The error additional info. @@ -256,13 +258,6 @@ type ErrorDetail struct { Target *string } -// ErrorResponse - Common error response for all Azure Resource Manager APIs to return error details for failed operations. -// (This also follows the OData error response format.). -type ErrorResponse struct { - // The error object. - Error *ErrorDetail -} - // Experiment - Model that represents a Experiment resource. type Experiment struct { // REQUIRED; The geo-location where the resource lives @@ -271,8 +266,11 @@ type Experiment struct { // REQUIRED; The properties of the experiment resource. Properties *ExperimentProperties - // The identity of the experiment resource. - Identity *ResourceIdentity + // READ-ONLY; String that represents a Experiment resource name. + Name *string + + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity // Resource tags. Tags map[string]*string @@ -280,10 +278,7 @@ type Experiment 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; The system metadata of the experiment resource. + // 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" @@ -295,8 +290,8 @@ type ExperimentAction struct { // REQUIRED; String that represents a Capability URN. Name *string - // REQUIRED; Enum that discriminates between action models. - Type *string + // REQUIRED; Chaos experiment action discriminator type + Type *ExperimentActionType } // GetExperimentAction implements the ExperimentActionClassification interface for type ExperimentAction. @@ -316,13 +311,16 @@ type ExperimentExecution struct { // The properties of experiment execution status. Properties *ExperimentExecutionProperties - // READ-ONLY; String of the fully qualified resource ID. + // READ-ONLY; GUID that represents a Experiment execution detail. + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; String of the resource name. - Name *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; String of the resource type. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -398,11 +396,11 @@ type ExperimentExecutionDetailsPropertiesRunInformation struct { // ExperimentExecutionListResult - Model that represents a list of Experiment executions and a link for pagination. type ExperimentExecutionListResult struct { - // READ-ONLY; URL to retrieve the next page of Experiment executions. - NextLink *string - - // READ-ONLY; List of Experiment executions. + // REQUIRED; The ExperimentExecution items on this page Value []*ExperimentExecution + + // The link to the next page of items + NextLink *string } // ExperimentExecutionProperties - Model that represents the execution properties of an Experiment. @@ -419,11 +417,11 @@ type ExperimentExecutionProperties struct { // ExperimentListResult - Model that represents a list of Experiment resources and a link for pagination. type ExperimentListResult struct { - // READ-ONLY; URL to retrieve the next page of Experiment resources. - NextLink *string - - // READ-ONLY; List of Experiment resources. + // REQUIRED; The Experiment items on this page Value []*Experiment + + // The link to the next page of items + NextLink *string } // ExperimentProperties - Model that represents the Experiment properties model. @@ -449,10 +447,10 @@ type ExperimentStep struct { // ExperimentUpdate - Describes an experiment update. type ExperimentUpdate struct { - // The identity of the experiment resource. - Identity *ResourceIdentity + // The managed service identities assigned to this resource. + Identity *ManagedServiceIdentity - // The tags of the experiment resource. + // Resource tags. Tags map[string]*string } @@ -465,16 +463,34 @@ type KeyValuePair struct { Value *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// 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 - REST API Operation +// +// Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + // 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", @@ -486,7 +502,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 @@ -507,61 +523,41 @@ 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 - The status of operation. -type OperationStatus struct { +// OperationStatusResult - The current status of an async operation. +type OperationStatusResult struct { + // REQUIRED; Operation status. + Status *string + // The end time of the operation. - EndTime *string + EndTime *time.Time - // The error object. + // If present, details of the operation error. Error *ErrorDetail - // The operation Id. - ID *string - - // The operation name. - Name *string - - // The start time of the operation. - StartTime *string - - // The status of the operation. - Status *string -} - -// Resource - Common fields that are returned in the response for all Azure Resource Manager resources -type Resource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + // Fully qualified ID for the async operation. ID *string - // READ-ONLY; The name of the resource + // Name of the async operation. Name *string - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// ResourceIdentity - The identity of a resource. -type ResourceIdentity struct { - // REQUIRED; String of the resource identity type. - Type *ResourceIdentityType + // The operations list. + Operations []*OperationStatusResult - // The list of user identities associated with the Experiment. The user identity dictionary key references will be ARM resource - // ids in the form: - // '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - UserAssignedIdentities map[string]*UserAssignedIdentity + // Percent of the operation that is complete. + PercentComplete *float64 - // READ-ONLY; GUID that represents the principal ID of this resource identity. - PrincipalID *string + // The start time of the operation. + StartTime *time.Time - // READ-ONLY; GUID that represents the tenant ID of this resource identity. - TenantID *string + // READ-ONLY; Fully qualified ID of the resource against which the original async operation was started. + ResourceID *string } // StepStatus - Model that represents the a list of branches and branch statuses. @@ -605,16 +601,16 @@ type Target struct { // REQUIRED; The properties of the target resource. Properties map[string]any - // Location of the target resource. + // READ-ONLY; String that represents a Target resource name. + Name *string + + // Azure resource location. Location *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; The system metadata of the target resource. + // 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" @@ -623,7 +619,7 @@ type Target struct { // TargetFilter - Model that represents available filter types that can be applied to a targets list. type TargetFilter struct { - // REQUIRED; Enum that discriminates between filter types. Currently only Simple type is supported. + // REQUIRED; Chaos target filter discriminator type Type *FilterType } @@ -632,11 +628,11 @@ func (t *TargetFilter) GetTargetFilter() *TargetFilter { return t } // TargetListResult - Model that represents a list of Target resources and a link for pagination. type TargetListResult struct { - // READ-ONLY; URL to retrieve the next page of Target resources. - NextLink *string - - // READ-ONLY; List of Target resources. + // REQUIRED; The Target items on this page Value []*Target + + // The link to the next page of items + NextLink *string } // TargetListSelector - Model that represents a list selector. @@ -647,12 +643,10 @@ type TargetListSelector struct { // REQUIRED; List of Target references. Targets []*TargetReference - // REQUIRED; Enum of the selector type. + // CONSTANT; Enum of the selector type. + // Field has constant value SelectorTypeList, any specified value is ignored. Type *SelectorType - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - // Model that represents available filter types that can be applied to a targets list. Filter TargetFilterClassification } @@ -660,10 +654,9 @@ type TargetListSelector struct { // GetTargetSelector implements the TargetSelectorClassification interface for type TargetListSelector. func (t *TargetListSelector) GetTargetSelector() *TargetSelector { return &TargetSelector{ - AdditionalProperties: t.AdditionalProperties, - Filter: t.Filter, - ID: t.ID, - Type: t.Type, + Filter: t.Filter, + ID: t.ID, + Type: t.Type, } } @@ -678,12 +671,10 @@ type TargetQuerySelector struct { // REQUIRED; Subscription id list to scope resource query. SubscriptionIDs []*string - // REQUIRED; Enum of the selector type. + // CONSTANT; Enum of the selector type. + // Field has constant value SelectorTypeQuery, any specified value is ignored. Type *SelectorType - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - // Model that represents available filter types that can be applied to a targets list. Filter TargetFilterClassification } @@ -691,10 +682,9 @@ type TargetQuerySelector struct { // GetTargetSelector implements the TargetSelectorClassification interface for type TargetQuerySelector. func (t *TargetQuerySelector) GetTargetSelector() *TargetSelector { return &TargetSelector{ - AdditionalProperties: t.AdditionalProperties, - Filter: t.Filter, - ID: t.ID, - Type: t.Type, + Filter: t.Filter, + ID: t.ID, + Type: t.Type, } } @@ -712,12 +702,9 @@ type TargetSelector struct { // REQUIRED; String of the selector ID. ID *string - // REQUIRED; Enum of the selector type. + // REQUIRED; Chaos target selector discriminator type Type *SelectorType - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - // Model that represents available filter types that can be applied to a targets list. Filter TargetFilterClassification } @@ -727,7 +714,8 @@ func (t *TargetSelector) GetTargetSelector() *TargetSelector { return t } // TargetSimpleFilter - Model that represents a simple target filter. type TargetSimpleFilter struct { - // REQUIRED; Enum that discriminates between filter types. Currently only Simple type is supported. + // CONSTANT; Enum that discriminates between filter types. Currently only `Simple` type is supported. + // Field has constant value FilterTypeSimple, any specified value is ignored. Type *FilterType // Model that represents the Simple filter parameters. @@ -752,16 +740,13 @@ type TargetType struct { // REQUIRED; The properties of the target type resource. Properties *TargetTypeProperties - // Location of the Target Type resource. - Location *string + // READ-ONLY; String that represents a Target Type 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; The name of the resource - Name *string - - // READ-ONLY; The system metadata properties of the target type resource. + // 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" @@ -770,11 +755,11 @@ type TargetType struct { // TargetTypeListResult - Model that represents a list of Target Type resources and a link for pagination. type TargetTypeListResult struct { - // READ-ONLY; URL to retrieve the next page of Target Type resources. - NextLink *string - - // READ-ONLY; List of Target Type resources. + // REQUIRED; The TargetType items on this page Value []*TargetType + + // The link to the next page of items + NextLink *string } // TargetTypeProperties - Model that represents the base Target Type properties model. @@ -792,25 +777,6 @@ type TargetTypeProperties struct { ResourceTypes []*string } -// TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' -// and a 'location' -type TrackedResource struct { - // REQUIRED; The geo-location where the resource lives - Location *string - - // Resource tags. - Tags map[string]*string - - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - // UserAssignedIdentity - User assigned identity properties type UserAssignedIdentity struct { // READ-ONLY; The client ID of the assigned identity. diff --git a/sdk/resourcemanager/chaos/armchaos/models_serde.go b/sdk/resourcemanager/chaos/armchaos/models_serde.go index 81388afb9ed1..89af45d18a82 100644 --- a/sdk/resourcemanager/chaos/armchaos/models_serde.go +++ b/sdk/resourcemanager/chaos/armchaos/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 armchaos @@ -222,7 +218,6 @@ func (c *CapabilityProperties) UnmarshalJSON(data []byte) error { func (c CapabilityType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", c.ID) - populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) populate(objectMap, "systemData", c.SystemData) @@ -242,9 +237,6 @@ func (c *CapabilityType) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &c.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &c.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &c.Name) delete(rawMsg, key) @@ -306,6 +298,7 @@ func (c CapabilityTypeProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "kind", c.Kind) populate(objectMap, "parametersSchema", c.ParametersSchema) populate(objectMap, "publisher", c.Publisher) + populate(objectMap, "requiredAzureRoleDefinitionIds", c.RequiredAzureRoleDefinitionIDs) populate(objectMap, "runtimeProperties", c.RuntimeProperties) populate(objectMap, "targetType", c.TargetType) populate(objectMap, "urn", c.Urn) @@ -342,6 +335,9 @@ func (c *CapabilityTypeProperties) UnmarshalJSON(data []byte) error { case "publisher": err = unpopulate(val, "Publisher", &c.Publisher) delete(rawMsg, key) + case "requiredAzureRoleDefinitionIds": + err = unpopulate(val, "RequiredAzureRoleDefinitionIDs", &c.RequiredAzureRoleDefinitionIDs) + delete(rawMsg, key) case "runtimeProperties": err = unpopulate(val, "RuntimeProperties", &c.RuntimeProperties) delete(rawMsg, key) @@ -393,7 +389,7 @@ func (c ContinuousAction) MarshalJSON() ([]byte, error) { populate(objectMap, "name", c.Name) populate(objectMap, "parameters", c.Parameters) populate(objectMap, "selectorId", c.SelectorID) - objectMap["type"] = "continuous" + objectMap["type"] = ExperimentActionTypeContinuous return json.Marshal(objectMap) } @@ -434,7 +430,7 @@ func (d DelayAction) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "duration", d.Duration) populate(objectMap, "name", d.Name) - objectMap["type"] = "delay" + objectMap["type"] = ExperimentActionTypeDelay return json.Marshal(objectMap) } @@ -470,7 +466,7 @@ func (d DiscreteAction) MarshalJSON() ([]byte, error) { populate(objectMap, "name", d.Name) populate(objectMap, "parameters", d.Parameters) populate(objectMap, "selectorId", d.SelectorID) - objectMap["type"] = "discrete" + objectMap["type"] = ExperimentActionTypeDiscrete return json.Marshal(objectMap) } @@ -506,7 +502,7 @@ func (d *DiscreteAction) 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) } @@ -577,33 +573,6 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "error": - err = unpopulate(val, "Error", &e.Error) - 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 Experiment. func (e Experiment) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -663,7 +632,7 @@ func (e *Experiment) UnmarshalJSON(data []byte) error { func (e ExperimentAction) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "name", e.Name) - objectMap["type"] = e.Type + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -727,6 +696,7 @@ func (e ExperimentExecution) MarshalJSON() ([]byte, error) { populate(objectMap, "id", e.ID) populate(objectMap, "name", e.Name) populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -749,6 +719,9 @@ func (e *ExperimentExecution) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) @@ -1172,6 +1145,45 @@ func (k *KeyValuePair) UnmarshalJSON(data []byte) error { 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) @@ -1285,20 +1297,23 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationStatus. -func (o OperationStatus) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationStatusResult. +func (o OperationStatusResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "endTime", o.EndTime) + populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) populate(objectMap, "error", o.Error) populate(objectMap, "id", o.ID) populate(objectMap, "name", o.Name) - populate(objectMap, "startTime", o.StartTime) + 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) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatus. -func (o *OperationStatus) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusResult. +func (o *OperationStatusResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -1307,7 +1322,7 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - err = unpopulate(val, "EndTime", &o.EndTime) + err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, "Error", &o.Error) @@ -1318,8 +1333,17 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) + case "operations": + err = unpopulate(val, "Operations", &o.Operations) + delete(rawMsg, key) + case "percentComplete": + err = unpopulate(val, "PercentComplete", &o.PercentComplete) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &o.ResourceID) + delete(rawMsg, key) case "startTime": - err = unpopulate(val, "StartTime", &o.StartTime) + err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &o.Status) @@ -1332,80 +1356,6 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. -func (r *Resource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &r.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", r, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ResourceIdentity. -func (r ResourceIdentity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "principalId", r.PrincipalID) - populate(objectMap, "tenantId", r.TenantID) - populate(objectMap, "type", r.Type) - populate(objectMap, "userAssignedIdentities", r.UserAssignedIdentities) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceIdentity. -func (r *ResourceIdentity) UnmarshalJSON(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 "principalId": - err = unpopulate(val, "PrincipalID", &r.PrincipalID) - delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &r.TenantID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) - delete(rawMsg, key) - case "userAssignedIdentities": - err = unpopulate(val, "UserAssignedIdentities", &r.UserAssignedIdentities) - 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 StepStatus. func (s StepStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1542,7 +1492,7 @@ func (t *Target) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TargetFilter. func (t TargetFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["type"] = t.Type + populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } @@ -1604,11 +1554,6 @@ func (t TargetListSelector) MarshalJSON() ([]byte, error) { populate(objectMap, "id", t.ID) populate(objectMap, "targets", t.Targets) objectMap["type"] = SelectorTypeList - if t.AdditionalProperties != nil { - for key, val := range t.AdditionalProperties { - objectMap[key] = val - } - } return json.Marshal(objectMap) } @@ -1633,16 +1578,6 @@ func (t *TargetListSelector) UnmarshalJSON(data []byte) error { case "type": err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) - default: - if t.AdditionalProperties == nil { - t.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - t.AdditionalProperties[key] = aux - } - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -1659,11 +1594,6 @@ func (t TargetQuerySelector) MarshalJSON() ([]byte, error) { populate(objectMap, "queryString", t.QueryString) populate(objectMap, "subscriptionIds", t.SubscriptionIDs) objectMap["type"] = SelectorTypeQuery - if t.AdditionalProperties != nil { - for key, val := range t.AdditionalProperties { - objectMap[key] = val - } - } return json.Marshal(objectMap) } @@ -1691,16 +1621,6 @@ func (t *TargetQuerySelector) UnmarshalJSON(data []byte) error { case "type": err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) - default: - if t.AdditionalProperties == nil { - t.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - t.AdditionalProperties[key] = aux - } - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -1745,12 +1665,7 @@ func (t TargetSelector) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "filter", t.Filter) populate(objectMap, "id", t.ID) - objectMap["type"] = t.Type - if t.AdditionalProperties != nil { - for key, val := range t.AdditionalProperties { - objectMap[key] = val - } - } + populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } @@ -1772,16 +1687,6 @@ func (t *TargetSelector) UnmarshalJSON(data []byte) error { case "type": err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) - default: - if t.AdditionalProperties == nil { - t.AdditionalProperties = map[string]any{} - } - if val != nil { - var aux any - err = json.Unmarshal(val, &aux) - t.AdditionalProperties[key] = aux - } - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", t, err) @@ -1852,7 +1757,6 @@ func (t *TargetSimpleFilterParameters) UnmarshalJSON(data []byte) error { func (t TargetType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) populate(objectMap, "properties", t.Properties) populate(objectMap, "systemData", t.SystemData) @@ -1872,9 +1776,6 @@ func (t *TargetType) UnmarshalJSON(data []byte) error { case "id": err = unpopulate(val, "ID", &t.ID) delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &t.Name) delete(rawMsg, key) @@ -1965,49 +1866,6 @@ func (t *TargetTypeProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", t.ID) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. -func (t *TrackedResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &t.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &t.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &t.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &t.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", t, err) - } - } - return nil -} - // MarshalJSON implements the json.Marshaller interface for type UserAssignedIdentity. func (u UserAssignedIdentity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2049,16 +1907,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/chaos/armchaos/operations_client.go b/sdk/resourcemanager/chaos/armchaos/operations_client.go index 09f52bccdddc..b0cca90240f4 100644 --- a/sdk/resourcemanager/chaos/armchaos/operations_client.go +++ b/sdk/resourcemanager/chaos/armchaos/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 armchaos @@ -37,52 +33,52 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO return client, nil } -// NewListAllPager - Get a list all available Operations. +// NewListPager - List the operations for the provider // -// Generated from API version 2024-01-01 -// - options - OperationsClientListAllOptions contains the optional parameters for the OperationsClient.NewListAllPager method. -func (client *OperationsClient) NewListAllPager(options *OperationsClientListAllOptions) *runtime.Pager[OperationsClientListAllResponse] { - return runtime.NewPager(runtime.PagingHandler[OperationsClientListAllResponse]{ - More: func(page OperationsClientListAllResponse) bool { +// Generated from API version 2025-01-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]{ + More: func(page OperationsClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *OperationsClientListAllResponse) (OperationsClientListAllResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListAllPager") + 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.listAllCreateRequest(ctx, options) + return client.listCreateRequest(ctx, options) }, nil) if err != nil { - return OperationsClientListAllResponse{}, err + return OperationsClientListResponse{}, err } - return client.listAllHandleResponse(resp) + return client.listHandleResponse(resp) }, Tracer: client.internal.Tracer(), }) } -// listAllCreateRequest creates the ListAll request. -func (client *OperationsClient) listAllCreateRequest(ctx context.Context, options *OperationsClientListAllOptions) (*policy.Request, error) { +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Chaos/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listAllHandleResponse handles the ListAll response. -func (client *OperationsClient) listAllHandleResponse(resp *http.Response) (OperationsClientListAllResponse, error) { - result := OperationsClientListAllResponse{} +// 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 OperationsClientListAllResponse{}, err + return OperationsClientListResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/chaos/armchaos/operations_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/operations_client_example_test.go new file mode 100644 index 000000000000..d83048c64504 --- /dev/null +++ b/sdk/resourcemanager/chaos/armchaos/operations_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 armchaos_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" + "log" +) + +// Generated from example definition: 2025-01-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 := armchaos.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 = armchaos.OperationsClientListResponse{ + // OperationListResult: armchaos.OperationListResult{ + // NextLink: to.Ptr("https://management.azure.com/providers/Microsoft.Chaos/operations?continuationToken=myContinuationToken&api-version=2024-11-01-preview"), + // Value: []*armchaos.Operation{ + // { + // Name: to.Ptr("Microsoft.Chaos/experiments/read"), + // Display: &armchaos.OperationDisplay{ + // Provider: to.Ptr("Microsoft Chaos"), + // Resource: to.Ptr("Chaos Experiment"), + // Operation: to.Ptr("Gets all Chaos Experiments."), + // Description: to.Ptr("Gets all Chaos Experiments in a resource group."), + // }, + // IsDataAction: to.Ptr(false), + // Origin: to.Ptr(armchaos.OriginUserSystem), + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/chaos/armchaos/operations_live_test.go b/sdk/resourcemanager/chaos/armchaos/operations_live_test.go index bfdd647bf766..cc9420d59ea5 100644 --- a/sdk/resourcemanager/chaos/armchaos/operations_live_test.go +++ b/sdk/resourcemanager/chaos/armchaos/operations_live_test.go @@ -14,7 +14,7 @@ import ( "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/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/chaos/armchaos/operationstatuses_client.go b/sdk/resourcemanager/chaos/armchaos/operationstatuses_client.go index f5e384736644..db468c36237e 100644 --- a/sdk/resourcemanager/chaos/armchaos/operationstatuses_client.go +++ b/sdk/resourcemanager/chaos/armchaos/operationstatuses_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 armchaos @@ -20,7 +16,7 @@ import ( "strings" ) -// OperationStatusesClient contains the methods for the OperationStatuses group. +// OperationStatusesClient - Chaos Studio async operation status resource operations. // Don't use this type directly, use NewOperationStatusesClient() instead. type OperationStatusesClient struct { internal *arm.Client @@ -28,7 +24,7 @@ type OperationStatusesClient struct { } // NewOperationStatusesClient creates a new instance of OperationStatusesClient with the specified values. -// - subscriptionID - GUID that represents an Azure subscription ID. +// - 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 NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusesClient, error) { @@ -43,20 +39,20 @@ func NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCr return client, nil } -// Get - Get the status of a long running azure asynchronous operation. +// Get - Returns the current status of an async operation. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - location - The name of the Azure region. -// - asyncOperationID - The operation Id. +// Generated from API version 2025-01-01 +// - location - The location name. +// - operationID - The ID of an ongoing async operation. // - options - OperationStatusesClientGetOptions contains the optional parameters for the OperationStatusesClient.Get method. -func (client *OperationStatusesClient) Get(ctx context.Context, location string, asyncOperationID string, options *OperationStatusesClientGetOptions) (OperationStatusesClientGetResponse, error) { +func (client *OperationStatusesClient) Get(ctx context.Context, location string, operationID string, options *OperationStatusesClientGetOptions) (OperationStatusesClientGetResponse, error) { var err error const operationName = "OperationStatusesClient.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, location, asyncOperationID, options) + req, err := client.getCreateRequest(ctx, location, operationID, options) if err != nil { return OperationStatusesClientGetResponse{}, err } @@ -73,26 +69,26 @@ func (client *OperationStatusesClient) Get(ctx context.Context, location string, } // getCreateRequest creates the Get request. -func (client *OperationStatusesClient) getCreateRequest(ctx context.Context, location string, asyncOperationID string, options *OperationStatusesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/operationStatuses/{asyncOperationId}" +func (client *OperationStatusesClient) getCreateRequest(ctx context.Context, location string, operationID string, _ *OperationStatusesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/operationStatuses/{operationId}" + 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)) - if asyncOperationID == "" { - return nil, errors.New("parameter asyncOperationID cannot be empty") + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{asyncOperationId}", url.PathEscape(asyncOperationID)) - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + 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", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -101,7 +97,7 @@ func (client *OperationStatusesClient) getCreateRequest(ctx context.Context, loc // getHandleResponse handles the Get response. func (client *OperationStatusesClient) getHandleResponse(resp *http.Response) (OperationStatusesClientGetResponse, error) { result := OperationStatusesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatusResult); err != nil { return OperationStatusesClientGetResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/chaos/armchaos/operationstatuses_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/operationstatuses_client_example_test.go index e72b29a01520..f9dbd3095bf6 100644 --- a/sdk/resourcemanager/chaos/armchaos/operationstatuses_client_example_test.go +++ b/sdk/resourcemanager/chaos/armchaos/operationstatuses_client_example_test.go @@ -1,45 +1,40 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights 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 armchaos_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetOperationStatus.json +// Generated from example definition: 2025-01-01/OperationStatuses_Get.json func ExampleOperationStatusesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("e25c0d12-0335-4fec-8ef8-3b4f9a10649e", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewOperationStatusesClient().Get(ctx, "West US", "713192d7-503f-477a-9cfe-4efc3ee2bd11", nil) + res, err := clientFactory.NewOperationStatusesClient().Get(ctx, "westus2", "4bdadd97-207c-4de8-9bba-08339ae099c7", 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 = armchaos.OperationStatus{ - // Name: to.Ptr("713192d7-503f-477a-9cfe-4efc3ee2bd11"), - // EndTime: to.Ptr("2017-01-01T16:13:13.933Z"), - // ID: to.Ptr("/subscriptions/613192d7-503f-477a-9cfe-4efc3ee2bd60/locations/westus/operationStatuses/713192d7-503f-477a-9cfe-4efc3ee2bd11"), - // StartTime: to.Ptr("2017-01-01T13:13:13.933Z"), - // Status: to.Ptr("Succeeded"), + // res = armchaos.OperationStatusesClientGetResponse{ + // OperationStatusResult: &armchaos.OperationStatusResult{ + // ID: to.Ptr("/subscriptions/e25c0d12-0335-4fec-8ef8-3b4f9a10649e/providers/Microsoft.Chaos/locations/westus2/operationStatuses/4bdadd97-207c-4de8-9bba-08339ae099c7"), + // Name: to.Ptr("4bdadd97-207c-4de8-9bba-08339ae099c7"), + // StartTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-14T21:52:52.2552574Z"); return t}()), + // Status: to.Ptr("Creating"), + // }, // } } diff --git a/sdk/resourcemanager/chaos/armchaos/options.go b/sdk/resourcemanager/chaos/armchaos/options.go index 088c8b736b47..077801ac9aa1 100644 --- a/sdk/resourcemanager/chaos/armchaos/options.go +++ b/sdk/resourcemanager/chaos/armchaos/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 armchaos @@ -40,58 +36,60 @@ type CapabilityTypesClientListOptions struct { ContinuationToken *string } +// ExperimentExecutionsClientGetExecutionDetailsOptions contains the optional parameters for the ExperimentExecutionsClient.GetExecutionDetails +// method. +type ExperimentExecutionsClientGetExecutionDetailsOptions struct { + // placeholder for future optional parameters +} + +// ExperimentExecutionsClientGetExecutionOptions contains the optional parameters for the ExperimentExecutionsClient.GetExecution +// method. +type ExperimentExecutionsClientGetExecutionOptions struct { + // placeholder for future optional parameters +} + +// ExperimentExecutionsClientListAllExecutionsOptions contains the optional parameters for the ExperimentExecutionsClient.NewListAllExecutionsPager +// method. +type ExperimentExecutionsClientListAllExecutionsOptions struct { + // placeholder for future optional parameters +} + // ExperimentsClientBeginCancelOptions contains the optional parameters for the ExperimentsClient.BeginCancel method. type ExperimentsClientBeginCancelOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExperimentsClientBeginCreateOrUpdateOptions contains the optional parameters for the ExperimentsClient.BeginCreateOrUpdate // method. type ExperimentsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExperimentsClientBeginDeleteOptions contains the optional parameters for the ExperimentsClient.BeginDelete method. type ExperimentsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExperimentsClientBeginStartOptions contains the optional parameters for the ExperimentsClient.BeginStart method. type ExperimentsClientBeginStartOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // ExperimentsClientBeginUpdateOptions contains the optional parameters for the ExperimentsClient.BeginUpdate method. type ExperimentsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } -// ExperimentsClientExecutionDetailsOptions contains the optional parameters for the ExperimentsClient.ExecutionDetails method. -type ExperimentsClientExecutionDetailsOptions struct { - // placeholder for future optional parameters -} - -// ExperimentsClientGetExecutionOptions contains the optional parameters for the ExperimentsClient.GetExecution method. -type ExperimentsClientGetExecutionOptions struct { - // placeholder for future optional parameters -} - // ExperimentsClientGetOptions contains the optional parameters for the ExperimentsClient.Get method. type ExperimentsClientGetOptions struct { // placeholder for future optional parameters } -// ExperimentsClientListAllExecutionsOptions contains the optional parameters for the ExperimentsClient.NewListAllExecutionsPager -// method. -type ExperimentsClientListAllExecutionsOptions struct { - // placeholder for future optional parameters -} - // ExperimentsClientListAllOptions contains the optional parameters for the ExperimentsClient.NewListAllPager method. type ExperimentsClientListAllOptions struct { // String that sets the continuation token. @@ -117,8 +115,8 @@ type OperationStatusesClientGetOptions struct { // placeholder for future optional parameters } -// OperationsClientListAllOptions contains the optional parameters for the OperationsClient.NewListAllPager method. -type OperationsClientListAllOptions struct { +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/chaos/armchaos/polymorphic_helpers.go b/sdk/resourcemanager/chaos/armchaos/polymorphic_helpers.go index ebf835864e47..3e998574aca5 100644 --- a/sdk/resourcemanager/chaos/armchaos/polymorphic_helpers.go +++ b/sdk/resourcemanager/chaos/armchaos/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 armchaos @@ -20,11 +16,11 @@ func unmarshalExperimentActionClassification(rawMsg json.RawMessage) (Experiment } var b ExperimentActionClassification switch m["type"] { - case "continuous": + case string(ExperimentActionTypeContinuous): b = &ContinuousAction{} - case "delay": + case string(ExperimentActionTypeDelay): b = &DelayAction{} - case "discrete": + case string(ExperimentActionTypeDiscrete): b = &DiscreteAction{} default: b = &ExperimentAction{} diff --git a/sdk/resourcemanager/chaos/armchaos/responses.go b/sdk/resourcemanager/chaos/armchaos/responses.go index 7f27a717922c..d208610a4b71 100644 --- a/sdk/resourcemanager/chaos/armchaos/responses.go +++ b/sdk/resourcemanager/chaos/armchaos/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 armchaos @@ -43,6 +39,24 @@ type CapabilityTypesClientListResponse struct { CapabilityTypeListResult } +// ExperimentExecutionsClientGetExecutionDetailsResponse contains the response from method ExperimentExecutionsClient.GetExecutionDetails. +type ExperimentExecutionsClientGetExecutionDetailsResponse struct { + // Model that represents the execution details of an Experiment. + ExperimentExecutionDetails +} + +// ExperimentExecutionsClientGetExecutionResponse contains the response from method ExperimentExecutionsClient.GetExecution. +type ExperimentExecutionsClientGetExecutionResponse struct { + // Model that represents the execution of a Experiment. + ExperimentExecution +} + +// ExperimentExecutionsClientListAllExecutionsResponse contains the response from method ExperimentExecutionsClient.NewListAllExecutionsPager. +type ExperimentExecutionsClientListAllExecutionsResponse struct { + // Model that represents a list of Experiment executions and a link for pagination. + ExperimentExecutionListResult +} + // ExperimentsClientCancelResponse contains the response from method ExperimentsClient.BeginCancel. type ExperimentsClientCancelResponse struct { // placeholder for future response values @@ -59,30 +73,12 @@ type ExperimentsClientDeleteResponse struct { // placeholder for future response values } -// ExperimentsClientExecutionDetailsResponse contains the response from method ExperimentsClient.ExecutionDetails. -type ExperimentsClientExecutionDetailsResponse struct { - // Model that represents the execution details of an Experiment. - ExperimentExecutionDetails -} - -// ExperimentsClientGetExecutionResponse contains the response from method ExperimentsClient.GetExecution. -type ExperimentsClientGetExecutionResponse struct { - // Model that represents the execution of a Experiment. - ExperimentExecution -} - // ExperimentsClientGetResponse contains the response from method ExperimentsClient.Get. type ExperimentsClientGetResponse struct { // Model that represents a Experiment resource. Experiment } -// ExperimentsClientListAllExecutionsResponse contains the response from method ExperimentsClient.NewListAllExecutionsPager. -type ExperimentsClientListAllExecutionsResponse struct { - // Model that represents a list of Experiment executions and a link for pagination. - ExperimentExecutionListResult -} - // ExperimentsClientListAllResponse contains the response from method ExperimentsClient.NewListAllPager. type ExperimentsClientListAllResponse struct { // Model that represents a list of Experiment resources and a link for pagination. @@ -108,12 +104,12 @@ type ExperimentsClientUpdateResponse struct { // OperationStatusesClientGetResponse contains the response from method OperationStatusesClient.Get. type OperationStatusesClientGetResponse struct { - // The status of operation. - OperationStatus + // The current status of an async operation. + OperationStatusResult } -// OperationsClientListAllResponse contains the response from method OperationsClient.NewListAllPager. -type OperationsClientListAllResponse struct { +// 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/chaos/armchaos/targets_client.go b/sdk/resourcemanager/chaos/armchaos/targets_client.go index 9254b1b2c863..6b30e4c8cdb5 100644 --- a/sdk/resourcemanager/chaos/armchaos/targets_client.go +++ b/sdk/resourcemanager/chaos/armchaos/targets_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 armchaos @@ -28,7 +24,7 @@ type TargetsClient struct { } // NewTargetsClient creates a new instance of TargetsClient with the specified values. -// - subscriptionID - GUID that represents an Azure subscription ID. +// - 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) { @@ -46,21 +42,21 @@ func NewTargetsClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Create or update a Target resource that extends a tracked regional resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. -// - target - Target resource to be created or updated. +// - resource - Target resource to be created or updated. // - options - TargetsClientCreateOrUpdateOptions contains the optional parameters for the TargetsClient.CreateOrUpdate method. -func (client *TargetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, target Target, options *TargetsClientCreateOrUpdateOptions) (TargetsClientCreateOrUpdateResponse, error) { +func (client *TargetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName 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, parentProviderNamespace, parentResourceType, parentResourceName, targetName, target, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, parentProviderNamespace, parentResourceType, parentResourceName, targetName, resource, options) if err != nil { return TargetsClientCreateOrUpdateResponse{}, err } @@ -68,7 +64,7 @@ func (client *TargetsClient) CreateOrUpdate(ctx context.Context, resourceGroupNa if err != nil { return TargetsClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { err = runtime.NewResponseError(httpResp) return TargetsClientCreateOrUpdateResponse{}, err } @@ -77,7 +73,7 @@ func (client *TargetsClient) CreateOrUpdate(ctx context.Context, resourceGroupNa } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *TargetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, target Target, options *TargetsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *TargetsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, resource Target, _ *TargetsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -108,10 +104,11 @@ func (client *TargetsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, target); err != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { return nil, err } return req, nil @@ -129,11 +126,11 @@ func (client *TargetsClient) createOrUpdateHandleResponse(resp *http.Response) ( // Delete - Delete a Target resource that extends a tracked regional resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. // - options - TargetsClientDeleteOptions contains the optional parameters for the TargetsClient.Delete method. func (client *TargetsClient) Delete(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, options *TargetsClientDeleteOptions) (TargetsClientDeleteResponse, error) { @@ -158,7 +155,7 @@ func (client *TargetsClient) Delete(ctx context.Context, resourceGroupName strin } // deleteCreateRequest creates the Delete request. -func (client *TargetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, options *TargetsClientDeleteOptions) (*policy.Request, error) { +func (client *TargetsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, _ *TargetsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -189,7 +186,7 @@ func (client *TargetsClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -198,11 +195,11 @@ func (client *TargetsClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Get a Target resource that extends a tracked regional resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - targetName - String that represents a Target resource name. // - options - TargetsClientGetOptions contains the optional parameters for the TargetsClient.Get method. func (client *TargetsClient) Get(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, options *TargetsClientGetOptions) (TargetsClientGetResponse, error) { @@ -228,7 +225,7 @@ func (client *TargetsClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *TargetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, options *TargetsClientGetOptions) (*policy.Request, error) { +func (client *TargetsClient) getCreateRequest(ctx context.Context, resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, targetName string, _ *TargetsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -259,7 +256,7 @@ func (client *TargetsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -276,11 +273,11 @@ func (client *TargetsClient) getHandleResponse(resp *http.Response) (TargetsClie // NewListPager - Get a list of Target resources that extend a tracked regional resource. // -// Generated from API version 2024-01-01 -// - resourceGroupName - String that represents an Azure resource group. -// - parentProviderNamespace - String that represents a resource provider namespace. -// - parentResourceType - String that represents a resource type. -// - parentResourceName - String that represents a resource name. +// Generated from API version 2025-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - parentProviderNamespace - The parent resource provider namespace. +// - parentResourceType - The parent resource type. +// - parentResourceName - The parent resource name. // - options - TargetsClientListOptions contains the optional parameters for the TargetsClient.NewListPager method. func (client *TargetsClient) NewListPager(resourceGroupName string, parentProviderNamespace string, parentResourceType string, parentResourceName string, options *TargetsClientListOptions) *runtime.Pager[TargetsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[TargetsClientListResponse]{ @@ -333,7 +330,7 @@ func (client *TargetsClient) listCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } diff --git a/sdk/resourcemanager/chaos/armchaos/targets_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/targets_client_example_test.go index 3e8729e5b735..14255f853165 100644 --- a/sdk/resourcemanager/chaos/armchaos/targets_client_example_test.go +++ b/sdk/resourcemanager/chaos/armchaos/targets_client_example_test.go @@ -1,169 +1,161 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights 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 armchaos_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargets.json -func ExampleTargetsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewTargetsClient().NewListPager("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", &armchaos.TargetsClientListOptions{ContinuationToken: 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.TargetListResult = armchaos.TargetListResult{ - // Value: []*armchaos.Target{ - // { - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/targets"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: map[string]any{ - // "agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf", - // "identities": []any{ - // map[string]any{ - // "type": "CertificateSubjectIssuer", - // "subject": "CN=example.subject", - // }, - // }, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTarget.json -func ExampleTargetsClient_Get() { +// Generated from example definition: 2025-01-01/Targets_CreateOrUpdate.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 := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewTargetsClient().Get(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", nil) + res, err := clientFactory.NewTargetsClient().CreateOrUpdate(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-VirtualMachine", armchaos.Target{ + Properties: map[string]any{}, + }, 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.Target = armchaos.Target{ - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/targets"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: map[string]any{ - // "agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf", - // "identities": []any{ - // map[string]any{ - // "type": "CertificateSubjectIssuer", - // "subject": "CN=example.subject", - // }, + // res = armchaos.TargetsClientCreateOrUpdateResponse{ + // Target: &armchaos.Target{ + // Name: to.Ptr("Microsoft-VirtualMachine"), + // Type: to.Ptr("Microsoft.Chaos/targets"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-VirtualMachine"), + // Properties: map[string]any{ + // }, + // SystemData: &armchaos.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), // }, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/DeleteTarget.json +// Generated from example definition: 2025-01-01/Targets_Delete.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 := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - _, err = clientFactory.NewTargetsClient().Delete(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", nil) + res, err := clientFactory.NewTargetsClient().Delete(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", 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 = armchaos.TargetsClientDeleteResponse{ + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/CreateUpdateTarget.json -func ExampleTargetsClient_CreateOrUpdate() { +// Generated from example definition: 2025-01-01/Targets_Get.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 := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewTargetsClient().CreateOrUpdate(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", armchaos.Target{ - Properties: map[string]any{ - "identities": []any{ - map[string]any{ - "type": "CertificateSubjectIssuer", - "subject": "CN=example.subject", - }, - }, - }, - }, nil) + res, err := clientFactory.NewTargetsClient().Get(ctx, "exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", "Microsoft-Agent", 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.Target = armchaos.Target{ - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/targets"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: map[string]any{ - // "agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf", - // "identities": []any{ - // map[string]any{ - // "type": "CertificateSubjectIssuer", - // "subject": "CN=example.subject", + // res = armchaos.TargetsClientGetResponse{ + // Target: &armchaos.Target{ + // Name: to.Ptr("Microsoft-Agent"), + // Type: to.Ptr("Microsoft.Chaos/targets"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"), + // Location: to.Ptr("centraluseuap"), + // Properties: map[string]any{ + // "agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf", + // "identities": any{ + // map[string]any{ + // "type": "CertificateSubjectIssuer", + // "subject": "CN=example.subject", + // }, // }, // }, - // }, - // SystemData: &armchaos.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.000Z"); return t}()), + // SystemData: &armchaos.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // }, // }, // } } + +// Generated from example definition: 2025-01-01/Targets_List.json +func ExampleTargetsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewTargetsClient().NewListPager("exampleRG", "Microsoft.Compute", "virtualMachines", "exampleVM", 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 = armchaos.TargetsClientListResponse{ + // TargetListResult: armchaos.TargetListResult{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets?continuationToken=&api-version=2024-11-01-preview"), + // Value: []*armchaos.Target{ + // { + // Name: to.Ptr("Microsoft-Agent"), + // Type: to.Ptr("Microsoft.Chaos/targets"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/resourceGroups/exampleRG/providers/Microsoft.Compute/virtualMachines/exampleVM/providers/Microsoft.Chaos/targets/Microsoft-Agent"), + // Location: to.Ptr("centraluseuap"), + // Properties: map[string]any{ + // "agentProfileId": "ac4e8251-fdc9-4277-8e87-dc57fe5794cf", + // "identities": any{ + // map[string]any{ + // "type": "CertificateSubjectIssuer", + // "subject": "CN=example.subject", + // }, + // }, + // }, + // SystemData: &armchaos.SystemData{ + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-07-01T00:00:00.0Z"); return t}()), + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/chaos/armchaos/targets_live_test.go b/sdk/resourcemanager/chaos/armchaos/targets_live_test.go index cf78e4a3a1a6..3d17da23c2d4 100644 --- a/sdk/resourcemanager/chaos/armchaos/targets_live_test.go +++ b/sdk/resourcemanager/chaos/armchaos/targets_live_test.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/stretchr/testify/suite" diff --git a/sdk/resourcemanager/chaos/armchaos/targettypes_client.go b/sdk/resourcemanager/chaos/armchaos/targettypes_client.go index c84ab3f33eb4..2a76543b7f3d 100644 --- a/sdk/resourcemanager/chaos/armchaos/targettypes_client.go +++ b/sdk/resourcemanager/chaos/armchaos/targettypes_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 armchaos @@ -28,7 +24,7 @@ type TargetTypesClient struct { } // NewTargetTypesClient creates a new instance of TargetTypesClient with the specified values. -// - subscriptionID - GUID that represents an Azure subscription ID. +// - 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 NewTargetTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TargetTypesClient, error) { @@ -46,17 +42,17 @@ func NewTargetTypesClient(subscriptionID string, credential azcore.TokenCredenti // Get - Get a Target Type resources for given location. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-01-01 -// - locationName - String that represents a Location resource name. +// Generated from API version 2025-01-01 +// - location - The name of the Azure region. // - targetTypeName - String that represents a Target Type resource name. // - options - TargetTypesClientGetOptions contains the optional parameters for the TargetTypesClient.Get method. -func (client *TargetTypesClient) Get(ctx context.Context, locationName string, targetTypeName string, options *TargetTypesClientGetOptions) (TargetTypesClientGetResponse, error) { +func (client *TargetTypesClient) Get(ctx context.Context, location string, targetTypeName string, options *TargetTypesClientGetOptions) (TargetTypesClientGetResponse, error) { var err error const operationName = "TargetTypesClient.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, locationName, targetTypeName, options) + req, err := client.getCreateRequest(ctx, location, targetTypeName, options) if err != nil { return TargetTypesClientGetResponse{}, err } @@ -73,16 +69,16 @@ func (client *TargetTypesClient) Get(ctx context.Context, locationName string, t } // getCreateRequest creates the Get request. -func (client *TargetTypesClient) getCreateRequest(ctx context.Context, locationName string, targetTypeName string, options *TargetTypesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}" +func (client *TargetTypesClient) getCreateRequest(ctx context.Context, location string, targetTypeName string, _ *TargetTypesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes/{targetTypeName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if locationName == "" { - return nil, errors.New("parameter locationName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) if targetTypeName == "" { return nil, errors.New("parameter targetTypeName cannot be empty") } @@ -92,7 +88,7 @@ func (client *TargetTypesClient) getCreateRequest(ctx context.Context, locationN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -109,10 +105,10 @@ func (client *TargetTypesClient) getHandleResponse(resp *http.Response) (TargetT // NewListPager - Get a list of Target Type resources for given location. // -// Generated from API version 2024-01-01 -// - locationName - String that represents a Location resource name. +// Generated from API version 2025-01-01 +// - location - The name of the Azure region. // - options - TargetTypesClientListOptions contains the optional parameters for the TargetTypesClient.NewListPager method. -func (client *TargetTypesClient) NewListPager(locationName string, options *TargetTypesClientListOptions) *runtime.Pager[TargetTypesClientListResponse] { +func (client *TargetTypesClient) NewListPager(location string, options *TargetTypesClientListOptions) *runtime.Pager[TargetTypesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[TargetTypesClientListResponse]{ More: func(page TargetTypesClientListResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 @@ -124,7 +120,7 @@ func (client *TargetTypesClient) NewListPager(locationName string, options *Targ nextLink = *page.NextLink } resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, locationName, options) + return client.listCreateRequest(ctx, location, options) }, nil) if err != nil { return TargetTypesClientListResponse{}, err @@ -136,22 +132,22 @@ func (client *TargetTypesClient) NewListPager(locationName string, options *Targ } // listCreateRequest creates the List request. -func (client *TargetTypesClient) listCreateRequest(ctx context.Context, locationName string, options *TargetTypesClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes" +func (client *TargetTypesClient) listCreateRequest(ctx context.Context, location string, options *TargetTypesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{location}/targetTypes" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if locationName == "" { - return nil, errors.New("parameter locationName cannot be empty") + if location == "" { + return nil, errors.New("parameter location cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{locationName}", url.PathEscape(locationName)) + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-01-01") + reqQP.Set("api-version", "2025-01-01") if options != nil && options.ContinuationToken != nil { reqQP.Set("continuationToken", *options.ContinuationToken) } diff --git a/sdk/resourcemanager/chaos/armchaos/targettypes_client_example_test.go b/sdk/resourcemanager/chaos/armchaos/targettypes_client_example_test.go index c26ec4669bc6..caa24bc5fbcb 100644 --- a/sdk/resourcemanager/chaos/armchaos/targettypes_client_example_test.go +++ b/sdk/resourcemanager/chaos/armchaos/targettypes_client_example_test.go @@ -1,34 +1,64 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights 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 armchaos_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/ListTargetTypes.json +// Generated from example definition: 2025-01-01/TargetTypes_Get.json +func ExampleTargetTypesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewTargetTypesClient().Get(ctx, "westus2", "Microsoft-Agent", 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 = armchaos.TargetTypesClientGetResponse{ + // TargetType: &armchaos.TargetType{ + // Name: to.Ptr("Microsoft-Agent"), + // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-Agent"), + // Properties: &armchaos.TargetTypeProperties{ + // Description: to.Ptr("A target represents Chaos Agent."), + // DisplayName: to.Ptr("Chaos Agent"), + // PropertiesSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine.json"), + // ResourceTypes: []*string{ + // to.Ptr("Microsoft.Compute/virtualMachines"), + // to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-01-01/TargetTypes_List.json func ExampleTargetTypesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) + clientFactory, err := armchaos.NewClientFactory("6b052e15-03d3-4f17-b2e1-be7f07588291", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewTargetTypesClient().NewListPager("westus2", &armchaos.TargetTypesClientListOptions{ContinuationToken: nil}) + pager := clientFactory.NewTargetTypesClient().NewListPager("westus2", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -39,56 +69,26 @@ func ExampleTargetTypesClient_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.TargetTypeListResult = armchaos.TargetTypeListResult{ - // Value: []*armchaos.TargetType{ - // { - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armchaos.TargetTypeProperties{ - // Description: to.Ptr("A target represents Chaos Agent."), - // DisplayName: to.Ptr("Chaos Agent"), - // PropertiesSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine.json"), - // ResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines"), - // to.Ptr("Microsoft.Compute/virtualMachineScaleSets")}, + // page = armchaos.TargetTypesClientListResponse{ + // TargetTypeListResult: armchaos.TargetTypeListResult{ + // NextLink: to.Ptr("https://management.azure.com/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes?continuationToken=&api-version=2024-11-01-preview"), + // Value: []*armchaos.TargetType{ + // { + // Name: to.Ptr("Microsoft-Agent"), + // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes"), + // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-Agent"), + // Properties: &armchaos.TargetTypeProperties{ + // Description: to.Ptr("A target represents Chaos Agent."), + // DisplayName: to.Ptr("Chaos Agent"), + // PropertiesSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine.json"), + // ResourceTypes: []*string{ + // to.Ptr("Microsoft.Compute/virtualMachines"), + // to.Ptr("Microsoft.Compute/virtualMachineScaleSets"), + // }, // }, - // }}, - // } + // }, + // }, + // }, + // } } } - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/e4009d2f8d3bf0271757e522c7d1c1997e193d44/specification/chaos/resource-manager/Microsoft.Chaos/stable/2024-01-01/examples/GetTargetType.json -func ExampleTargetTypesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armchaos.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewTargetTypesClient().Get(ctx, "westus2", "Microsoft-Agent", 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.TargetType = armchaos.TargetType{ - // Name: to.Ptr("Microsoft-Agent"), - // Type: to.Ptr("Microsoft.Chaos/locations/targetTypes"), - // ID: to.Ptr("/subscriptions/6b052e15-03d3-4f17-b2e1-be7f07588291/providers/Microsoft.Chaos/locations/westus2/targetTypes/Microsoft-Agent"), - // Location: to.Ptr("centraluseuap"), - // Properties: &armchaos.TargetTypeProperties{ - // Description: to.Ptr("A target represents Chaos Agent."), - // DisplayName: to.Ptr("Chaos Agent"), - // PropertiesSchema: to.Ptr("https://schema.centralus.chaos-prod.azure.com/targets/Microsoft-VirtualMachine.json"), - // ResourceTypes: []*string{ - // to.Ptr("Microsoft.Compute/virtualMachines"), - // to.Ptr("Microsoft.Compute/virtualMachineScaleSets")}, - // }, - // } -} diff --git a/sdk/resourcemanager/chaos/armchaos/targettypes_live_test.go b/sdk/resourcemanager/chaos/armchaos/targettypes_live_test.go index 494f73e36464..74d58009e393 100644 --- a/sdk/resourcemanager/chaos/armchaos/targettypes_live_test.go +++ b/sdk/resourcemanager/chaos/armchaos/targettypes_live_test.go @@ -14,7 +14,7 @@ import ( "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/internal/recording" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/chaos/armchaos/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/chaos/armchaos/time_rfc3339.go b/sdk/resourcemanager/chaos/armchaos/time_rfc3339.go index 136b2093dcd6..89003ff52115 100644 --- a/sdk/resourcemanager/chaos/armchaos/time_rfc3339.go +++ b/sdk/resourcemanager/chaos/armchaos/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 armchaos @@ -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/chaos/armchaos/tsp-location.yaml b/sdk/resourcemanager/chaos/armchaos/tsp-location.yaml new file mode 100644 index 000000000000..6344e8ef842a --- /dev/null +++ b/sdk/resourcemanager/chaos/armchaos/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/chaos/Chaos.Management +commit: 079f70d6f2b754db6b736e117196104efd2dd496 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md b/sdk/resourcemanager/computefleet/armcomputefleet/CHANGELOG.md index d91bbac6cf58..65a004e23f9c 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-05-13) +### 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 92d31274c769..6ee68315561b 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..02e271984e95 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) { @@ -122,7 +141,7 @@ func (f *FleetsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armcomputefleet.Fleet](req) @@ -170,7 +189,7 @@ func (f *FleetsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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) @@ -212,7 +231,7 @@ func (f *FleetsServerTransport) dispatchGet(req *http.Request) (*http.Response, const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -247,7 +266,7 @@ func (f *FleetsServerTransport) dispatchNewListByResourceGroupPager(req *http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -284,7 +303,7 @@ func (f *FleetsServerTransport) dispatchNewListBySubscriptionPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := f.srv.NewListBySubscriptionPager(nil) @@ -317,7 +336,7 @@ func (f *FleetsServerTransport) dispatchNewListVirtualMachineScaleSetsPager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachineScaleSets` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -358,7 +377,7 @@ func (f *FleetsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureFleet/fleets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armcomputefleet.FleetUpdate](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..2f3e667d135a 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" ) @@ -185,6 +185,7 @@ func ExampleFleetsClient_BeginCreateOrUpdate_fleetsCreateOrUpdate() { DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), }, }, + DiskControllerType: to.Ptr(armcomputefleet.DiskControllerTypes("uzb")), }, NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ HealthProbe: &armcomputefleet.APIEntityReference{ @@ -566,6 +567,7 @@ func ExampleFleetsClient_BeginCreateOrUpdate_fleetsCreateOrUpdate() { // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), // }, // }, + // DiskControllerType: to.Ptr(armcomputefleet.DiskControllerTypes("uzb")), // }, // NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ // HealthProbe: &armcomputefleet.APIEntityReference{ @@ -888,6 +890,7 @@ func ExampleFleetsClient_BeginCreateOrUpdate_fleetsCreateOrUpdateMinimumSet() { }, }, }, + NetworkAPIVersion: to.Ptr(armcomputefleet.NetworkAPIVersion("2022-07-01")), }, }, ComputeAPIVersion: to.Ptr("2023-09-01"), @@ -988,6 +991,7 @@ func ExampleFleetsClient_BeginCreateOrUpdate_fleetsCreateOrUpdateMinimumSet() { // }, // }, // }, + // NetworkAPIVersion: to.Ptr(armcomputefleet.NetworkAPIVersion("2022-07-01")), // }, // }, // ComputeAPIVersion: to.Ptr("2023-09-01"), @@ -1208,6 +1212,7 @@ func ExampleFleetsClient_Get() { // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), // }, // }, + // DiskControllerType: to.Ptr(armcomputefleet.DiskControllerTypes("uzb")), // }, // NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ // HealthProbe: &armcomputefleet.APIEntityReference{ @@ -1627,6 +1632,7 @@ func ExampleFleetsClient_NewListByResourceGroupPager() { // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), // }, // }, + // DiskControllerType: to.Ptr(armcomputefleet.DiskControllerTypes("uzb")), // }, // NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ // HealthProbe: &armcomputefleet.APIEntityReference{ @@ -2050,6 +2056,7 @@ func ExampleFleetsClient_NewListBySubscriptionPager() { // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), // }, // }, + // DiskControllerType: to.Ptr(armcomputefleet.DiskControllerTypes("uzb")), // }, // NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ // HealthProbe: &armcomputefleet.APIEntityReference{ @@ -2313,7 +2320,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), @@ -2518,6 +2524,7 @@ func ExampleFleetsClient_BeginUpdate() { DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), }, }, + DiskControllerType: to.Ptr(armcomputefleet.DiskControllerTypes("uzb")), }, NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ HealthProbe: &armcomputefleet.APIEntityReference{ @@ -2884,6 +2891,7 @@ func ExampleFleetsClient_BeginUpdate() { // DeleteOption: to.Ptr(armcomputefleet.DiskDeleteOptionTypesDelete), // }, // }, + // DiskControllerType: to.Ptr(armcomputefleet.DiskControllerTypes("uzb")), // }, // NetworkProfile: &armcomputefleet.VirtualMachineScaleSetNetworkProfile{ // HealthProbe: &armcomputefleet.APIEntityReference{ diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/go.mod b/sdk/resourcemanager/computefleet/armcomputefleet/go.mod index 67c3d9b64fab..f67046b16310 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.23.0 diff --git a/sdk/resourcemanager/computefleet/armcomputefleet/models.go b/sdk/resourcemanager/computefleet/armcomputefleet/models.go index caf2d6bf4392..609227169a5c 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 @@ -507,14 +507,16 @@ type OSImageNotificationProfile struct { NotBeforeTimeout *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 +681,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 +910,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 +994,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 +1021,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 +1422,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 +1451,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 +1465,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 +1534,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 +1549,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 +1564,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 +1607,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..7660083ae0c4 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: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs additionalDirectories: diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/CHANGELOG.md b/sdk/resourcemanager/computeschedule/armcomputeschedule/CHANGELOG.md index 05bafe390c04..6faebbcbb852 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/CHANGELOG.md +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/CHANGELOG.md @@ -1,5 +1,21 @@ # Release History +## 1.1.0 (2025-05-13) +### Features Added + +- New function `*ScheduledActionsClient.VirtualMachinesExecuteCreate(context.Context, string, ExecuteCreateRequest, *ScheduledActionsClientVirtualMachinesExecuteCreateOptions) (ScheduledActionsClientVirtualMachinesExecuteCreateResponse, error)` +- New function `*ScheduledActionsClient.VirtualMachinesExecuteDelete(context.Context, string, ExecuteDeleteRequest, *ScheduledActionsClientVirtualMachinesExecuteDeleteOptions) (ScheduledActionsClientVirtualMachinesExecuteDeleteResponse, error)` +- New function `*ScheduledActionsClient.VirtualMachinesSubmitCreate(context.Context, string, SubmitCreateRequest, *ScheduledActionsClientVirtualMachinesSubmitCreateOptions) (ScheduledActionsClientVirtualMachinesSubmitCreateResponse, error)` +- New function `*ScheduledActionsClient.VirtualMachinesSubmitDelete(context.Context, string, SubmitDeleteRequest, *ScheduledActionsClientVirtualMachinesSubmitDeleteOptions) (ScheduledActionsClientVirtualMachinesSubmitDeleteResponse, error)` +- New struct `CreateResourceOperationResponse` +- New struct `DeleteResourceOperationResponse` +- New struct `ExecuteCreateRequest` +- New struct `ExecuteDeleteRequest` +- New struct `ResourceProvisionPayload` +- New struct `SubmitCreateRequest` +- New struct `SubmitDeleteRequest` + + ## 1.0.0 (2025-01-24) ### Breaking Changes diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/autorest.md b/sdk/resourcemanager/computeschedule/armcomputeschedule/autorest.md deleted file mode 100644 index ed1d8d0e071a..000000000000 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/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/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 -tag: package-2024-10-01 -``` \ No newline at end of file diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/build.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/build.go deleted file mode 100644 index 62d8e2521509..000000000000 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/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/computeschedule/armcomputeschedule - -package armcomputeschedule diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/client_factory.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/client_factory.go index f3b18164ab51..7bbcc1b6db88 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/client_factory.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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 armcomputeschedule diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/constants.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/constants.go index 373c327a661b..1721c38226dc 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/constants.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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 armcomputeschedule const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computeschedule/armcomputeschedule" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.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" ) @@ -113,8 +110,11 @@ func PossibleOptimizationPreferenceValues() []OptimizationPreference { 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" ) @@ -127,7 +127,7 @@ func PossibleOriginValues() []Origin { } } -// ResourceOperationType - Type of operation performed on the resources +// ResourceOperationType - The kind of operation types that can be performed on resources using ScheduledActions type ResourceOperationType string const ( diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/internal.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/internal.go index 5f75802a569e..7425b6a669e2 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/internal.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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/computeschedule/armcomputeschedule/fake/operations_server.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/operations_server.go index 0e47f1aeeaef..83f02b372d8b 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/operations_server.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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/computeschedule/armcomputeschedule/fake/scheduledactions_server.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/scheduledactions_server.go index bed1392f6310..ba85525eafa8 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/scheduledactions_server.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/scheduledactions_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,18 @@ type ScheduledActionsServer struct { // HTTP status codes to indicate success: http.StatusOK VirtualMachinesCancelOperations func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.CancelOperationsRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesCancelOperationsOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesCancelOperationsResponse], errResp azfake.ErrorResponder) + // VirtualMachinesExecuteCreate is the fake for method ScheduledActionsClient.VirtualMachinesExecuteCreate + // HTTP status codes to indicate success: http.StatusOK + VirtualMachinesExecuteCreate func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.ExecuteCreateRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteCreateOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteCreateResponse], errResp azfake.ErrorResponder) + // VirtualMachinesExecuteDeallocate is the fake for method ScheduledActionsClient.VirtualMachinesExecuteDeallocate // HTTP status codes to indicate success: http.StatusOK VirtualMachinesExecuteDeallocate func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.ExecuteDeallocateRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse], errResp azfake.ErrorResponder) + // VirtualMachinesExecuteDelete is the fake for method ScheduledActionsClient.VirtualMachinesExecuteDelete + // HTTP status codes to indicate success: http.StatusOK + VirtualMachinesExecuteDelete func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.ExecuteDeleteRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteDeleteOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteDeleteResponse], errResp azfake.ErrorResponder) + // VirtualMachinesExecuteHibernate is the fake for method ScheduledActionsClient.VirtualMachinesExecuteHibernate // HTTP status codes to indicate success: http.StatusOK VirtualMachinesExecuteHibernate func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.ExecuteHibernateRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteHibernateOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteHibernateResponse], errResp azfake.ErrorResponder) @@ -47,10 +51,18 @@ type ScheduledActionsServer struct { // HTTP status codes to indicate success: http.StatusOK VirtualMachinesGetOperationStatus func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.GetOperationStatusRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesGetOperationStatusOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesGetOperationStatusResponse], errResp azfake.ErrorResponder) + // VirtualMachinesSubmitCreate is the fake for method ScheduledActionsClient.VirtualMachinesSubmitCreate + // HTTP status codes to indicate success: http.StatusOK + VirtualMachinesSubmitCreate func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.SubmitCreateRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitCreateOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitCreateResponse], errResp azfake.ErrorResponder) + // VirtualMachinesSubmitDeallocate is the fake for method ScheduledActionsClient.VirtualMachinesSubmitDeallocate // HTTP status codes to indicate success: http.StatusOK VirtualMachinesSubmitDeallocate func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.SubmitDeallocateRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse], errResp azfake.ErrorResponder) + // VirtualMachinesSubmitDelete is the fake for method ScheduledActionsClient.VirtualMachinesSubmitDelete + // HTTP status codes to indicate success: http.StatusOK + VirtualMachinesSubmitDelete func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.SubmitDeleteRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitDeleteOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitDeleteResponse], errResp azfake.ErrorResponder) + // VirtualMachinesSubmitHibernate is the fake for method ScheduledActionsClient.VirtualMachinesSubmitHibernate // HTTP status codes to indicate success: http.StatusOK VirtualMachinesSubmitHibernate func(ctx context.Context, locationparameter string, requestBody armcomputeschedule.SubmitHibernateRequest, options *armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitHibernateOptions) (resp azfake.Responder[armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitHibernateResponse], errResp azfake.ErrorResponder) @@ -81,37 +93,64 @@ func (s *ScheduledActionsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "ScheduledActionsClient.VirtualMachinesCancelOperations": - resp, err = s.dispatchVirtualMachinesCancelOperations(req) - case "ScheduledActionsClient.VirtualMachinesExecuteDeallocate": - resp, err = s.dispatchVirtualMachinesExecuteDeallocate(req) - case "ScheduledActionsClient.VirtualMachinesExecuteHibernate": - resp, err = s.dispatchVirtualMachinesExecuteHibernate(req) - case "ScheduledActionsClient.VirtualMachinesExecuteStart": - resp, err = s.dispatchVirtualMachinesExecuteStart(req) - case "ScheduledActionsClient.VirtualMachinesGetOperationErrors": - resp, err = s.dispatchVirtualMachinesGetOperationErrors(req) - case "ScheduledActionsClient.VirtualMachinesGetOperationStatus": - resp, err = s.dispatchVirtualMachinesGetOperationStatus(req) - case "ScheduledActionsClient.VirtualMachinesSubmitDeallocate": - resp, err = s.dispatchVirtualMachinesSubmitDeallocate(req) - case "ScheduledActionsClient.VirtualMachinesSubmitHibernate": - resp, err = s.dispatchVirtualMachinesSubmitHibernate(req) - case "ScheduledActionsClient.VirtualMachinesSubmitStart": - resp, err = s.dispatchVirtualMachinesSubmitStart(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ScheduledActionsServerTransport) 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 scheduledActionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = scheduledActionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ScheduledActionsClient.VirtualMachinesCancelOperations": + res.resp, res.err = s.dispatchVirtualMachinesCancelOperations(req) + case "ScheduledActionsClient.VirtualMachinesExecuteCreate": + res.resp, res.err = s.dispatchVirtualMachinesExecuteCreate(req) + case "ScheduledActionsClient.VirtualMachinesExecuteDeallocate": + res.resp, res.err = s.dispatchVirtualMachinesExecuteDeallocate(req) + case "ScheduledActionsClient.VirtualMachinesExecuteDelete": + res.resp, res.err = s.dispatchVirtualMachinesExecuteDelete(req) + case "ScheduledActionsClient.VirtualMachinesExecuteHibernate": + res.resp, res.err = s.dispatchVirtualMachinesExecuteHibernate(req) + case "ScheduledActionsClient.VirtualMachinesExecuteStart": + res.resp, res.err = s.dispatchVirtualMachinesExecuteStart(req) + case "ScheduledActionsClient.VirtualMachinesGetOperationErrors": + res.resp, res.err = s.dispatchVirtualMachinesGetOperationErrors(req) + case "ScheduledActionsClient.VirtualMachinesGetOperationStatus": + res.resp, res.err = s.dispatchVirtualMachinesGetOperationStatus(req) + case "ScheduledActionsClient.VirtualMachinesSubmitCreate": + res.resp, res.err = s.dispatchVirtualMachinesSubmitCreate(req) + case "ScheduledActionsClient.VirtualMachinesSubmitDeallocate": + res.resp, res.err = s.dispatchVirtualMachinesSubmitDeallocate(req) + case "ScheduledActionsClient.VirtualMachinesSubmitDelete": + res.resp, res.err = s.dispatchVirtualMachinesSubmitDelete(req) + case "ScheduledActionsClient.VirtualMachinesSubmitHibernate": + res.resp, res.err = s.dispatchVirtualMachinesSubmitHibernate(req) + case "ScheduledActionsClient.VirtualMachinesSubmitStart": + res.resp, res.err = s.dispatchVirtualMachinesSubmitStart(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesCancelOperations(req *http.Request) (*http.Response, error) { @@ -121,7 +160,7 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesCancelOperation const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesCancelOperations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.CancelOperationsRequest](req) @@ -147,6 +186,39 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesCancelOperation return resp, nil } +func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteCreate(req *http.Request) (*http.Response, error) { + if s.srv.VirtualMachinesExecuteCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesExecuteCreate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesExecuteCreate` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.ExecuteCreateRequest](req) + if err != nil { + return nil, err + } + locationparameterParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationparameter")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.VirtualMachinesExecuteCreate(req.Context(), locationparameterParam, 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).CreateResourceOperationResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteDeallocate(req *http.Request) (*http.Response, error) { if s.srv.VirtualMachinesExecuteDeallocate == nil { return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesExecuteDeallocate not implemented")} @@ -154,7 +226,7 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteDealloca const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesExecuteDeallocate` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.ExecuteDeallocateRequest](req) @@ -180,6 +252,39 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteDealloca return resp, nil } +func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteDelete(req *http.Request) (*http.Response, error) { + if s.srv.VirtualMachinesExecuteDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesExecuteDelete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesExecuteDelete` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.ExecuteDeleteRequest](req) + if err != nil { + return nil, err + } + locationparameterParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationparameter")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.VirtualMachinesExecuteDelete(req.Context(), locationparameterParam, 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).DeleteResourceOperationResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteHibernate(req *http.Request) (*http.Response, error) { if s.srv.VirtualMachinesExecuteHibernate == nil { return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesExecuteHibernate not implemented")} @@ -187,7 +292,7 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteHibernat const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesExecuteHibernate` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.ExecuteHibernateRequest](req) @@ -220,7 +325,7 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesExecuteStart(re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesExecuteStart` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.ExecuteStartRequest](req) @@ -253,7 +358,7 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesGetOperationErr const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesGetOperationErrors` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.GetOperationErrorsRequest](req) @@ -286,7 +391,7 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesGetOperationSta const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesGetOperationStatus` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.GetOperationStatusRequest](req) @@ -312,6 +417,39 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesGetOperationSta return resp, nil } +func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitCreate(req *http.Request) (*http.Response, error) { + if s.srv.VirtualMachinesSubmitCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesSubmitCreate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesSubmitCreate` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.SubmitCreateRequest](req) + if err != nil { + return nil, err + } + locationparameterParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationparameter")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.VirtualMachinesSubmitCreate(req.Context(), locationparameterParam, 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).CreateResourceOperationResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitDeallocate(req *http.Request) (*http.Response, error) { if s.srv.VirtualMachinesSubmitDeallocate == nil { return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesSubmitDeallocate not implemented")} @@ -319,7 +457,7 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitDeallocat const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesSubmitDeallocate` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.SubmitDeallocateRequest](req) @@ -345,6 +483,39 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitDeallocat return resp, nil } +func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitDelete(req *http.Request) (*http.Response, error) { + if s.srv.VirtualMachinesSubmitDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesSubmitDelete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesSubmitDelete` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.SubmitDeleteRequest](req) + if err != nil { + return nil, err + } + locationparameterParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationparameter")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.VirtualMachinesSubmitDelete(req.Context(), locationparameterParam, 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).DeleteResourceOperationResponse, req) + if err != nil { + return nil, err + } + return resp, nil +} + func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitHibernate(req *http.Request) (*http.Response, error) { if s.srv.VirtualMachinesSubmitHibernate == nil { return nil, &nonRetriableError{errors.New("fake for method VirtualMachinesSubmitHibernate not implemented")} @@ -352,7 +523,7 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitHibernate const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesSubmitHibernate` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.SubmitHibernateRequest](req) @@ -385,7 +556,7 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitStart(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ComputeSchedule/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualMachinesSubmitStart` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armcomputeschedule.SubmitStartRequest](req) @@ -410,3 +581,9 @@ func (s *ScheduledActionsServerTransport) dispatchVirtualMachinesSubmitStart(req } return resp, nil } + +// set this to conditionally intercept incoming requests to ScheduledActionsServerTransport +var scheduledActionsServerTransportInterceptor 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/computeschedule/armcomputeschedule/fake/server_factory.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/server_factory.go index 98595b101731..8033269bf59a 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/server_factory.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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,7 +15,10 @@ import ( // ServerFactory is a fake server for instances of the armcomputeschedule.ClientFactory type. type ServerFactory struct { - OperationsServer OperationsServer + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // ScheduledActionsServer contains the fakes for client ScheduledActionsClient ScheduledActionsServer ScheduledActionsServer } diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/time_rfc3339.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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 ( - "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 { - 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/computeschedule/armcomputeschedule/models.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/models.go index 3e78e04f6504..a5145ecd4b90 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/models.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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 armcomputeschedule @@ -25,6 +21,21 @@ type CancelOperationsResponse struct { Results []*ResourceOperation } +// CreateResourceOperationResponse - The response from a create request +type CreateResourceOperationResponse struct { + // REQUIRED; The description of the operation response + Description *string + + // REQUIRED; The location of the start request eg westus + Location *string + + // REQUIRED; The type of resources used in the create request eg virtual machines + Type *string + + // The results from the start request if no errors exist + Results []*ResourceOperation +} + // DeallocateResourceOperationResponse - The response from a deallocate request type DeallocateResourceOperationResponse struct { // REQUIRED; The description of the operation response @@ -40,6 +51,33 @@ type DeallocateResourceOperationResponse struct { Results []*ResourceOperation } +// DeleteResourceOperationResponse - The response from a delete request +type DeleteResourceOperationResponse struct { + // REQUIRED; The description of the operation response + Description *string + + // REQUIRED; The location of the start request eg westus + Location *string + + // REQUIRED; The type of resources used in the delete request eg virtual machines + Type *string + + // The results from the start request if no errors exist + Results []*ResourceOperation +} + +// ExecuteCreateRequest - The ExecuteCreateRequest request for create operations +type ExecuteCreateRequest struct { + // REQUIRED; The execution parameters for the request + ExecutionParameters *ExecutionParameters + + // REQUIRED; resource creation payload + ResourceConfigParameters *ResourceProvisionPayload + + // CorrelationId item + Correlationid *string +} + // ExecuteDeallocateRequest - The ExecuteDeallocateRequest request for executeDeallocate operations type ExecuteDeallocateRequest struct { // REQUIRED; CorrelationId item @@ -52,6 +90,21 @@ type ExecuteDeallocateRequest struct { Resources *Resources } +// ExecuteDeleteRequest - The ExecuteDeleteRequest request for delete operations +type ExecuteDeleteRequest struct { + // REQUIRED; The execution parameters for the request + ExecutionParameters *ExecutionParameters + + // REQUIRED; The resources for the request + Resources *Resources + + // CorrelationId item + Correlationid *string + + // Forced delete resource item + ForceDeletion *bool +} + // ExecuteHibernateRequest - The ExecuteHibernateRequest request for executeHibernate operations type ExecuteHibernateRequest struct { // REQUIRED; CorrelationId item @@ -127,16 +180,18 @@ type HibernateResourceOperationResponse struct { Results []*ResourceOperation } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API Operation +// +// Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + // 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", @@ -148,7 +203,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 @@ -214,11 +269,11 @@ type OperationErrorsResult 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 } // ResourceOperation - High level response from an operation on a resource @@ -284,6 +339,21 @@ type ResourceOperationError struct { ErrorDetails *string } +// ResourceProvisionPayload - Resource creation data model +type ResourceProvisionPayload struct { + // REQUIRED; Number of resources to be created + ResourceCount *int32 + + // baseProfile, Resource properties that common across all resources + BaseProfile *string + + // resourceOverrides, properties per resource that needs to be overwritted from baseProfile + ResourceOverrides []*string + + // if resourceOverrides doesn't contain "name", service will create name based of prefix and ResourceCount e.g. resourceprefix-0,resourceprefix-1.. + ResourcePrefix *string +} + // Resources - The resources needed for the user request type Resources struct { // REQUIRED; The resource ids used for the request @@ -332,6 +402,21 @@ type StartResourceOperationResponse struct { Results []*ResourceOperation } +// SubmitCreateRequest - The SubmitCreateRequest request for create operations +type SubmitCreateRequest struct { + // REQUIRED; resource creation payload + ResourceConfigParameters *ResourceProvisionPayload + + // REQUIRED; The schedule for the request + Schedule *Schedule + + // CorrelationId item + Correlationid *string + + // The execution parameters for the request + ExecutionParameters *ExecutionParameters +} + // SubmitDeallocateRequest - The deallocate request for resources type SubmitDeallocateRequest struct { // REQUIRED; CorrelationId item @@ -347,6 +432,24 @@ type SubmitDeallocateRequest struct { Schedule *Schedule } +// SubmitDeleteRequest - The SubmitDeleteRequest request for delete operations +type SubmitDeleteRequest struct { + // REQUIRED; The execution parameters for the request + ExecutionParameters *ExecutionParameters + + // REQUIRED; The resources for the request + Resources *Resources + + // REQUIRED; The schedule for the request + Schedule *Schedule + + // CorrelationId item + Correlationid *string + + // Forced delete resource item + ForceDeletion *bool +} + // SubmitHibernateRequest - This is the request for hibernate type SubmitHibernateRequest struct { // REQUIRED; CorrelationId item diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/models_serde.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/models_serde.go index 9fb0a1ac9c20..992244055061 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/models_serde.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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 armcomputeschedule @@ -73,6 +69,45 @@ func (c *CancelOperationsResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CreateResourceOperationResponse. +func (c CreateResourceOperationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", c.Description) + populate(objectMap, "location", c.Location) + populate(objectMap, "results", c.Results) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CreateResourceOperationResponse. +func (c *CreateResourceOperationResponse) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "results": + err = unpopulate(val, "Results", &c.Results) + 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 DeallocateResourceOperationResponse. func (d DeallocateResourceOperationResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -112,6 +147,80 @@ func (d *DeallocateResourceOperationResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DeleteResourceOperationResponse. +func (d DeleteResourceOperationResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", d.Description) + populate(objectMap, "location", d.Location) + populate(objectMap, "results", d.Results) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeleteResourceOperationResponse. +func (d *DeleteResourceOperationResponse) UnmarshalJSON(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 "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "results": + err = unpopulate(val, "Results", &d.Results) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + 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 ExecuteCreateRequest. +func (e ExecuteCreateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", e.Correlationid) + populate(objectMap, "executionParameters", e.ExecutionParameters) + populate(objectMap, "resourceConfigParameters", e.ResourceConfigParameters) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExecuteCreateRequest. +func (e *ExecuteCreateRequest) UnmarshalJSON(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 "correlationid": + err = unpopulate(val, "Correlationid", &e.Correlationid) + delete(rawMsg, key) + case "executionParameters": + err = unpopulate(val, "ExecutionParameters", &e.ExecutionParameters) + delete(rawMsg, key) + case "resourceConfigParameters": + err = unpopulate(val, "ResourceConfigParameters", &e.ResourceConfigParameters) + 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 ExecuteDeallocateRequest. func (e ExecuteDeallocateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -147,6 +256,45 @@ func (e *ExecuteDeallocateRequest) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ExecuteDeleteRequest. +func (e ExecuteDeleteRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", e.Correlationid) + populate(objectMap, "executionParameters", e.ExecutionParameters) + populate(objectMap, "forceDeletion", e.ForceDeletion) + populate(objectMap, "resources", e.Resources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExecuteDeleteRequest. +func (e *ExecuteDeleteRequest) UnmarshalJSON(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 "correlationid": + err = unpopulate(val, "Correlationid", &e.Correlationid) + delete(rawMsg, key) + case "executionParameters": + err = unpopulate(val, "ExecutionParameters", &e.ExecutionParameters) + delete(rawMsg, key) + case "forceDeletion": + err = unpopulate(val, "ForceDeletion", &e.ForceDeletion) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &e.Resources) + 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 ExecuteHibernateRequest. func (e ExecuteHibernateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -751,6 +899,45 @@ func (r *ResourceOperationError) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ResourceProvisionPayload. +func (r ResourceProvisionPayload) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "baseProfile", r.BaseProfile) + populate(objectMap, "resourceCount", r.ResourceCount) + populate(objectMap, "resourceOverrides", r.ResourceOverrides) + populate(objectMap, "resourcePrefix", r.ResourcePrefix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceProvisionPayload. +func (r *ResourceProvisionPayload) UnmarshalJSON(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 "baseProfile": + err = unpopulate(val, "BaseProfile", &r.BaseProfile) + delete(rawMsg, key) + case "resourceCount": + err = unpopulate(val, "ResourceCount", &r.ResourceCount) + delete(rawMsg, key) + case "resourceOverrides": + err = unpopulate(val, "ResourceOverrides", &r.ResourceOverrides) + delete(rawMsg, key) + case "resourcePrefix": + err = unpopulate(val, "ResourcePrefix", &r.ResourcePrefix) + 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 Resources. func (r Resources) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -891,6 +1078,45 @@ func (s *StartResourceOperationResponse) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SubmitCreateRequest. +func (s SubmitCreateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", s.Correlationid) + populate(objectMap, "executionParameters", s.ExecutionParameters) + populate(objectMap, "resourceConfigParameters", s.ResourceConfigParameters) + populate(objectMap, "schedule", s.Schedule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubmitCreateRequest. +func (s *SubmitCreateRequest) UnmarshalJSON(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 "correlationid": + err = unpopulate(val, "Correlationid", &s.Correlationid) + delete(rawMsg, key) + case "executionParameters": + err = unpopulate(val, "ExecutionParameters", &s.ExecutionParameters) + delete(rawMsg, key) + case "resourceConfigParameters": + err = unpopulate(val, "ResourceConfigParameters", &s.ResourceConfigParameters) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &s.Schedule) + 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 SubmitDeallocateRequest. func (s SubmitDeallocateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -930,6 +1156,49 @@ func (s *SubmitDeallocateRequest) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SubmitDeleteRequest. +func (s SubmitDeleteRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "correlationid", s.Correlationid) + populate(objectMap, "executionParameters", s.ExecutionParameters) + populate(objectMap, "forceDeletion", s.ForceDeletion) + populate(objectMap, "resources", s.Resources) + populate(objectMap, "schedule", s.Schedule) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubmitDeleteRequest. +func (s *SubmitDeleteRequest) UnmarshalJSON(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 "correlationid": + err = unpopulate(val, "Correlationid", &s.Correlationid) + delete(rawMsg, key) + case "executionParameters": + err = unpopulate(val, "ExecutionParameters", &s.ExecutionParameters) + delete(rawMsg, key) + case "forceDeletion": + err = unpopulate(val, "ForceDeletion", &s.ForceDeletion) + delete(rawMsg, key) + case "resources": + err = unpopulate(val, "Resources", &s.Resources) + delete(rawMsg, key) + case "schedule": + err = unpopulate(val, "Schedule", &s.Schedule) + 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 SubmitHibernateRequest. func (s SubmitHibernateRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client.go index 90c8dbfcfb1b..f6b3211656b7 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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 armcomputeschedule @@ -39,7 +35,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-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.ComputeSchedule/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client_example_test.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client_example_test.go index 95ee2e4dcf2e..4ff11862f7b9 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/operations_client_example_test.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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 armcomputeschedule_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/computeschedule/armcomputeschedule" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/Operations_List.json -func ExampleOperationsClient_NewListPager() { +// Generated from example definition: 2025-05-01/Operations_List_MaximumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) + clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,20 +33,53 @@ 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 = armcomputeschedule.OperationListResult{ - // Value: []*armcomputeschedule.Operation{ - // { - // Name: to.Ptr("mtiwosbky"), - // ActionType: to.Ptr(armcomputeschedule.ActionTypeInternal), - // Display: &armcomputeschedule.OperationDisplay{ - // Description: to.Ptr("moyje"), - // Operation: to.Ptr("tuneyqwanedwnnbztrmq"), - // Provider: to.Ptr("vtlhmqtfhlyllnplzpdpq"), - // Resource: to.Ptr("epj"), + // page = armcomputeschedule.OperationsClientListResponse{ + // OperationListResult: armcomputeschedule.OperationListResult{ + // Value: []*armcomputeschedule.Operation{ + // { + // Name: to.Ptr("ldqzcrujeitsnm"), + // IsDataAction: to.Ptr(true), + // Display: &armcomputeschedule.OperationDisplay{ + // Provider: to.Ptr("oxdxyfefyvtxexszpvt"), + // Resource: to.Ptr("icchvmkobgsviwonpruioyd"), + // Operation: to.Ptr("ibqrspiv"), + // Description: to.Ptr("gbqvalxlkg"), + // }, + // Origin: to.Ptr(armcomputeschedule.OriginUser), + // ActionType: to.Ptr(armcomputeschedule.ActionTypeInternal), // }, - // IsDataAction: to.Ptr(true), - // Origin: to.Ptr(armcomputeschedule.OriginUser), - // }}, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2025-05-01/Operations_List_MinimumSet_Gen.json +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.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 = armcomputeschedule.OperationsClientListResponse{ + // OperationListResult: armcomputeschedule.OperationListResult{ + // }, // } } } diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/options.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/options.go index 74458d76ce84..54fd5a281dd8 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/options.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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 armcomputeschedule @@ -19,12 +15,24 @@ type ScheduledActionsClientVirtualMachinesCancelOperationsOptions struct { // placeholder for future optional parameters } +// ScheduledActionsClientVirtualMachinesExecuteCreateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteCreate +// method. +type ScheduledActionsClientVirtualMachinesExecuteCreateOptions struct { + // placeholder for future optional parameters +} + // ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteDeallocate // method. type ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions struct { // placeholder for future optional parameters } +// ScheduledActionsClientVirtualMachinesExecuteDeleteOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteDelete +// method. +type ScheduledActionsClientVirtualMachinesExecuteDeleteOptions struct { + // placeholder for future optional parameters +} + // ScheduledActionsClientVirtualMachinesExecuteHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteHibernate // method. type ScheduledActionsClientVirtualMachinesExecuteHibernateOptions struct { @@ -49,12 +57,24 @@ type ScheduledActionsClientVirtualMachinesGetOperationStatusOptions struct { // placeholder for future optional parameters } +// ScheduledActionsClientVirtualMachinesSubmitCreateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitCreate +// method. +type ScheduledActionsClientVirtualMachinesSubmitCreateOptions struct { + // placeholder for future optional parameters +} + // ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitDeallocate // method. type ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions struct { // placeholder for future optional parameters } +// ScheduledActionsClientVirtualMachinesSubmitDeleteOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitDelete +// method. +type ScheduledActionsClientVirtualMachinesSubmitDeleteOptions struct { + // placeholder for future optional parameters +} + // ScheduledActionsClientVirtualMachinesSubmitHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitHibernate // method. type ScheduledActionsClientVirtualMachinesSubmitHibernateOptions struct { diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/responses.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/responses.go index 4f24350bc7d9..3b6285607717 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/responses.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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 armcomputeschedule @@ -20,12 +16,24 @@ type ScheduledActionsClientVirtualMachinesCancelOperationsResponse struct { CancelOperationsResponse } +// ScheduledActionsClientVirtualMachinesExecuteCreateResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteCreate. +type ScheduledActionsClientVirtualMachinesExecuteCreateResponse struct { + // The response from a create request + CreateResourceOperationResponse +} + // ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteDeallocate. type ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse struct { // The response from a deallocate request DeallocateResourceOperationResponse } +// ScheduledActionsClientVirtualMachinesExecuteDeleteResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteDelete. +type ScheduledActionsClientVirtualMachinesExecuteDeleteResponse struct { + // The response from a delete request + DeleteResourceOperationResponse +} + // ScheduledActionsClientVirtualMachinesExecuteHibernateResponse contains the response from method ScheduledActionsClient.VirtualMachinesExecuteHibernate. type ScheduledActionsClientVirtualMachinesExecuteHibernateResponse struct { // The response from a Hibernate request @@ -50,12 +58,24 @@ type ScheduledActionsClientVirtualMachinesGetOperationStatusResponse struct { GetOperationStatusResponse } +// ScheduledActionsClientVirtualMachinesSubmitCreateResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitCreate. +type ScheduledActionsClientVirtualMachinesSubmitCreateResponse struct { + // The response from a create request + CreateResourceOperationResponse +} + // ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitDeallocate. type ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse struct { // The response from a deallocate request DeallocateResourceOperationResponse } +// ScheduledActionsClientVirtualMachinesSubmitDeleteResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitDelete. +type ScheduledActionsClientVirtualMachinesSubmitDeleteResponse struct { + // The response from a delete request + DeleteResourceOperationResponse +} + // ScheduledActionsClientVirtualMachinesSubmitHibernateResponse contains the response from method ScheduledActionsClient.VirtualMachinesSubmitHibernate. type ScheduledActionsClientVirtualMachinesSubmitHibernateResponse struct { // The response from a Hibernate request diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client.go index 10d1780d4da3..a13aa9920c3d 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_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 armcomputeschedule @@ -47,7 +43,7 @@ func NewScheduledActionsClient(subscriptionID string, credential azcore.TokenCre // request // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesCancelOperationsOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesCancelOperations @@ -75,7 +71,7 @@ func (client *ScheduledActionsClient) VirtualMachinesCancelOperations(ctx contex } // virtualMachinesCancelOperationsCreateRequest creates the VirtualMachinesCancelOperations request. -func (client *ScheduledActionsClient) virtualMachinesCancelOperationsCreateRequest(ctx context.Context, locationparameter string, requestBody CancelOperationsRequest, options *ScheduledActionsClientVirtualMachinesCancelOperationsOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesCancelOperationsCreateRequest(ctx context.Context, locationparameter string, requestBody CancelOperationsRequest, _ *ScheduledActionsClientVirtualMachinesCancelOperationsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesCancelOperations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -90,9 +86,10 @@ func (client *ScheduledActionsClient) virtualMachinesCancelOperationsCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-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, requestBody); err != nil { return nil, err } @@ -108,11 +105,77 @@ func (client *ScheduledActionsClient) virtualMachinesCancelOperationsHandleRespo return result, nil } +// VirtualMachinesExecuteCreate - VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, +// this operation is triggered as soon as Computeschedule receives it. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-05-01 +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesExecuteCreateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteCreate +// method. +func (client *ScheduledActionsClient) VirtualMachinesExecuteCreate(ctx context.Context, locationparameter string, requestBody ExecuteCreateRequest, options *ScheduledActionsClientVirtualMachinesExecuteCreateOptions) (ScheduledActionsClientVirtualMachinesExecuteCreateResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesExecuteCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesExecuteCreateCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesExecuteCreateResponse{}, err + } + resp, err := client.virtualMachinesExecuteCreateHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesExecuteCreateCreateRequest creates the VirtualMachinesExecuteCreate request. +func (client *ScheduledActionsClient) virtualMachinesExecuteCreateCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteCreateRequest, _ *ScheduledActionsClientVirtualMachinesExecuteCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteCreate" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationparameter == "" { + return nil, errors.New("parameter locationparameter cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationparameter}", url.PathEscape(locationparameter)) + 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-05-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, requestBody); err != nil { + return nil, err + } + return req, nil +} + +// virtualMachinesExecuteCreateHandleResponse handles the VirtualMachinesExecuteCreate response. +func (client *ScheduledActionsClient) virtualMachinesExecuteCreateHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesExecuteCreateResponse, error) { + result := ScheduledActionsClientVirtualMachinesExecuteCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CreateResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesExecuteCreateResponse{}, err + } + return result, nil +} + // VirtualMachinesExecuteDeallocate - VirtualMachinesExecuteDeallocate: Execute deallocate operation for a batch of virtual // machines, this operation is triggered as soon as Computeschedule receives it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteDeallocate @@ -140,7 +203,7 @@ func (client *ScheduledActionsClient) VirtualMachinesExecuteDeallocate(ctx conte } // virtualMachinesExecuteDeallocateCreateRequest creates the VirtualMachinesExecuteDeallocate request. -func (client *ScheduledActionsClient) virtualMachinesExecuteDeallocateCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteDeallocateRequest, options *ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesExecuteDeallocateCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteDeallocateRequest, _ *ScheduledActionsClientVirtualMachinesExecuteDeallocateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDeallocate" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -155,9 +218,10 @@ func (client *ScheduledActionsClient) virtualMachinesExecuteDeallocateCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-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, requestBody); err != nil { return nil, err } @@ -173,11 +237,77 @@ func (client *ScheduledActionsClient) virtualMachinesExecuteDeallocateHandleResp return result, nil } +// VirtualMachinesExecuteDelete - VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, +// this operation is triggered as soon as Computeschedule receives it. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-05-01 +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesExecuteDeleteOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteDelete +// method. +func (client *ScheduledActionsClient) VirtualMachinesExecuteDelete(ctx context.Context, locationparameter string, requestBody ExecuteDeleteRequest, options *ScheduledActionsClientVirtualMachinesExecuteDeleteOptions) (ScheduledActionsClientVirtualMachinesExecuteDeleteResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesExecuteDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesExecuteDeleteCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesExecuteDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesExecuteDeleteResponse{}, err + } + resp, err := client.virtualMachinesExecuteDeleteHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesExecuteDeleteCreateRequest creates the VirtualMachinesExecuteDelete request. +func (client *ScheduledActionsClient) virtualMachinesExecuteDeleteCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteDeleteRequest, _ *ScheduledActionsClientVirtualMachinesExecuteDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDelete" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationparameter == "" { + return nil, errors.New("parameter locationparameter cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationparameter}", url.PathEscape(locationparameter)) + 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-05-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, requestBody); err != nil { + return nil, err + } + return req, nil +} + +// virtualMachinesExecuteDeleteHandleResponse handles the VirtualMachinesExecuteDelete response. +func (client *ScheduledActionsClient) virtualMachinesExecuteDeleteHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesExecuteDeleteResponse, error) { + result := ScheduledActionsClientVirtualMachinesExecuteDeleteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeleteResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesExecuteDeleteResponse{}, err + } + return result, nil +} + // VirtualMachinesExecuteHibernate - VirtualMachinesExecuteHibernate: Execute hibernate operation for a batch of virtual machines, // this operation is triggered as soon as Computeschedule receives it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesExecuteHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteHibernate @@ -205,7 +335,7 @@ func (client *ScheduledActionsClient) VirtualMachinesExecuteHibernate(ctx contex } // virtualMachinesExecuteHibernateCreateRequest creates the VirtualMachinesExecuteHibernate request. -func (client *ScheduledActionsClient) virtualMachinesExecuteHibernateCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteHibernateRequest, options *ScheduledActionsClientVirtualMachinesExecuteHibernateOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesExecuteHibernateCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteHibernateRequest, _ *ScheduledActionsClientVirtualMachinesExecuteHibernateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteHibernate" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -220,9 +350,10 @@ func (client *ScheduledActionsClient) virtualMachinesExecuteHibernateCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-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, requestBody); err != nil { return nil, err } @@ -242,7 +373,7 @@ func (client *ScheduledActionsClient) virtualMachinesExecuteHibernateHandleRespo // operation is triggered as soon as Computeschedule receives it. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesExecuteStartOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesExecuteStart @@ -270,7 +401,7 @@ func (client *ScheduledActionsClient) VirtualMachinesExecuteStart(ctx context.Co } // virtualMachinesExecuteStartCreateRequest creates the VirtualMachinesExecuteStart request. -func (client *ScheduledActionsClient) virtualMachinesExecuteStartCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteStartRequest, options *ScheduledActionsClientVirtualMachinesExecuteStartOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesExecuteStartCreateRequest(ctx context.Context, locationparameter string, requestBody ExecuteStartRequest, _ *ScheduledActionsClientVirtualMachinesExecuteStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteStart" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -285,9 +416,10 @@ func (client *ScheduledActionsClient) virtualMachinesExecuteStartCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-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, requestBody); err != nil { return nil, err } @@ -307,7 +439,7 @@ func (client *ScheduledActionsClient) virtualMachinesExecuteStartHandleResponse( // errors encountered, additional logs) if they exist. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesGetOperationErrorsOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesGetOperationErrors @@ -335,7 +467,7 @@ func (client *ScheduledActionsClient) VirtualMachinesGetOperationErrors(ctx cont } // virtualMachinesGetOperationErrorsCreateRequest creates the VirtualMachinesGetOperationErrors request. -func (client *ScheduledActionsClient) virtualMachinesGetOperationErrorsCreateRequest(ctx context.Context, locationparameter string, requestBody GetOperationErrorsRequest, options *ScheduledActionsClientVirtualMachinesGetOperationErrorsOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesGetOperationErrorsCreateRequest(ctx context.Context, locationparameter string, requestBody GetOperationErrorsRequest, _ *ScheduledActionsClientVirtualMachinesGetOperationErrorsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesGetOperationErrors" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -350,9 +482,10 @@ func (client *ScheduledActionsClient) virtualMachinesGetOperationErrorsCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-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, requestBody); err != nil { return nil, err } @@ -372,7 +505,7 @@ func (client *ScheduledActionsClient) virtualMachinesGetOperationErrorsHandleRes // on virtual machines // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesGetOperationStatusOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesGetOperationStatus @@ -400,7 +533,7 @@ func (client *ScheduledActionsClient) VirtualMachinesGetOperationStatus(ctx cont } // virtualMachinesGetOperationStatusCreateRequest creates the VirtualMachinesGetOperationStatus request. -func (client *ScheduledActionsClient) virtualMachinesGetOperationStatusCreateRequest(ctx context.Context, locationparameter string, requestBody GetOperationStatusRequest, options *ScheduledActionsClientVirtualMachinesGetOperationStatusOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesGetOperationStatusCreateRequest(ctx context.Context, locationparameter string, requestBody GetOperationStatusRequest, _ *ScheduledActionsClientVirtualMachinesGetOperationStatusOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesGetOperationStatus" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -415,9 +548,10 @@ func (client *ScheduledActionsClient) virtualMachinesGetOperationStatusCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-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, requestBody); err != nil { return nil, err } @@ -433,11 +567,77 @@ func (client *ScheduledActionsClient) virtualMachinesGetOperationStatusHandleRes return result, nil } +// VirtualMachinesSubmitCreate - VirtualMachinesSubmitCreate: submit create operation for a batch of virtual machines, at +// datetime in future. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-05-01 +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesSubmitCreateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitCreate +// method. +func (client *ScheduledActionsClient) VirtualMachinesSubmitCreate(ctx context.Context, locationparameter string, requestBody SubmitCreateRequest, options *ScheduledActionsClientVirtualMachinesSubmitCreateOptions) (ScheduledActionsClientVirtualMachinesSubmitCreateResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesSubmitCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesSubmitCreateCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesSubmitCreateResponse{}, err + } + resp, err := client.virtualMachinesSubmitCreateHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesSubmitCreateCreateRequest creates the VirtualMachinesSubmitCreate request. +func (client *ScheduledActionsClient) virtualMachinesSubmitCreateCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitCreateRequest, _ *ScheduledActionsClientVirtualMachinesSubmitCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitCreate" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationparameter == "" { + return nil, errors.New("parameter locationparameter cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationparameter}", url.PathEscape(locationparameter)) + 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-05-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, requestBody); err != nil { + return nil, err + } + return req, nil +} + +// virtualMachinesSubmitCreateHandleResponse handles the VirtualMachinesSubmitCreate response. +func (client *ScheduledActionsClient) virtualMachinesSubmitCreateHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesSubmitCreateResponse, error) { + result := ScheduledActionsClientVirtualMachinesSubmitCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CreateResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesSubmitCreateResponse{}, err + } + return result, nil +} + // VirtualMachinesSubmitDeallocate - VirtualMachinesSubmitDeallocate: Schedule deallocate operation for a batch of virtual // machines at datetime in future. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitDeallocate @@ -465,7 +665,7 @@ func (client *ScheduledActionsClient) VirtualMachinesSubmitDeallocate(ctx contex } // virtualMachinesSubmitDeallocateCreateRequest creates the VirtualMachinesSubmitDeallocate request. -func (client *ScheduledActionsClient) virtualMachinesSubmitDeallocateCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitDeallocateRequest, options *ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesSubmitDeallocateCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitDeallocateRequest, _ *ScheduledActionsClientVirtualMachinesSubmitDeallocateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitDeallocate" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -480,9 +680,10 @@ func (client *ScheduledActionsClient) virtualMachinesSubmitDeallocateCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-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, requestBody); err != nil { return nil, err } @@ -498,11 +699,77 @@ func (client *ScheduledActionsClient) virtualMachinesSubmitDeallocateHandleRespo return result, nil } +// VirtualMachinesSubmitDelete - VirtualMachinesSubmitDelete: submit delete operation for a batch of virtual machines, at +// datetime in future. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-05-01 +// - locationparameter - The location name. +// - requestBody - The request body +// - options - ScheduledActionsClientVirtualMachinesSubmitDeleteOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitDelete +// method. +func (client *ScheduledActionsClient) VirtualMachinesSubmitDelete(ctx context.Context, locationparameter string, requestBody SubmitDeleteRequest, options *ScheduledActionsClientVirtualMachinesSubmitDeleteOptions) (ScheduledActionsClientVirtualMachinesSubmitDeleteResponse, error) { + var err error + const operationName = "ScheduledActionsClient.VirtualMachinesSubmitDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.virtualMachinesSubmitDeleteCreateRequest(ctx, locationparameter, requestBody, options) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ScheduledActionsClientVirtualMachinesSubmitDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ScheduledActionsClientVirtualMachinesSubmitDeleteResponse{}, err + } + resp, err := client.virtualMachinesSubmitDeleteHandleResponse(httpResp) + return resp, err +} + +// virtualMachinesSubmitDeleteCreateRequest creates the VirtualMachinesSubmitDelete request. +func (client *ScheduledActionsClient) virtualMachinesSubmitDeleteCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitDeleteRequest, _ *ScheduledActionsClientVirtualMachinesSubmitDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitDelete" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if locationparameter == "" { + return nil, errors.New("parameter locationparameter cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{locationparameter}", url.PathEscape(locationparameter)) + 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-05-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, requestBody); err != nil { + return nil, err + } + return req, nil +} + +// virtualMachinesSubmitDeleteHandleResponse handles the VirtualMachinesSubmitDelete response. +func (client *ScheduledActionsClient) virtualMachinesSubmitDeleteHandleResponse(resp *http.Response) (ScheduledActionsClientVirtualMachinesSubmitDeleteResponse, error) { + result := ScheduledActionsClientVirtualMachinesSubmitDeleteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DeleteResourceOperationResponse); err != nil { + return ScheduledActionsClientVirtualMachinesSubmitDeleteResponse{}, err + } + return result, nil +} + // VirtualMachinesSubmitHibernate - VirtualMachinesSubmitHibernate: Schedule hibernate operation for a batch of virtual machines // at datetime in future. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesSubmitHibernateOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitHibernate @@ -530,7 +797,7 @@ func (client *ScheduledActionsClient) VirtualMachinesSubmitHibernate(ctx context } // virtualMachinesSubmitHibernateCreateRequest creates the VirtualMachinesSubmitHibernate request. -func (client *ScheduledActionsClient) virtualMachinesSubmitHibernateCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitHibernateRequest, options *ScheduledActionsClientVirtualMachinesSubmitHibernateOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesSubmitHibernateCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitHibernateRequest, _ *ScheduledActionsClientVirtualMachinesSubmitHibernateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitHibernate" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -545,9 +812,10 @@ func (client *ScheduledActionsClient) virtualMachinesSubmitHibernateCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-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, requestBody); err != nil { return nil, err } @@ -567,7 +835,7 @@ func (client *ScheduledActionsClient) virtualMachinesSubmitHibernateHandleRespon // in future. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-10-01 +// Generated from API version 2025-05-01 // - locationparameter - The location name. // - requestBody - The request body // - options - ScheduledActionsClientVirtualMachinesSubmitStartOptions contains the optional parameters for the ScheduledActionsClient.VirtualMachinesSubmitStart @@ -595,7 +863,7 @@ func (client *ScheduledActionsClient) VirtualMachinesSubmitStart(ctx context.Con } // virtualMachinesSubmitStartCreateRequest creates the VirtualMachinesSubmitStart request. -func (client *ScheduledActionsClient) virtualMachinesSubmitStartCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitStartRequest, options *ScheduledActionsClientVirtualMachinesSubmitStartOptions) (*policy.Request, error) { +func (client *ScheduledActionsClient) virtualMachinesSubmitStartCreateRequest(ctx context.Context, locationparameter string, requestBody SubmitStartRequest, _ *ScheduledActionsClientVirtualMachinesSubmitStartOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesSubmitStart" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -610,9 +878,10 @@ func (client *ScheduledActionsClient) virtualMachinesSubmitStartCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-10-01") + reqQP.Set("api-version", "2025-05-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, requestBody); err != nil { return nil, err } diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client_example_test.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client_example_test.go index b9fd4877476e..be9b5e81f3ff 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client_example_test.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/scheduledactions_client_example_test.go @@ -1,40 +1,34 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights 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 armcomputeschedule_test import ( "context" - "log" - - "time" - "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/computeschedule/armcomputeschedule" + "log" + "time" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesCancelOperations.json -func ExampleScheduledActionsClient_VirtualMachinesCancelOperations() { +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesCancelOperations_MaximumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesCancelOperations_scheduledActionsVirtualMachinesCancelOperationsMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesCancelOperations(ctx, "eastus2euap", armcomputeschedule.CancelOperationsRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-gg25eec1f34r"), + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesCancelOperations(ctx, "hwrogamrxmqmbhyksvvbpge", armcomputeschedule.CancelOperationsRequest{ OperationIDs: []*string{ - to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r")}, + to.Ptr("rcudibq"), + }, + Correlationid: to.Ptr("lacjacfbxixdmg"), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -42,59 +36,200 @@ func ExampleScheduledActionsClient_VirtualMachinesCancelOperations() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CancelOperationsResponse = armcomputeschedule.CancelOperationsResponse{ - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeDeallocate), + // res = armcomputeschedule.ScheduledActionsClientVirtualMachinesCancelOperationsResponse{ + // CancelOperationsResponse: &armcomputeschedule.CancelOperationsResponse{ + // Results: []*armcomputeschedule.ResourceOperation{ + // { // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), + // ErrorCode: to.Ptr("ynukyltendgmn"), + // ErrorDetails: to.Ptr("tifeuh"), + // Operation: &armcomputeschedule.ResourceOperationDetails{ + // OperationID: to.Ptr("vppyaxq"), + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown), + // SubscriptionID: to.Ptr("vofvsus"), + // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + // State: to.Ptr(armcomputeschedule.OperationStateUnknown), + // Timezone: to.Ptr("nwugsooykqggcokphgdj"), + // TimeZone: to.Ptr("qkxnxnumvfqmsmpyccv"), + // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ + // ErrorCode: to.Ptr("fagfsojftlff"), + // ErrorDetails: to.Ptr("rtihrkjasrjkllqccuysjrg"), + // }, + // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // RetryPolicy: &armcomputeschedule.RetryPolicy{ + // RetryCount: to.Ptr[int32](25), + // RetryWindowInMinutes: to.Ptr[int32](4), + // }, // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](4), - // RetryWindowInMinutes: to.Ptr[int32](27), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesCancelOperations_MinimumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesCancelOperations_scheduledActionsVirtualMachinesCancelOperationsMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesCancelOperations(ctx, "pitwczrefdkzfrpphvbqrvbavgnfxl", armcomputeschedule.CancelOperationsRequest{ + OperationIDs: []*string{ + to.Ptr("rcudibq"), + }, + Correlationid: to.Ptr("lacjacfbxixdmg"), + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesCancelOperationsResponse{ + // CancelOperationsResponse: &armcomputeschedule.CancelOperationsResponse{ + // Results: []*armcomputeschedule.ResourceOperation{ + // { + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteCreate_MaximumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesExecuteCreate_scheduledActionsVirtualMachinesExecuteCreateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteCreate(ctx, "nxbiupqfkijjq", armcomputeschedule.ExecuteCreateRequest{ + ResourceConfigParameters: &armcomputeschedule.ResourceProvisionPayload{ + BaseProfile: to.Ptr("tfgrulcuneopmbdjydzofmhpa"), + ResourceOverrides: []*string{ + to.Ptr("hsqtjgsobjaffl"), + }, + ResourceCount: to.Ptr[int32](28), + ResourcePrefix: to.Ptr("rqlxavviucrxfjj"), + }, + ExecutionParameters: &armcomputeschedule.ExecutionParameters{ + OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost), + RetryPolicy: &armcomputeschedule.RetryPolicy{ + RetryCount: to.Ptr[int32](25), + RetryWindowInMinutes: to.Ptr[int32](4), + }, + }, + Correlationid: to.Ptr("erpswvxajdpqgxfpgmzy"), + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteCreateResponse{ + // CreateResourceOperationResponse: &armcomputeschedule.CreateResourceOperationResponse{ + // Type: to.Ptr("avmbqoatro"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Results: []*armcomputeschedule.ResourceOperation{ + // { + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // ErrorCode: to.Ptr("ynukyltendgmn"), + // ErrorDetails: to.Ptr("tifeuh"), + // Operation: &armcomputeschedule.ResourceOperationDetails{ + // OperationID: to.Ptr("vppyaxq"), + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown), + // SubscriptionID: to.Ptr("vofvsus"), + // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + // State: to.Ptr(armcomputeschedule.OperationStateUnknown), + // Timezone: to.Ptr("nwugsooykqggcokphgdj"), + // TimeZone: to.Ptr("qkxnxnumvfqmsmpyccv"), + // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ + // ErrorCode: to.Ptr("fagfsojftlff"), + // ErrorDetails: to.Ptr("rtihrkjasrjkllqccuysjrg"), + // }, + // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // RetryPolicy: &armcomputeschedule.RetryPolicy{ + // RetryCount: to.Ptr[int32](25), + // RetryWindowInMinutes: to.Ptr[int32](4), + // }, // }, - // State: to.Ptr(armcomputeschedule.OperationStateCancelled), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, + // }, + // Description: to.Ptr("plfajalcmjcxmfuvsbnnoabdqxclto"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesExecuteDeallocate.json -func ExampleScheduledActionsClient_VirtualMachinesExecuteDeallocate() { +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteCreate_MinimumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesExecuteCreate_scheduledActionsVirtualMachinesExecuteCreateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteDeallocate(ctx, "eastus2euap", armcomputeschedule.ExecuteDeallocateRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteCreate(ctx, "aiqyytlqsikciuxzocihxb", armcomputeschedule.ExecuteCreateRequest{ + ResourceConfigParameters: &armcomputeschedule.ResourceProvisionPayload{ + ResourceCount: to.Ptr[int32](28), + }, + ExecutionParameters: &armcomputeschedule.ExecutionParameters{}, + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteCreateResponse{ + // CreateResourceOperationResponse: &armcomputeschedule.CreateResourceOperationResponse{ + // Type: to.Ptr("avmbqoatro"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Description: to.Ptr("plfajalcmjcxmfuvsbnnoabdqxclto"), + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteDeallocate_MaximumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesExecuteDeallocate_scheduledActionsVirtualMachinesExecuteDeallocateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteDeallocate(ctx, "ykpowbmjexmsv", armcomputeschedule.ExecuteDeallocateRequest{ ExecutionParameters: &armcomputeschedule.ExecutionParameters{ + OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost), RetryPolicy: &armcomputeschedule.RetryPolicy{ - RetryCount: to.Ptr[int32](4), - RetryWindowInMinutes: to.Ptr[int32](27), + RetryCount: to.Ptr[int32](25), + RetryWindowInMinutes: to.Ptr[int32](4), }, }, Resources: &armcomputeschedule.Resources{ IDs: []*string{ - to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")}, + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, }, + Correlationid: to.Ptr("dsszhmrdsczkv"), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -102,62 +237,103 @@ func ExampleScheduledActionsClient_VirtualMachinesExecuteDeallocate() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeallocateResourceOperationResponse = armcomputeschedule.DeallocateResourceOperationResponse{ - // Type: to.Ptr("VirtualMachine"), - // Description: to.Ptr("Deallocate Resource Request"), - // Location: to.Ptr("eastus2euap"), - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeDeallocate), + // res = armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse{ + // DeallocateResourceOperationResponse: &armcomputeschedule.DeallocateResourceOperationResponse{ + // Type: to.Ptr("fpnhqvrtbqizlylnwy"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Results: []*armcomputeschedule.ResourceOperation{ + // { // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), + // ErrorCode: to.Ptr("ynukyltendgmn"), + // ErrorDetails: to.Ptr("tifeuh"), + // Operation: &armcomputeschedule.ResourceOperationDetails{ + // OperationID: to.Ptr("vppyaxq"), + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown), + // SubscriptionID: to.Ptr("vofvsus"), + // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + // State: to.Ptr(armcomputeschedule.OperationStateUnknown), + // Timezone: to.Ptr("nwugsooykqggcokphgdj"), + // TimeZone: to.Ptr("qkxnxnumvfqmsmpyccv"), + // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ + // ErrorCode: to.Ptr("fagfsojftlff"), + // ErrorDetails: to.Ptr("rtihrkjasrjkllqccuysjrg"), + // }, + // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // RetryPolicy: &armcomputeschedule.RetryPolicy{ + // RetryCount: to.Ptr[int32](25), + // RetryWindowInMinutes: to.Ptr[int32](4), + // }, // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](4), - // RetryWindowInMinutes: to.Ptr[int32](27), - // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, + // }, + // Description: to.Ptr("zknbxgebvymhzzmsbrlaqreub"), + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteDeallocate_MinimumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesExecuteDeallocate_scheduledActionsVirtualMachinesExecuteDeallocateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteDeallocate(ctx, "bfldnxffvllwvqa", armcomputeschedule.ExecuteDeallocateRequest{ + ExecutionParameters: &armcomputeschedule.ExecutionParameters{}, + Resources: &armcomputeschedule.Resources{ + IDs: []*string{ + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, + }, + Correlationid: to.Ptr("dsszhmrdsczkv"), + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteDeallocateResponse{ + // DeallocateResourceOperationResponse: &armcomputeschedule.DeallocateResourceOperationResponse{ + // Type: to.Ptr("fpnhqvrtbqizlylnwy"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Description: to.Ptr("zknbxgebvymhzzmsbrlaqreub"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesExecuteHibernate.json -func ExampleScheduledActionsClient_VirtualMachinesExecuteHibernate() { +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteDelete_MaximumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesExecuteDelete_scheduledActionsVirtualMachinesExecuteDeleteMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteHibernate(ctx, "eastus2euap", armcomputeschedule.ExecuteHibernateRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteDelete(ctx, "yrngwxkxxxbifqyc", armcomputeschedule.ExecuteDeleteRequest{ ExecutionParameters: &armcomputeschedule.ExecutionParameters{ + OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost), RetryPolicy: &armcomputeschedule.RetryPolicy{ - RetryCount: to.Ptr[int32](5), - RetryWindowInMinutes: to.Ptr[int32](27), + RetryCount: to.Ptr[int32](25), + RetryWindowInMinutes: to.Ptr[int32](4), }, }, Resources: &armcomputeschedule.Resources{ IDs: []*string{ - to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")}, + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, }, + Correlationid: to.Ptr("lgxsiioaybtjexssjzw"), + ForceDeletion: to.Ptr(true), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -165,62 +341,204 @@ func ExampleScheduledActionsClient_VirtualMachinesExecuteHibernate() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HibernateResourceOperationResponse = armcomputeschedule.HibernateResourceOperationResponse{ - // Type: to.Ptr("VirtualMachine"), - // Description: to.Ptr("Hibernate Resource Request"), - // Location: to.Ptr("eastus2euap"), - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeHibernate), + // res = armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteDeleteResponse{ + // DeleteResourceOperationResponse: &armcomputeschedule.DeleteResourceOperationResponse{ + // Type: to.Ptr("tauhekvwziataptcsyqtfpq"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Results: []*armcomputeschedule.ResourceOperation{ + // { // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), + // ErrorCode: to.Ptr("ynukyltendgmn"), + // ErrorDetails: to.Ptr("tifeuh"), + // Operation: &armcomputeschedule.ResourceOperationDetails{ + // OperationID: to.Ptr("vppyaxq"), + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown), + // SubscriptionID: to.Ptr("vofvsus"), + // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + // State: to.Ptr(armcomputeschedule.OperationStateUnknown), + // Timezone: to.Ptr("nwugsooykqggcokphgdj"), + // TimeZone: to.Ptr("qkxnxnumvfqmsmpyccv"), + // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ + // ErrorCode: to.Ptr("fagfsojftlff"), + // ErrorDetails: to.Ptr("rtihrkjasrjkllqccuysjrg"), + // }, + // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // RetryPolicy: &armcomputeschedule.RetryPolicy{ + // RetryCount: to.Ptr[int32](25), + // RetryWindowInMinutes: to.Ptr[int32](4), + // }, // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](5), - // RetryWindowInMinutes: to.Ptr[int32](27), + // }, + // }, + // Description: to.Ptr("fxgbwqglaskyb"), + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteDelete_MinimumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesExecuteDelete_scheduledActionsVirtualMachinesExecuteDeleteMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteDelete(ctx, "urzqnogieubgnjsyadipeyqegdomtm", armcomputeschedule.ExecuteDeleteRequest{ + ExecutionParameters: &armcomputeschedule.ExecutionParameters{}, + Resources: &armcomputeschedule.Resources{ + IDs: []*string{ + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, + }, + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteDeleteResponse{ + // DeleteResourceOperationResponse: &armcomputeschedule.DeleteResourceOperationResponse{ + // Type: to.Ptr("tauhekvwziataptcsyqtfpq"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Description: to.Ptr("fxgbwqglaskyb"), + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteHibernate_MaximumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesExecuteHibernate_scheduledActionsVirtualMachinesExecuteHibernateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteHibernate(ctx, "aojgnzdqrphhygchir", armcomputeschedule.ExecuteHibernateRequest{ + ExecutionParameters: &armcomputeschedule.ExecutionParameters{ + OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost), + RetryPolicy: &armcomputeschedule.RetryPolicy{ + RetryCount: to.Ptr[int32](25), + RetryWindowInMinutes: to.Ptr[int32](4), + }, + }, + Resources: &armcomputeschedule.Resources{ + IDs: []*string{ + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, + }, + Correlationid: to.Ptr("jmdiz"), + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteHibernateResponse{ + // HibernateResourceOperationResponse: &armcomputeschedule.HibernateResourceOperationResponse{ + // Type: to.Ptr("yrmuumqaqiyotst"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Results: []*armcomputeschedule.ResourceOperation{ + // { + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // ErrorCode: to.Ptr("ynukyltendgmn"), + // ErrorDetails: to.Ptr("tifeuh"), + // Operation: &armcomputeschedule.ResourceOperationDetails{ + // OperationID: to.Ptr("vppyaxq"), + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown), + // SubscriptionID: to.Ptr("vofvsus"), + // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + // State: to.Ptr(armcomputeschedule.OperationStateUnknown), + // Timezone: to.Ptr("nwugsooykqggcokphgdj"), + // TimeZone: to.Ptr("qkxnxnumvfqmsmpyccv"), + // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ + // ErrorCode: to.Ptr("fagfsojftlff"), + // ErrorDetails: to.Ptr("rtihrkjasrjkllqccuysjrg"), + // }, + // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // RetryPolicy: &armcomputeschedule.RetryPolicy{ + // RetryCount: to.Ptr[int32](25), + // RetryWindowInMinutes: to.Ptr[int32](4), + // }, // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, + // }, + // Description: to.Ptr("ogyqdzdslyvxslrykb"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesExecuteStart.json -func ExampleScheduledActionsClient_VirtualMachinesExecuteStart() { +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteHibernate_MinimumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesExecuteHibernate_scheduledActionsVirtualMachinesExecuteHibernateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteStart(ctx, "eastus2euap", armcomputeschedule.ExecuteStartRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteHibernate(ctx, "gmflbqliyjrhmrjvqrxrgocbxzjr", armcomputeschedule.ExecuteHibernateRequest{ + ExecutionParameters: &armcomputeschedule.ExecutionParameters{}, + Resources: &armcomputeschedule.Resources{ + IDs: []*string{ + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, + }, + Correlationid: to.Ptr("jmdiz"), + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteHibernateResponse{ + // HibernateResourceOperationResponse: &armcomputeschedule.HibernateResourceOperationResponse{ + // Type: to.Ptr("yrmuumqaqiyotst"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Description: to.Ptr("ogyqdzdslyvxslrykb"), + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteStart_MaximumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesExecuteStart_scheduledActionsVirtualMachinesExecuteStartMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteStart(ctx, "jwybvpf", armcomputeschedule.ExecuteStartRequest{ ExecutionParameters: &armcomputeschedule.ExecutionParameters{ + OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost), RetryPolicy: &armcomputeschedule.RetryPolicy{ - RetryCount: to.Ptr[int32](2), - RetryWindowInMinutes: to.Ptr[int32](27), + RetryCount: to.Ptr[int32](25), + RetryWindowInMinutes: to.Ptr[int32](4), }, }, Resources: &armcomputeschedule.Resources{ IDs: []*string{ - to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")}, + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, }, + Correlationid: to.Ptr("vwpcrwowcfgjuwnxzvvdma"), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -228,53 +546,140 @@ func ExampleScheduledActionsClient_VirtualMachinesExecuteStart() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StartResourceOperationResponse = armcomputeschedule.StartResourceOperationResponse{ - // Type: to.Ptr("virtualMachine"), - // Description: to.Ptr("Start Resource Request"), - // Location: to.Ptr("eastus2euap"), - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeStart), + // res = armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteStartResponse{ + // StartResourceOperationResponse: &armcomputeschedule.StartResourceOperationResponse{ + // Type: to.Ptr("lcikdomhndewkiqpf"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Results: []*armcomputeschedule.ResourceOperation{ + // { // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), + // ErrorCode: to.Ptr("ynukyltendgmn"), + // ErrorDetails: to.Ptr("tifeuh"), + // Operation: &armcomputeschedule.ResourceOperationDetails{ + // OperationID: to.Ptr("vppyaxq"), + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown), + // SubscriptionID: to.Ptr("vofvsus"), + // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + // State: to.Ptr(armcomputeschedule.OperationStateUnknown), + // Timezone: to.Ptr("nwugsooykqggcokphgdj"), + // TimeZone: to.Ptr("qkxnxnumvfqmsmpyccv"), + // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ + // ErrorCode: to.Ptr("fagfsojftlff"), + // ErrorDetails: to.Ptr("rtihrkjasrjkllqccuysjrg"), + // }, + // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // RetryPolicy: &armcomputeschedule.RetryPolicy{ + // RetryCount: to.Ptr[int32](25), + // RetryWindowInMinutes: to.Ptr[int32](4), + // }, // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](2), - // RetryWindowInMinutes: to.Ptr[int32](27), + // }, + // }, + // Description: to.Ptr("mqfxdgracoxwwpoegjryov"), + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteStart_MinimumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesExecuteStart_scheduledActionsVirtualMachinesExecuteStartMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesExecuteStart(ctx, "ksfzuak", armcomputeschedule.ExecuteStartRequest{ + ExecutionParameters: &armcomputeschedule.ExecutionParameters{}, + Resources: &armcomputeschedule.Resources{ + IDs: []*string{ + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, + }, + Correlationid: to.Ptr("vwpcrwowcfgjuwnxzvvdma"), + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesExecuteStartResponse{ + // StartResourceOperationResponse: &armcomputeschedule.StartResourceOperationResponse{ + // Type: to.Ptr("lcikdomhndewkiqpf"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Description: to.Ptr("mqfxdgracoxwwpoegjryov"), + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesGetOperationErrors_MaximumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesGetOperationErrors_scheduledActionsVirtualMachinesGetOperationErrorsMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesGetOperationErrors(ctx, "paluwjjcxtjeozpoxrnstls", armcomputeschedule.GetOperationErrorsRequest{ + OperationIDs: []*string{ + to.Ptr("ksufjznokhsbowdupyt"), + }, + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesGetOperationErrorsResponse{ + // GetOperationErrorsResponse: &armcomputeschedule.GetOperationErrorsResponse{ + // Results: []*armcomputeschedule.OperationErrorsResult{ + // { + // OperationID: to.Ptr("emftjglfbsxaboxqzxlpbjian"), + // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.130Z"); return t}()), + // ActivationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.130Z"); return t}()), + // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.130Z"); return t}()), + // OperationErrors: []*armcomputeschedule.OperationErrorDetails{ + // { + // ErrorCode: to.Ptr("awrovoihpnqsotznapyrrb"), + // ErrorDetails: to.Ptr("af"), + // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.131Z"); return t}()), + // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.131Z"); return t}()), + // AzureOperationName: to.Ptr("ipsoybbslitmwsfkygfjhb"), + // CrpOperationID: to.Ptr("cqkmbfb"), + // }, // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), + // RequestErrorCode: to.Ptr("vzixjphgeygyhzpbbkgzcjol"), + // RequestErrorDetails: to.Ptr("ficjafazcvbmlbnqhffwtevkla"), // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, + // }, + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesGetOperationErrors.json -func ExampleScheduledActionsClient_VirtualMachinesGetOperationErrors() { +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesGetOperationErrors_MinimumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesGetOperationErrors_scheduledActionsVirtualMachinesGetOperationErrorsMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesGetOperationErrors(ctx, "eastus2euap", armcomputeschedule.GetOperationErrorsRequest{ + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesGetOperationErrors(ctx, "nqwtkslhoamsmxucgbljcz", armcomputeschedule.GetOperationErrorsRequest{ OperationIDs: []*string{ - to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r")}, + to.Ptr("ksufjznokhsbowdupyt"), + }, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -282,43 +687,32 @@ func ExampleScheduledActionsClient_VirtualMachinesGetOperationErrors() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GetOperationErrorsResponse = armcomputeschedule.GetOperationErrorsResponse{ - // Results: []*armcomputeschedule.OperationErrorsResult{ - // { - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // ActivationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.999Z"); return t}()), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.999Z"); return t}()), - // CreationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.999Z"); return t}()), - // OperationErrors: []*armcomputeschedule.OperationErrorDetails{ - // { - // AzureOperationName: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CrpOperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // TimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-27T16:55:03.357Z"); return t}()), - // Timestamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.999Z"); return t}()), - // }}, - // RequestErrorCode: to.Ptr("null"), - // RequestErrorDetails: to.Ptr("null"), - // }}, + // res = armcomputeschedule.ScheduledActionsClientVirtualMachinesGetOperationErrorsResponse{ + // GetOperationErrorsResponse: &armcomputeschedule.GetOperationErrorsResponse{ + // Results: []*armcomputeschedule.OperationErrorsResult{ + // { + // }, + // }, + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesGetOperationStatus.json -func ExampleScheduledActionsClient_VirtualMachinesGetOperationStatus() { +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesGetOperationStatus_MaximumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesGetOperationStatus_scheduledActionsVirtualMachinesGetOperationStatusMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesGetOperationStatus(ctx, "eastus2euap", armcomputeschedule.GetOperationStatusRequest{ - Correlationid: to.Ptr("35780d2f-1dca-4610-afb4-dd25eec1f34r"), + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesGetOperationStatus(ctx, "xzbxygykutmvmxpfowdai", armcomputeschedule.GetOperationStatusRequest{ OperationIDs: []*string{ - to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r")}, + to.Ptr("hswzfrierpxdgcuu"), + }, + Correlationid: to.Ptr("jtlszorevrftvfhnqoxlwpiwcbmj"), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -326,64 +720,216 @@ func ExampleScheduledActionsClient_VirtualMachinesGetOperationStatus() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GetOperationStatusResponse = armcomputeschedule.GetOperationStatusResponse{ - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeDeallocate), + // res = armcomputeschedule.ScheduledActionsClientVirtualMachinesGetOperationStatusResponse{ + // GetOperationStatusResponse: &armcomputeschedule.GetOperationStatusResponse{ + // Results: []*armcomputeschedule.ResourceOperation{ + // { // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), + // ErrorCode: to.Ptr("ynukyltendgmn"), + // ErrorDetails: to.Ptr("tifeuh"), + // Operation: &armcomputeschedule.ResourceOperationDetails{ + // OperationID: to.Ptr("vppyaxq"), + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown), + // SubscriptionID: to.Ptr("vofvsus"), + // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + // State: to.Ptr(armcomputeschedule.OperationStateUnknown), + // Timezone: to.Ptr("nwugsooykqggcokphgdj"), + // TimeZone: to.Ptr("qkxnxnumvfqmsmpyccv"), + // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ + // ErrorCode: to.Ptr("fagfsojftlff"), + // ErrorDetails: to.Ptr("rtihrkjasrjkllqccuysjrg"), + // }, + // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // RetryPolicy: &armcomputeschedule.RetryPolicy{ + // RetryCount: to.Ptr[int32](25), + // RetryWindowInMinutes: to.Ptr[int32](4), + // }, // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](4), - // RetryWindowInMinutes: to.Ptr[int32](27), + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesGetOperationStatus_MinimumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesGetOperationStatus_scheduledActionsVirtualMachinesGetOperationStatusMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesGetOperationStatus(ctx, "egz", armcomputeschedule.GetOperationStatusRequest{ + OperationIDs: []*string{ + to.Ptr("hswzfrierpxdgcuu"), + }, + Correlationid: to.Ptr("jtlszorevrftvfhnqoxlwpiwcbmj"), + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesGetOperationStatusResponse{ + // GetOperationStatusResponse: &armcomputeschedule.GetOperationStatusResponse{ + // Results: []*armcomputeschedule.ResourceOperation{ + // { + // }, + // }, + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitCreate_MaximumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesSubmitCreate_scheduledActionsVirtualMachinesSubmitCreateGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitCreate(ctx, "msbmrhcjsqsydsq", armcomputeschedule.SubmitCreateRequest{ + Schedule: &armcomputeschedule.Schedule{ + Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.403Z"); return t }()), + DeadLine: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.403Z"); return t }()), + Timezone: to.Ptr("qacufsmctpgjozovlsihrzoctatcsj"), + TimeZone: to.Ptr("upnmayfebiadztdktxzq"), + DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + }, + ResourceConfigParameters: &armcomputeschedule.ResourceProvisionPayload{ + BaseProfile: to.Ptr("tfgrulcuneopmbdjydzofmhpa"), + ResourceOverrides: []*string{ + to.Ptr("hsqtjgsobjaffl"), + }, + ResourceCount: to.Ptr[int32](28), + ResourcePrefix: to.Ptr("rqlxavviucrxfjj"), + }, + ExecutionParameters: &armcomputeschedule.ExecutionParameters{ + OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost), + RetryPolicy: &armcomputeschedule.RetryPolicy{ + RetryCount: to.Ptr[int32](25), + RetryWindowInMinutes: to.Ptr[int32](4), + }, + }, + Correlationid: to.Ptr("muxopzmvkxlowegf"), + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitCreateResponse{ + // CreateResourceOperationResponse: &armcomputeschedule.CreateResourceOperationResponse{ + // Type: to.Ptr("avmbqoatro"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Results: []*armcomputeschedule.ResourceOperation{ + // { + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // ErrorCode: to.Ptr("ynukyltendgmn"), + // ErrorDetails: to.Ptr("tifeuh"), + // Operation: &armcomputeschedule.ResourceOperationDetails{ + // OperationID: to.Ptr("vppyaxq"), + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown), + // SubscriptionID: to.Ptr("vofvsus"), + // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + // State: to.Ptr(armcomputeschedule.OperationStateUnknown), + // Timezone: to.Ptr("nwugsooykqggcokphgdj"), + // TimeZone: to.Ptr("qkxnxnumvfqmsmpyccv"), + // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ + // ErrorCode: to.Ptr("fagfsojftlff"), + // ErrorDetails: to.Ptr("rtihrkjasrjkllqccuysjrg"), + // }, + // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // RetryPolicy: &armcomputeschedule.RetryPolicy{ + // RetryCount: to.Ptr[int32](25), + // RetryWindowInMinutes: to.Ptr[int32](4), + // }, // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, + // }, + // Description: to.Ptr("plfajalcmjcxmfuvsbnnoabdqxclto"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesSubmitDeallocate.json -func ExampleScheduledActionsClient_VirtualMachinesSubmitDeallocate() { +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitCreate_MinimumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesSubmitCreate_scheduledActionsVirtualMachinesSubmitCreateGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitDeallocate(ctx, "eastus2euap", armcomputeschedule.SubmitDeallocateRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitCreate(ctx, "hrktusuzoncwpnwohurwlmxfbndt", armcomputeschedule.SubmitCreateRequest{ + Schedule: &armcomputeschedule.Schedule{ + DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + }, + ResourceConfigParameters: &armcomputeschedule.ResourceProvisionPayload{ + ResourceCount: to.Ptr[int32](28), + }, + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitCreateResponse{ + // CreateResourceOperationResponse: &armcomputeschedule.CreateResourceOperationResponse{ + // Type: to.Ptr("avmbqoatro"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Description: to.Ptr("plfajalcmjcxmfuvsbnnoabdqxclto"), + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitDeallocate_MaximumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesSubmitDeallocate_scheduledActionsVirtualMachinesSubmitDeallocateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitDeallocate(ctx, "mqlftjjfnzubxpricsgstgjojaoah", armcomputeschedule.SubmitDeallocateRequest{ + Schedule: &armcomputeschedule.Schedule{ + Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.403Z"); return t }()), + DeadLine: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.403Z"); return t }()), + Timezone: to.Ptr("qacufsmctpgjozovlsihrzoctatcsj"), + TimeZone: to.Ptr("upnmayfebiadztdktxzq"), + DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + }, ExecutionParameters: &armcomputeschedule.ExecutionParameters{ + OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost), RetryPolicy: &armcomputeschedule.RetryPolicy{ - RetryCount: to.Ptr[int32](4), - RetryWindowInMinutes: to.Ptr[int32](27), + RetryCount: to.Ptr[int32](25), + RetryWindowInMinutes: to.Ptr[int32](4), }, }, Resources: &armcomputeschedule.Resources{ IDs: []*string{ - to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")}, - }, - Schedule: &armcomputeschedule.Schedule{ - Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:54.215Z"); return t }()), - DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - Timezone: to.Ptr("UTC"), + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, }, + Correlationid: to.Ptr("evmwonebfzxenjdpucgcwdjdya"), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -391,67 +937,113 @@ func ExampleScheduledActionsClient_VirtualMachinesSubmitDeallocate() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DeallocateResourceOperationResponse = armcomputeschedule.DeallocateResourceOperationResponse{ - // Type: to.Ptr("virtualMachine"), - // Description: to.Ptr("Deallocate Resource Request"), - // Location: to.Ptr("eastus2euap"), - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeDeallocate), + // res = armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse{ + // DeallocateResourceOperationResponse: &armcomputeschedule.DeallocateResourceOperationResponse{ + // Type: to.Ptr("fpnhqvrtbqizlylnwy"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Results: []*armcomputeschedule.ResourceOperation{ + // { // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), + // ErrorCode: to.Ptr("ynukyltendgmn"), + // ErrorDetails: to.Ptr("tifeuh"), + // Operation: &armcomputeschedule.ResourceOperationDetails{ + // OperationID: to.Ptr("vppyaxq"), + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown), + // SubscriptionID: to.Ptr("vofvsus"), + // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + // State: to.Ptr(armcomputeschedule.OperationStateUnknown), + // Timezone: to.Ptr("nwugsooykqggcokphgdj"), + // TimeZone: to.Ptr("qkxnxnumvfqmsmpyccv"), + // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ + // ErrorCode: to.Ptr("fagfsojftlff"), + // ErrorDetails: to.Ptr("rtihrkjasrjkllqccuysjrg"), + // }, + // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // RetryPolicy: &armcomputeschedule.RetryPolicy{ + // RetryCount: to.Ptr[int32](25), + // RetryWindowInMinutes: to.Ptr[int32](4), + // }, // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](4), - // RetryWindowInMinutes: to.Ptr[int32](27), - // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, + // }, + // Description: to.Ptr("zknbxgebvymhzzmsbrlaqreub"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesSubmitHibernate.json -func ExampleScheduledActionsClient_VirtualMachinesSubmitHibernate() { +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitDeallocate_MinimumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesSubmitDeallocate_scheduledActionsVirtualMachinesSubmitDeallocateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitHibernate(ctx, "eastus2euap", armcomputeschedule.SubmitHibernateRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitDeallocate(ctx, "xrcabowpojl", armcomputeschedule.SubmitDeallocateRequest{ + Schedule: &armcomputeschedule.Schedule{ + DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + }, + ExecutionParameters: &armcomputeschedule.ExecutionParameters{}, + Resources: &armcomputeschedule.Resources{ + IDs: []*string{ + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, + }, + Correlationid: to.Ptr("evmwonebfzxenjdpucgcwdjdya"), + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitDeallocateResponse{ + // DeallocateResourceOperationResponse: &armcomputeschedule.DeallocateResourceOperationResponse{ + // Type: to.Ptr("fpnhqvrtbqizlylnwy"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Description: to.Ptr("zknbxgebvymhzzmsbrlaqreub"), + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitDelete_MaximumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesSubmitDelete_scheduledActionsVirtualMachinesSubmitDeleteGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitDelete(ctx, "ppjqysfqumddvzzs", armcomputeschedule.SubmitDeleteRequest{ + Schedule: &armcomputeschedule.Schedule{ + Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.403Z"); return t }()), + DeadLine: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.403Z"); return t }()), + Timezone: to.Ptr("qacufsmctpgjozovlsihrzoctatcsj"), + TimeZone: to.Ptr("upnmayfebiadztdktxzq"), + DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + }, ExecutionParameters: &armcomputeschedule.ExecutionParameters{ + OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost), RetryPolicy: &armcomputeschedule.RetryPolicy{ - RetryCount: to.Ptr[int32](2), - RetryWindowInMinutes: to.Ptr[int32](27), + RetryCount: to.Ptr[int32](25), + RetryWindowInMinutes: to.Ptr[int32](4), }, }, Resources: &armcomputeschedule.Resources{ IDs: []*string{ - to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")}, - }, - Schedule: &armcomputeschedule.Schedule{ - Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:54.215Z"); return t }()), - DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - Timezone: to.Ptr("UTC"), + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, }, + Correlationid: to.Ptr("e"), + ForceDeletion: to.Ptr(true), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -459,67 +1051,176 @@ func ExampleScheduledActionsClient_VirtualMachinesSubmitHibernate() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.HibernateResourceOperationResponse = armcomputeschedule.HibernateResourceOperationResponse{ - // Type: to.Ptr("virtualMachine"), - // Description: to.Ptr("Hibernate Resource Request"), - // Location: to.Ptr("eastus2euap"), - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeHibernate), + // res = armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitDeleteResponse{ + // DeleteResourceOperationResponse: &armcomputeschedule.DeleteResourceOperationResponse{ + // Type: to.Ptr("tauhekvwziataptcsyqtfpq"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Results: []*armcomputeschedule.ResourceOperation{ + // { // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](2), - // RetryWindowInMinutes: to.Ptr[int32](27), + // ErrorCode: to.Ptr("ynukyltendgmn"), + // ErrorDetails: to.Ptr("tifeuh"), + // Operation: &armcomputeschedule.ResourceOperationDetails{ + // OperationID: to.Ptr("vppyaxq"), + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown), + // SubscriptionID: to.Ptr("vofvsus"), + // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + // State: to.Ptr(armcomputeschedule.OperationStateUnknown), + // Timezone: to.Ptr("nwugsooykqggcokphgdj"), + // TimeZone: to.Ptr("qkxnxnumvfqmsmpyccv"), + // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ + // ErrorCode: to.Ptr("fagfsojftlff"), + // ErrorDetails: to.Ptr("rtihrkjasrjkllqccuysjrg"), + // }, + // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // RetryPolicy: &armcomputeschedule.RetryPolicy{ + // RetryCount: to.Ptr[int32](25), + // RetryWindowInMinutes: to.Ptr[int32](4), + // }, // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, + // }, + // Description: to.Ptr("fxgbwqglaskyb"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/8a4eca6b060cf70da696963245656fdc440b666b/specification/computeschedule/resource-manager/Microsoft.ComputeSchedule/stable/2024-10-01/examples/ScheduledActions_VirtualMachinesSubmitStart.json -func ExampleScheduledActionsClient_VirtualMachinesSubmitStart() { +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitDelete_MinimumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesSubmitDelete_scheduledActionsVirtualMachinesSubmitDeleteGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armcomputeschedule.NewClientFactory("", cred, nil) + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitStart(ctx, "eastus2euap", armcomputeschedule.SubmitStartRequest{ - Correlationid: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitDelete(ctx, "xsllpkyjquhhumdidsl", armcomputeschedule.SubmitDeleteRequest{ + Schedule: &armcomputeschedule.Schedule{ + DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + }, + ExecutionParameters: &armcomputeschedule.ExecutionParameters{}, + Resources: &armcomputeschedule.Resources{ + IDs: []*string{ + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, + }, + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitDeleteResponse{ + // DeleteResourceOperationResponse: &armcomputeschedule.DeleteResourceOperationResponse{ + // Type: to.Ptr("tauhekvwziataptcsyqtfpq"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Description: to.Ptr("fxgbwqglaskyb"), + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitHibernate_MaximumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesSubmitHibernate_scheduledActionsVirtualMachinesSubmitHibernateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitHibernate(ctx, "hiceqzwkjmijxdfw", armcomputeschedule.SubmitHibernateRequest{ + Schedule: &armcomputeschedule.Schedule{ + Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.403Z"); return t }()), + DeadLine: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.403Z"); return t }()), + Timezone: to.Ptr("qacufsmctpgjozovlsihrzoctatcsj"), + TimeZone: to.Ptr("upnmayfebiadztdktxzq"), + DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + }, ExecutionParameters: &armcomputeschedule.ExecutionParameters{ + OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost), RetryPolicy: &armcomputeschedule.RetryPolicy{ - RetryCount: to.Ptr[int32](5), - RetryWindowInMinutes: to.Ptr[int32](27), + RetryCount: to.Ptr[int32](25), + RetryWindowInMinutes: to.Ptr[int32](4), }, }, Resources: &armcomputeschedule.Resources{ IDs: []*string{ - to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3")}, + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, }, + Correlationid: to.Ptr("htqivutynuoslvbp"), + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitHibernateResponse{ + // HibernateResourceOperationResponse: &armcomputeschedule.HibernateResourceOperationResponse{ + // Type: to.Ptr("yrmuumqaqiyotst"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Results: []*armcomputeschedule.ResourceOperation{ + // { + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // ErrorCode: to.Ptr("ynukyltendgmn"), + // ErrorDetails: to.Ptr("tifeuh"), + // Operation: &armcomputeschedule.ResourceOperationDetails{ + // OperationID: to.Ptr("vppyaxq"), + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown), + // SubscriptionID: to.Ptr("vofvsus"), + // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + // State: to.Ptr(armcomputeschedule.OperationStateUnknown), + // Timezone: to.Ptr("nwugsooykqggcokphgdj"), + // TimeZone: to.Ptr("qkxnxnumvfqmsmpyccv"), + // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ + // ErrorCode: to.Ptr("fagfsojftlff"), + // ErrorDetails: to.Ptr("rtihrkjasrjkllqccuysjrg"), + // }, + // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // RetryPolicy: &armcomputeschedule.RetryPolicy{ + // RetryCount: to.Ptr[int32](25), + // RetryWindowInMinutes: to.Ptr[int32](4), + // }, + // }, + // }, + // }, + // Description: to.Ptr("ogyqdzdslyvxslrykb"), + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitHibernate_MinimumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesSubmitHibernate_scheduledActionsVirtualMachinesSubmitHibernateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitHibernate(ctx, "jsbmestfaqxxejcgrs", armcomputeschedule.SubmitHibernateRequest{ Schedule: &armcomputeschedule.Schedule{ - Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:54.215Z"); return t }()), - DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - Timezone: to.Ptr("UTC"), + DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + }, + ExecutionParameters: &armcomputeschedule.ExecutionParameters{}, + Resources: &armcomputeschedule.Resources{ + IDs: []*string{ + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, }, + Correlationid: to.Ptr("htqivutynuoslvbp"), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -527,35 +1228,124 @@ func ExampleScheduledActionsClient_VirtualMachinesSubmitStart() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.StartResourceOperationResponse = armcomputeschedule.StartResourceOperationResponse{ - // Type: to.Ptr("virtualMachine"), - // Description: to.Ptr("Start Resource Request"), - // Location: to.Ptr("eastus2euap"), - // Results: []*armcomputeschedule.ResourceOperation{ - // { - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // Operation: &armcomputeschedule.ResourceOperationDetails{ - // OperationID: to.Ptr("23480d2f-1dca-4610-afb4-dd25eec1f34r"), - // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.668Z"); return t}()), - // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-11-01T17:52:53.667Z"); return t}()), - // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeInitiateAt), - // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeStart), + // res = armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitHibernateResponse{ + // HibernateResourceOperationResponse: &armcomputeschedule.HibernateResourceOperationResponse{ + // Type: to.Ptr("yrmuumqaqiyotst"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Description: to.Ptr("ogyqdzdslyvxslrykb"), + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitStart_MaximumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesSubmitStart_scheduledActionsVirtualMachinesSubmitStartMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitStart(ctx, "klvdoznxekrxhuvgeels", armcomputeschedule.SubmitStartRequest{ + Schedule: &armcomputeschedule.Schedule{ + Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.403Z"); return t }()), + DeadLine: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:04.403Z"); return t }()), + Timezone: to.Ptr("qacufsmctpgjozovlsihrzoctatcsj"), + TimeZone: to.Ptr("upnmayfebiadztdktxzq"), + DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + }, + ExecutionParameters: &armcomputeschedule.ExecutionParameters{ + OptimizationPreference: to.Ptr(armcomputeschedule.OptimizationPreferenceCost), + RetryPolicy: &armcomputeschedule.RetryPolicy{ + RetryCount: to.Ptr[int32](25), + RetryWindowInMinutes: to.Ptr[int32](4), + }, + }, + Resources: &armcomputeschedule.Resources{ + IDs: []*string{ + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, + }, + Correlationid: to.Ptr("bvmpxvbd"), + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitStartResponse{ + // StartResourceOperationResponse: &armcomputeschedule.StartResourceOperationResponse{ + // Type: to.Ptr("lcikdomhndewkiqpf"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Results: []*armcomputeschedule.ResourceOperation{ + // { // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ - // ErrorCode: to.Ptr("null"), - // ErrorDetails: to.Ptr("null"), - // }, - // RetryPolicy: &armcomputeschedule.RetryPolicy{ - // RetryCount: to.Ptr[int32](5), - // RetryWindowInMinutes: to.Ptr[int32](27), + // ErrorCode: to.Ptr("ynukyltendgmn"), + // ErrorDetails: to.Ptr("tifeuh"), + // Operation: &armcomputeschedule.ResourceOperationDetails{ + // OperationID: to.Ptr("vppyaxq"), + // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + // OpType: to.Ptr(armcomputeschedule.ResourceOperationTypeUnknown), + // SubscriptionID: to.Ptr("vofvsus"), + // Deadline: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + // State: to.Ptr(armcomputeschedule.OperationStateUnknown), + // Timezone: to.Ptr("nwugsooykqggcokphgdj"), + // TimeZone: to.Ptr("qkxnxnumvfqmsmpyccv"), + // ResourceOperationError: &armcomputeschedule.ResourceOperationError{ + // ErrorCode: to.Ptr("fagfsojftlff"), + // ErrorDetails: to.Ptr("rtihrkjasrjkllqccuysjrg"), + // }, + // CompletedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-04-15T19:47:03.591Z"); return t}()), + // RetryPolicy: &armcomputeschedule.RetryPolicy{ + // RetryCount: to.Ptr[int32](25), + // RetryWindowInMinutes: to.Ptr[int32](4), + // }, // }, - // State: to.Ptr(armcomputeschedule.OperationStateSucceeded), - // SubscriptionID: to.Ptr("D8E30CC0-2763-4FCC-84A8-3C5659281032"), - // TimeZone: to.Ptr("UTC"), - // Timezone: to.Ptr("UTC"), // }, - // ResourceID: to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), - // }}, + // }, + // Description: to.Ptr("mqfxdgracoxwwpoegjryov"), + // }, + // } +} + +// Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitStart_MinimumSet_Gen.json +func ExampleScheduledActionsClient_VirtualMachinesSubmitStart_scheduledActionsVirtualMachinesSubmitStartMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcomputeschedule.NewClientFactory("0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewScheduledActionsClient().VirtualMachinesSubmitStart(ctx, "rbsdwsfprygqqwqhwapovusm", armcomputeschedule.SubmitStartRequest{ + Schedule: &armcomputeschedule.Schedule{ + DeadlineType: to.Ptr(armcomputeschedule.DeadlineTypeUnknown), + }, + ExecutionParameters: &armcomputeschedule.ExecutionParameters{}, + Resources: &armcomputeschedule.Resources{ + IDs: []*string{ + to.Ptr("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3"), + }, + }, + Correlationid: to.Ptr("bvmpxvbd"), + }, 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 = armcomputeschedule.ScheduledActionsClientVirtualMachinesSubmitStartResponse{ + // StartResourceOperationResponse: &armcomputeschedule.StartResourceOperationResponse{ + // Type: to.Ptr("lcikdomhndewkiqpf"), + // Location: to.Ptr("hhioerbsucdqayxk"), + // Description: to.Ptr("mqfxdgracoxwwpoegjryov"), + // }, // } } diff --git a/sdk/resourcemanager/computeschedule/armcomputeschedule/time_rfc3339.go b/sdk/resourcemanager/computeschedule/armcomputeschedule/time_rfc3339.go index c69bdcbe0925..2dbbfdf7d0e9 100644 --- a/sdk/resourcemanager/computeschedule/armcomputeschedule/time_rfc3339.go +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/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 armcomputeschedule @@ -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/computeschedule/armcomputeschedule/tsp-location.yaml b/sdk/resourcemanager/computeschedule/armcomputeschedule/tsp-location.yaml new file mode 100644 index 000000000000..d72303849410 --- /dev/null +++ b/sdk/resourcemanager/computeschedule/armcomputeschedule/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/computeschedule/ComputeSchedule.Management +commit: 079f70d6f2b754db6b736e117196104efd2dd496 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md b/sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md new file mode 100644 index 000000000000..6a12c5514a1e --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2025-05-13) +### Other Changes + +The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). + +To learn more, please refer to our documentation [Quick Start](https://aka.ms/azsdk/go/mgmt). \ No newline at end of file diff --git a/sdk/resourcemanager/contoso/armcontoso/LICENSE.txt b/sdk/resourcemanager/contoso/armcontoso/LICENSE.txt new file mode 100644 index 000000000000..dc0c2ffb3dc1 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/LICENSE.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) Microsoft Corporation. All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/sdk/resourcemanager/contoso/armcontoso/README.md b/sdk/resourcemanager/contoso/armcontoso/README.md new file mode 100644 index 000000000000..de0732ba86be --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/README.md @@ -0,0 +1,90 @@ +# Azure Contoso Module for Go + +The `armcontoso` module provides operations for working with Azure Contoso. + +[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/contoso/armcontoso) + +# Getting started + +## Prerequisites + +- an [Azure subscription](https://azure.microsoft.com/free/) +- Go 1.18 or above (You could download and install the latest version of Go from [here](https://go.dev/doc/install). It will replace the existing Go on your machine. If you want to install multiple Go versions on the same machine, you could refer this [doc](https://go.dev/doc/manage-install).) + +## Install the package + +This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. + +Install the Azure Contoso module: + +```sh +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso +``` + +## Authorization + +When creating a client, you will need to provide a credential for authenticating with Azure Contoso. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. + +```go +cred, err := azidentity.NewDefaultAzureCredential(nil) +``` + +For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). + +## Client Factory + +Azure Contoso module consists of one or more clients. We provide a client factory which could be used to create any client in this module. + +```go +clientFactory, err := armcontoso.NewClientFactory(, cred, nil) +``` + +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). + +```go +options := arm.ClientOptions { + ClientOptions: azcore.ClientOptions { + Cloud: cloud.AzureChina, + }, +} +clientFactory, err := armcontoso.NewClientFactory(, cred, &options) +``` + +## Clients + +A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. + +```go +client := clientFactory.NewEmployeesClient() +``` + +## Fakes + +The fake package contains types used for constructing in-memory fake servers used in unit tests. +This allows writing tests to cover various success/error conditions without the need for connecting to a live service. + +Please see https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/samples/fakes for details and examples on how to use fakes. + +## Provide Feedback + +If you encounter bugs or have suggestions, please +[open an issue](https://github.com/Azure/azure-sdk-for-go/issues) and assign the `Contoso` label. + +# Contributing + +This project welcomes contributions and suggestions. Most contributions require +you to agree to a Contributor License Agreement (CLA) declaring that you have +the right to, and actually do, grant us the rights to use your contribution. +For details, visit [https://cla.microsoft.com](https://cla.microsoft.com). + +When you submit a pull request, a CLA-bot will automatically determine whether +you need to provide a CLA and decorate the PR appropriately (e.g., label, +comment). Simply follow the instructions provided by the bot. You will only +need to do this once across all repos using our CLA. + +This project has adopted the +[Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). +For more information, see the +[Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) +or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any +additional questions or comments. \ No newline at end of file diff --git a/sdk/resourcemanager/contoso/armcontoso/ci.yml b/sdk/resourcemanager/contoso/armcontoso/ci.yml new file mode 100644 index 000000000000..5288ced2c71e --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/ci.yml @@ -0,0 +1,27 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. +trigger: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/contoso/armcontoso/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/resourcemanager/contoso/armcontoso/ + +extends: + template: /eng/pipelines/templates/jobs/archetype-sdk-client.yml + parameters: + ServiceDirectory: 'resourcemanager/contoso/armcontoso' diff --git a/sdk/resourcemanager/contoso/armcontoso/client_factory.go b/sdk/resourcemanager/contoso/armcontoso/client_factory.go new file mode 100644 index 000000000000..0a0944ec82c6 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/client_factory.go @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" +) + +// ClientFactory is a client factory used to create any client in this module. +// Don't use this type directly, use NewClientFactory instead. +type ClientFactory struct { + subscriptionID string + internal *arm.Client +} + +// NewClientFactory creates a new instance of ClientFactory with the specified values. +// The parameter values will be propagated to any client created from this factory. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { + internal, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + return &ClientFactory{ + subscriptionID: subscriptionID, + internal: internal, + }, nil +} + +// NewEmployeesClient creates a new instance of EmployeesClient. +func (c *ClientFactory) NewEmployeesClient() *EmployeesClient { + return &EmployeesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationsClient creates a new instance of OperationsClient. +func (c *ClientFactory) NewOperationsClient() *OperationsClient { + return &OperationsClient{ + internal: c.internal, + } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/constants.go b/sdk/resourcemanager/contoso/armcontoso/constants.go new file mode 100644 index 000000000000..35ca72f6b867 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/constants.go @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" + moduleVersion = "v0.1.0" +) + +// ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ActionType string + +const ( + // ActionTypeInternal - Actions are for internal-only APIs. + ActionTypeInternal ActionType = "Internal" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeInternal, + } +} + +// CreatedByType - The kind of entity that created the resource. +type CreatedByType string + +const ( + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string + +const ( + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. + OriginUserSystem Origin = "user,system" +) + +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, + } +} + +// ProvisioningState - The resource provisioning state. +type ProvisioningState string + +const ( + // ProvisioningStateAccepted - The resource create request has been accepted + ProvisioningStateAccepted ProvisioningState = "Accepted" + // ProvisioningStateCanceled - Resource creation was canceled. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateDeleting - The resource is being deleted + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - Resource creation failed. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateProvisioning - The resource is being provisioned + ProvisioningStateProvisioning ProvisioningState = "Provisioning" + // ProvisioningStateSucceeded - Resource has been created. + ProvisioningStateSucceeded ProvisioningState = "Succeeded" + // ProvisioningStateUpdating - The resource is updating + ProvisioningStateUpdating ProvisioningState = "Updating" +) + +// PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. +func PossibleProvisioningStateValues() []ProvisioningState { + return []ProvisioningState{ + ProvisioningStateAccepted, + ProvisioningStateCanceled, + ProvisioningStateDeleting, + ProvisioningStateFailed, + ProvisioningStateProvisioning, + ProvisioningStateSucceeded, + ProvisioningStateUpdating, + } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/employees_client.go b/sdk/resourcemanager/contoso/armcontoso/employees_client.go new file mode 100644 index 000000000000..4ec0f62b9e70 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/employees_client.go @@ -0,0 +1,444 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// EmployeesClient contains the methods for the Employees group. +// Don't use this type directly, use NewEmployeesClient() instead. +type EmployeesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewEmployeesClient creates a new instance of EmployeesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewEmployeesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*EmployeesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &EmployeesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - resource - Resource create parameters. +// - options - EmployeesClientBeginCreateOrUpdateOptions contains the optional parameters for the EmployeesClient.BeginCreateOrUpdate +// method. +func (client *EmployeesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, employeeName string, resource Employee, options *EmployeesClientBeginCreateOrUpdateOptions) (*runtime.Poller[EmployeesClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, employeeName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EmployeesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EmployeesClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-11-01 +func (client *EmployeesClient) createOrUpdate(ctx context.Context, resourceGroupName string, employeeName string, resource Employee, options *EmployeesClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "EmployeesClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, employeeName, resource, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *EmployeesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, resource Employee, _ *EmployeesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-11-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 +} + +// BeginDelete - Delete a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - options - EmployeesClientBeginDeleteOptions contains the optional parameters for the EmployeesClient.BeginDelete method. +func (client *EmployeesClient) BeginDelete(ctx context.Context, resourceGroupName string, employeeName string, options *EmployeesClientBeginDeleteOptions) (*runtime.Poller[EmployeesClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, employeeName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EmployeesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EmployeesClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-11-01 +func (client *EmployeesClient) deleteOperation(ctx context.Context, resourceGroupName string, employeeName string, options *EmployeesClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "EmployeesClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, employeeName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *EmployeesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, _ *EmployeesClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - options - EmployeesClientGetOptions contains the optional parameters for the EmployeesClient.Get method. +func (client *EmployeesClient) Get(ctx context.Context, resourceGroupName string, employeeName string, options *EmployeesClientGetOptions) (EmployeesClientGetResponse, error) { + var err error + const operationName = "EmployeesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, employeeName, options) + if err != nil { + return EmployeesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EmployeesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EmployeesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *EmployeesClient) getCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, _ *EmployeesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *EmployeesClient) getHandleResponse(resp *http.Response) (EmployeesClientGetResponse, error) { + result := EmployeesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Employee); err != nil { + return EmployeesClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List Employee resources by resource group +// +// Generated from API version 2021-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - EmployeesClientListByResourceGroupOptions contains the optional parameters for the EmployeesClient.NewListByResourceGroupPager +// method. +func (client *EmployeesClient) NewListByResourceGroupPager(resourceGroupName string, options *EmployeesClientListByResourceGroupOptions) *runtime.Pager[EmployeesClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[EmployeesClientListByResourceGroupResponse]{ + More: func(page EmployeesClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EmployeesClientListByResourceGroupResponse) (EmployeesClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EmployeesClient.NewListByResourceGroupPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return EmployeesClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *EmployeesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *EmployeesClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *EmployeesClient) listByResourceGroupHandleResponse(resp *http.Response) (EmployeesClientListByResourceGroupResponse, error) { + result := EmployeesClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EmployeeListResult); err != nil { + return EmployeesClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List Employee resources by subscription ID +// +// Generated from API version 2021-11-01 +// - options - EmployeesClientListBySubscriptionOptions contains the optional parameters for the EmployeesClient.NewListBySubscriptionPager +// method. +func (client *EmployeesClient) NewListBySubscriptionPager(options *EmployeesClientListBySubscriptionOptions) *runtime.Pager[EmployeesClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[EmployeesClientListBySubscriptionResponse]{ + More: func(page EmployeesClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *EmployeesClientListBySubscriptionResponse) (EmployeesClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "EmployeesClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return EmployeesClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *EmployeesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *EmployeesClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Contoso/employees" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *EmployeesClient) listBySubscriptionHandleResponse(resp *http.Response) (EmployeesClientListBySubscriptionResponse, error) { + result := EmployeesClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.EmployeeListResult); err != nil { + return EmployeesClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Update a Employee +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - employeeName - The name of the Employee +// - properties - The resource properties to be updated. +// - options - EmployeesClientUpdateOptions contains the optional parameters for the EmployeesClient.Update method. +func (client *EmployeesClient) Update(ctx context.Context, resourceGroupName string, employeeName string, properties Employee, options *EmployeesClientUpdateOptions) (EmployeesClientUpdateResponse, error) { + var err error + const operationName = "EmployeesClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, employeeName, properties, options) + if err != nil { + return EmployeesClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return EmployeesClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return EmployeesClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *EmployeesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, employeeName string, properties Employee, _ *EmployeesClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if employeeName == "" { + return nil, errors.New("parameter employeeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{employeeName}", url.PathEscape(employeeName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *EmployeesClient) updateHandleResponse(resp *http.Response) (EmployeesClientUpdateResponse, error) { + result := EmployeesClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Employee); err != nil { + return EmployeesClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go b/sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go new file mode 100644 index 000000000000..44948db27382 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/employees_client_example_test.go @@ -0,0 +1,302 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" + "log" +) + +// Generated from example definition: 2021-11-01/Employees_CreateOrUpdate.json +func ExampleEmployeesClient_BeginCreateOrUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEmployeesClient().BeginCreateOrUpdate(ctx, "rgopenapi", "9KF-f-8b", armcontoso.Employee{ + Properties: &armcontoso.EmployeeProperties{ + Age: to.Ptr[int32](30), + City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + Profile: []byte("ms"), + }, + Tags: map[string]*string{ + "key2913": to.Ptr("urperxmkkhhkp"), + }, + Location: to.Ptr("itajgxyqozseoygnl"), + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + res, err := poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armcontoso.EmployeesClientCreateOrUpdateResponse{ + // Employee: &armcontoso.Employee{ + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/le-8MU--J3W6q8D386p3-iT3"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2021-11-01/Employees_Delete.json +func ExampleEmployeesClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewEmployeesClient().BeginDelete(ctx, "rgopenapi", "5vX--BxSu3ux48rI4O9OQ569", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + _, err = poller.PollUntilDone(ctx, nil) + if err != nil { + log.Fatalf("failed to pull the result: %v", err) + } +} + +// Generated from example definition: 2021-11-01/Employees_Get.json +func ExampleEmployeesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEmployeesClient().Get(ctx, "rgopenapi", "le-8MU--J3W6q8D386p3-iT3", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armcontoso.EmployeesClientGetResponse{ + // Employee: &armcontoso.Employee{ + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/le-8MU--J3W6q8D386p3-iT3"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2021-11-01/Employees_ListByResourceGroup.json +func ExampleEmployeesClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEmployeesClient().NewListByResourceGroupPager("rgopenapi", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armcontoso.EmployeesClientListByResourceGroupResponse{ + // EmployeeListResult: armcontoso.EmployeeListResult{ + // Value: []*armcontoso.Employee{ + // { + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/test"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2021-11-01/Employees_ListBySubscription.json +func ExampleEmployeesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewEmployeesClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armcontoso.EmployeesClientListBySubscriptionResponse{ + // EmployeeListResult: armcontoso.EmployeeListResult{ + // Value: []*armcontoso.Employee{ + // { + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/rgopenapi/providers/Microsoft.Contoso/employees/test"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2021-11-01/Employees_Update.json +func ExampleEmployeesClient_Update() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armcontoso.NewClientFactory("11809CA1-E126-4017-945E-AA795CD5C5A9", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewEmployeesClient().Update(ctx, "rgopenapi", "-XhyNJ--", armcontoso.Employee{ + Tags: map[string]*string{ + "key7952": to.Ptr("no"), + }, + Properties: &armcontoso.EmployeeProperties{ + Age: to.Ptr[int32](24), + City: to.Ptr("uyfg"), + Profile: []byte("oapgijcswfkruiuuzbwco"), + }, + }, nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armcontoso.EmployeesClientUpdateResponse{ + // Employee: &armcontoso.Employee{ + // Properties: &armcontoso.EmployeeProperties{ + // Age: to.Ptr[int32](30), + // City: to.Ptr("gydhnntudughbmxlkyzrskcdkotrxn"), + // Profile: []byte("ms"), + // ProvisioningState: to.Ptr(armcontoso.ProvisioningStateSucceeded), + // }, + // Tags: map[string]*string{ + // "key2913": to.Ptr("urperxmkkhhkp"), + // }, + // Location: to.Ptr("itajgxyqozseoygnl"), + // ID: to.Ptr("/subscriptions/11809CA1-E126-4017-945E-AA795CD5C5A9/resourceGroups/contoso/providers/Microsoft.Contoso/employees/test"), + // Name: to.Ptr("xepyxhpb"), + // Type: to.Ptr("svvamxrdnnv"), + // SystemData: &armcontoso.SystemData{ + // CreatedBy: to.Ptr("iewyxsnriqktsvp"), + // CreatedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // LastModifiedBy: to.Ptr("xrchbnnuzierzpxw"), + // LastModifiedByType: to.Ptr(armcontoso.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-05-19T00:28:48.610Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go b/sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go new file mode 100644 index 000000000000..ec82749785e5 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/employees_server.go @@ -0,0 +1,361 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" + "net/http" + "net/url" + "regexp" +) + +// EmployeesServer is a fake server for instances of the armcontoso.EmployeesClient type. +type EmployeesServer struct { + // BeginCreateOrUpdate is the fake for method EmployeesClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, employeeName string, resource armcontoso.Employee, options *armcontoso.EmployeesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armcontoso.EmployeesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method EmployeesClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, employeeName string, options *armcontoso.EmployeesClientBeginDeleteOptions) (resp azfake.PollerResponder[armcontoso.EmployeesClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method EmployeesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, employeeName string, options *armcontoso.EmployeesClientGetOptions) (resp azfake.Responder[armcontoso.EmployeesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method EmployeesClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armcontoso.EmployeesClientListByResourceGroupOptions) (resp azfake.PagerResponder[armcontoso.EmployeesClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method EmployeesClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armcontoso.EmployeesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armcontoso.EmployeesClientListBySubscriptionResponse]) + + // Update is the fake for method EmployeesClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, employeeName string, properties armcontoso.Employee, options *armcontoso.EmployeesClientUpdateOptions) (resp azfake.Responder[armcontoso.EmployeesClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewEmployeesServerTransport creates a new instance of EmployeesServerTransport with the provided implementation. +// The returned EmployeesServerTransport instance is connected to an instance of armcontoso.EmployeesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewEmployeesServerTransport(srv *EmployeesServer) *EmployeesServerTransport { + return &EmployeesServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armcontoso.EmployeesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armcontoso.EmployeesClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armcontoso.EmployeesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armcontoso.EmployeesClientListBySubscriptionResponse]](), + } +} + +// EmployeesServerTransport connects instances of armcontoso.EmployeesClient to instances of EmployeesServer. +// Don't use this type directly, use NewEmployeesServerTransport instead. +type EmployeesServerTransport struct { + srv *EmployeesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armcontoso.EmployeesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armcontoso.EmployeesClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armcontoso.EmployeesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armcontoso.EmployeesClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for EmployeesServerTransport. +func (e *EmployeesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *EmployeesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if employeesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = employeesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "EmployeesClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "EmployeesClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "EmployeesClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "EmployeesClient.NewListByResourceGroupPager": + res.resp, res.err = e.dispatchNewListByResourceGroupPager(req) + case "EmployeesClient.NewListBySubscriptionPager": + res.resp, res.err = e.dispatchNewListBySubscriptionPager(req) + case "EmployeesClient.Update": + res.resp, res.err = e.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (e *EmployeesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcontoso.Employee](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, employeeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, employeeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + e.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, employeeNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Employee, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := e.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + resp := e.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + e.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armcontoso.EmployeesClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + e.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := e.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := e.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + e.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armcontoso.EmployeesClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + e.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (e *EmployeesServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if e.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Contoso/employees/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armcontoso.Employee](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + employeeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("employeeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Update(req.Context(), resourceGroupNameParam, employeeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Employee, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to EmployeesServerTransport +var employeesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/internal.go b/sdk/resourcemanager/contoso/armcontoso/fake/internal.go new file mode 100644 index 000000000000..7425b6a669e2 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/internal.go @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "net/http" + "sync" +) + +type result struct { + resp *http.Response + err error +} + +type nonRetriableError struct { + error +} + +func (nonRetriableError) NonRetriable() { + // marker method +} + +func contains[T comparable](s []T, v T) bool { + for _, vv := range s { + if vv == v { + return true + } + } + return false +} + +func newTracker[T any]() *tracker[T] { + return &tracker[T]{ + items: map[string]*T{}, + } +} + +type tracker[T any] struct { + items map[string]*T + mu sync.Mutex +} + +func (p *tracker[T]) get(req *http.Request) *T { + p.mu.Lock() + defer p.mu.Unlock() + if item, ok := p.items[server.SanitizePagerPollerPath(req.URL.Path)]; ok { + return item + } + return nil +} + +func (p *tracker[T]) add(req *http.Request, item *T) { + p.mu.Lock() + defer p.mu.Unlock() + p.items[server.SanitizePagerPollerPath(req.URL.Path)] = item +} + +func (p *tracker[T]) remove(req *http.Request) { + p.mu.Lock() + defer p.mu.Unlock() + delete(p.items, server.SanitizePagerPollerPath(req.URL.Path)) +} diff --git a/sdk/resourcemanager/contoso/armcontoso/fake/operations_server.go b/sdk/resourcemanager/contoso/armcontoso/fake/operations_server.go new file mode 100644 index 000000000000..c33444bdc46a --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/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/contoso/armcontoso" + "net/http" +) + +// OperationsServer is a fake server for instances of the armcontoso.OperationsClient type. +type OperationsServer struct { + // NewListPager is the fake for method OperationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(options *armcontoso.OperationsClientListOptions) (resp azfake.PagerResponder[armcontoso.OperationsClientListResponse]) +} + +// NewOperationsServerTransport creates a new instance of OperationsServerTransport with the provided implementation. +// The returned OperationsServerTransport instance is connected to an instance of armcontoso.OperationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationsServerTransport(srv *OperationsServer) *OperationsServerTransport { + return &OperationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armcontoso.OperationsClientListResponse]](), + } +} + +// OperationsServerTransport connects instances of armcontoso.OperationsClient to instances of OperationsServer. +// Don't use this type directly, use NewOperationsServerTransport instead. +type OperationsServerTransport struct { + srv *OperationsServer + newListPager *tracker[azfake.PagerResponder[armcontoso.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 *armcontoso.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/contoso/armcontoso/fake/server_factory.go b/sdk/resourcemanager/contoso/armcontoso/fake/server_factory.go new file mode 100644 index 000000000000..9ddfd8463c5a --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/fake/server_factory.go @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" + "sync" +) + +// ServerFactory is a fake server for instances of the armcontoso.ClientFactory type. +type ServerFactory struct { + // EmployeesServer contains the fakes for client EmployeesClient + EmployeesServer EmployeesServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer +} + +// NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. +// The returned ServerFactoryTransport instance is connected to an instance of armcontoso.ClientFactory via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewServerFactoryTransport(srv *ServerFactory) *ServerFactoryTransport { + return &ServerFactoryTransport{ + srv: srv, + } +} + +// ServerFactoryTransport connects instances of armcontoso.ClientFactory to instances of ServerFactory. +// Don't use this type directly, use NewServerFactoryTransport instead. +type ServerFactoryTransport struct { + srv *ServerFactory + trMu sync.Mutex + trEmployeesServer *EmployeesServerTransport + trOperationsServer *OperationsServerTransport +} + +// Do implements the policy.Transporter interface for ServerFactoryTransport. +func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + client := method[:strings.Index(method, ".")] + var resp *http.Response + var err error + + switch client { + case "EmployeesClient": + initServer(s, &s.trEmployeesServer, func() *EmployeesServerTransport { return NewEmployeesServerTransport(&s.srv.EmployeesServer) }) + resp, err = s.trEmployeesServer.Do(req) + case "OperationsClient": + initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + resp, err = s.trOperationsServer.Do(req) + default: + err = fmt.Errorf("unhandled client %s", client) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { + s.trMu.Lock() + if *dst == nil { + *dst = src() + } + s.trMu.Unlock() +} diff --git a/sdk/resourcemanager/contoso/armcontoso/go.mod b/sdk/resourcemanager/contoso/armcontoso/go.mod new file mode 100644 index 000000000000..6a6717468b34 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/go.mod @@ -0,0 +1,23 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso + +go 1.23.0 + +toolchain go1.23.8 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 + 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.36.0 // indirect + golang.org/x/net v0.37.0 // indirect + golang.org/x/sys v0.31.0 // indirect + golang.org/x/text v0.23.0 // indirect +) diff --git a/sdk/resourcemanager/contoso/armcontoso/go.sum b/sdk/resourcemanager/contoso/armcontoso/go.sum new file mode 100644 index 000000000000..1f92486fbbcf --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/go.sum @@ -0,0 +1,33 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= +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/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= +golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/contoso/armcontoso/models.go b/sdk/resourcemanager/contoso/armcontoso/models.go new file mode 100644 index 000000000000..8cd1a5bb7ad9 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/models.go @@ -0,0 +1,127 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +import "time" + +// Employee resource +type Employee struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *EmployeeProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; The name of the Employee + Name *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// EmployeeListResult - The response of a Employee list operation. +type EmployeeListResult struct { + // REQUIRED; The Employee items on this page + Value []*Employee + + // The link to the next page of items + NextLink *string +} + +// EmployeeProperties - Employee properties +type EmployeeProperties struct { + // Age of employee + Age *int32 + + // City of employee + City *string + + // Profile of employee + Profile []byte + + // READ-ONLY; The status of the last operation. + ProvisioningState *ProvisioningState +} + +// Operation - REST API 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 +} + +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time + + // The identity that created the resource. + CreatedBy *string + + // The type of identity that created the resource. + CreatedByType *CreatedByType + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time + + // The identity that last modified the resource. + LastModifiedBy *string + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType +} diff --git a/sdk/resourcemanager/contoso/armcontoso/models_serde.go b/sdk/resourcemanager/contoso/armcontoso/models_serde.go new file mode 100644 index 000000000000..b3254af63ba4 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/models_serde.go @@ -0,0 +1,328 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type Employee. +func (e Employee) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Employee. +func (e *Employee) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmployeeListResult. +func (e EmployeeListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmployeeListResult. +func (e *EmployeeListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EmployeeProperties. +func (e EmployeeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "age", e.Age) + populate(objectMap, "city", e.City) + populateByteArray(objectMap, "profile", e.Profile, func() any { + return runtime.EncodeByteArray(e.Profile, runtime.Base64URLFormat) + }) + populate(objectMap, "provisioningState", e.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EmployeeProperties. +func (e *EmployeeProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "age": + err = unpopulate(val, "Age", &e.Age) + delete(rawMsg, key) + case "city": + err = unpopulate(val, "City", &e.City) + delete(rawMsg, key) + case "profile": + if val != nil && string(val) != "null" { + err = runtime.DecodeByteArray(string(val), &e.Profile, runtime.Base64URLFormat) + } + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +func populate(m map[string]any, k string, v any) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateByteArray[T any](m map[string]any, k string, b []T, convert func() any) { + if azcore.IsNullValue(b) { + m[k] = nil + } else if len(b) == 0 { + return + } else { + m[k] = convert() + } +} + +func unpopulate(data json.RawMessage, fn string, v any) error { + if data == nil || string(data) == "null" { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/contoso/armcontoso/operations_client.go b/sdk/resourcemanager/contoso/armcontoso/operations_client.go new file mode 100644 index 000000000000..cc57f6103c1d --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/operations_client.go @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" +) + +// OperationsClient contains the methods for the Operations group. +// Don't use this type directly, use NewOperationsClient() instead. +type OperationsClient struct { + internal *arm.Client +} + +// NewOperationsClient creates a new instance of OperationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationsClient{ + internal: cl, + } + return client, nil +} + +// NewListPager - List the operations for the provider +// +// Generated from API version 2021-11-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]{ + More: func(page OperationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *OperationsClientListResponse) (OperationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, nil) + if err != nil { + return OperationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { + urlPath := "/providers/Microsoft.Contoso/operations" + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { + result := OperationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { + return OperationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/contoso/armcontoso/operations_client_example_test.go b/sdk/resourcemanager/contoso/armcontoso/operations_client_example_test.go new file mode 100644 index 000000000000..84d61e5c7bd6 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/operations_client_example_test.go @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/contoso/armcontoso" + "log" +) + +// Generated from example definition: 2021-11-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 := armcontoso.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armcontoso.OperationsClientListResponse{ + // OperationListResult: armcontoso.OperationListResult{ + // Value: []*armcontoso.Operation{ + // { + // Name: to.Ptr("ymeow"), + // IsDataAction: to.Ptr(true), + // Display: &armcontoso.OperationDisplay{ + // Provider: to.Ptr("qxyznq"), + // Resource: to.Ptr("bqfwkox"), + // Operation: to.Ptr("td"), + // Description: to.Ptr("yvgkhsuwartgxb"), + // }, + // Origin: to.Ptr(armcontoso.OriginUser), + // ActionType: to.Ptr(armcontoso.ActionTypeInternal), + // }, + // }, + // NextLink: to.Ptr("https://sample.com/nextLink"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/contoso/armcontoso/options.go b/sdk/resourcemanager/contoso/armcontoso/options.go new file mode 100644 index 000000000000..11fee1c76771 --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/options.go @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +// EmployeesClientBeginCreateOrUpdateOptions contains the optional parameters for the EmployeesClient.BeginCreateOrUpdate +// method. +type EmployeesClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EmployeesClientBeginDeleteOptions contains the optional parameters for the EmployeesClient.BeginDelete method. +type EmployeesClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// EmployeesClientGetOptions contains the optional parameters for the EmployeesClient.Get method. +type EmployeesClientGetOptions struct { + // placeholder for future optional parameters +} + +// EmployeesClientListByResourceGroupOptions contains the optional parameters for the EmployeesClient.NewListByResourceGroupPager +// method. +type EmployeesClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// EmployeesClientListBySubscriptionOptions contains the optional parameters for the EmployeesClient.NewListBySubscriptionPager +// method. +type EmployeesClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// EmployeesClientUpdateOptions contains the optional parameters for the EmployeesClient.Update method. +type EmployeesClientUpdateOptions struct { + // placeholder for future optional parameters +} + +// OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. +type OperationsClientListOptions struct { + // placeholder for future optional parameters +} diff --git a/sdk/resourcemanager/contoso/armcontoso/responses.go b/sdk/resourcemanager/contoso/armcontoso/responses.go new file mode 100644 index 000000000000..9b28221cf0cb --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/responses.go @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armcontoso + +// EmployeesClientCreateOrUpdateResponse contains the response from method EmployeesClient.BeginCreateOrUpdate. +type EmployeesClientCreateOrUpdateResponse struct { + // Employee resource + Employee +} + +// EmployeesClientDeleteResponse contains the response from method EmployeesClient.BeginDelete. +type EmployeesClientDeleteResponse struct { + // placeholder for future response values +} + +// EmployeesClientGetResponse contains the response from method EmployeesClient.Get. +type EmployeesClientGetResponse struct { + // Employee resource + Employee +} + +// EmployeesClientListByResourceGroupResponse contains the response from method EmployeesClient.NewListByResourceGroupPager. +type EmployeesClientListByResourceGroupResponse struct { + // The response of a Employee list operation. + EmployeeListResult +} + +// EmployeesClientListBySubscriptionResponse contains the response from method EmployeesClient.NewListBySubscriptionPager. +type EmployeesClientListBySubscriptionResponse struct { + // The response of a Employee list operation. + EmployeeListResult +} + +// EmployeesClientUpdateResponse contains the response from method EmployeesClient.Update. +type EmployeesClientUpdateResponse struct { + // Employee resource + Employee +} + +// OperationsClientListResponse contains the response from method OperationsClient.NewListPager. +type OperationsClientListResponse struct { + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult +} diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/time_rfc3339.go b/sdk/resourcemanager/contoso/armcontoso/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/time_rfc3339.go rename to sdk/resourcemanager/contoso/armcontoso/time_rfc3339.go index 87ee11e83b32..fd129d84c771 100644 --- a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/time_rfc3339.go +++ b/sdk/resourcemanager/contoso/armcontoso/time_rfc3339.go @@ -2,7 +2,7 @@ // Licensed under the 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 +package armcontoso import ( "encoding/json" diff --git a/sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml b/sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml new file mode 100644 index 000000000000..f9400f812b5b --- /dev/null +++ b/sdk/resourcemanager/contoso/armcontoso/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/contosowidgetmanager/Contoso.Management +commit: 079f70d6f2b754db6b736e117196104efd2dd496 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/CHANGELOG.md b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/CHANGELOG.md new file mode 100644 index 000000000000..90015af67312 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/CHANGELOG.md @@ -0,0 +1,8 @@ +# Release History + +## 0.1.0 (2025-05-13) +### 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..cfeeed61f070 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/ci.yml @@ -0,0 +1,27 @@ +# 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: + 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..0800e931f540 --- /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 len(matches) < 6 { + 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 len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + 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 len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + 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 len(matches) < 5 { + 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..556d23c2a502 --- /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 len(matches) < 6 { + 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 len(matches) < 6 { + 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 len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + 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 len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + 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 len(matches) < 5 { + 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 len(matches) < 6 { + 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 len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + 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 len(matches) < 6 { + 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..4df6ff29fbbc --- /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 len(matches) < 4 { + 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 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 + } + 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 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 + } + 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 len(matches) < 2 { + 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 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 + } + 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 len(matches) < 4 { + 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..de92a54cc258 --- /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 len(matches) < 5 { + 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 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 + } + 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 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 + } + 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 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 + } + 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 len(matches) < 5 { + 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 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 + } + 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 len(matches) < 5 { + 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..2de2d8d33193 --- /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 len(matches) < 5 { + 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 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 + } + 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 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 + } + 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 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 + } + 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 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 + } + 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 len(matches) < 5 { + 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/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..d2d8c8d8dd91 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.mod @@ -0,0 +1,23 @@ +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager + +go 1.23.0 + +toolchain go1.23.8 + +require ( + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 + 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.36.0 // indirect + golang.org/x/net v0.37.0 // indirect + golang.org/x/sys v0.31.0 // indirect + golang.org/x/text v0.23.0 // indirect +) diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.sum b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.sum new file mode 100644 index 000000000000..1f92486fbbcf --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/go.sum @@ -0,0 +1,33 @@ +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 h1:DSDNVxqkoXJiko6x8a90zidoYqnYYa6c1MTzDKzKkTo= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1/go.mod h1:zGqV2R4Cr/k8Uye5w+dgQ06WJtEcbQG/8J7BB6hnCr4= +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/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +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/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +golang.org/x/crypto v0.36.0 h1:AnAEvhDddvBdpY+uR+MyHmuZzzNqXSe/GvuDeob5L34= +golang.org/x/crypto v0.36.0/go.mod h1:Y4J0ReaxCR1IMaabaSMugxJES1EpwhBHhv2bDHklZvc= +golang.org/x/net v0.37.0 h1:1zLorHbz+LYj7MQlSf1+2tPIIgibq2eL5xkrGk6f+2c= +golang.org/x/net v0.37.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8= +golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= +golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY= +golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models.go new file mode 100644 index 000000000000..aac253069735 --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/models.go @@ -0,0 +1,453 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package 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 - REST API 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/dependencymap/armdependencymap/fake/time_rfc3339.go b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/time_rfc3339.go similarity index 98% rename from sdk/resourcemanager/dependencymap/armdependencymap/fake/time_rfc3339.go rename to sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/time_rfc3339.go index 87ee11e83b32..6a6d0db9efb0 100644 --- a/sdk/resourcemanager/dependencymap/armdependencymap/fake/time_rfc3339.go +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/time_rfc3339.go @@ -2,7 +2,7 @@ // Licensed under the 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 +package armdatabasefleetmanager import ( "encoding/json" diff --git a/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/tsp-location.yaml b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/tsp-location.yaml new file mode 100644 index 000000000000..4c1818fe119d --- /dev/null +++ b/sdk/resourcemanager/databasefleetmanager/armdatabasefleetmanager/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/databasefleetmanager/DatabaseFleetManager.Management +commit: 079f70d6f2b754db6b736e117196104efd2dd496 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/CHANGELOG.md b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/CHANGELOG.md index 6fa14395aaea..2d19754d4631 100644 --- a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/CHANGELOG.md +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.0 (2025-05-13) +### Other Changes + + ## 0.1.0 (2025-02-26) ### Other Changes diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/constants.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/constants.go index fb14d4b4600b..f61060f010e2 100644 --- a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/constants.go +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/constants.go @@ -6,7 +6,7 @@ package armdatabasewatcher const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databasewatcher/armdatabasewatcher" - moduleVersion = "v0.1.0" + moduleVersion = "v1.0.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/alertruleresources_server.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/alertruleresources_server.go index c95341c938b2..9ce7058dda93 100644 --- a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/alertruleresources_server.go +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/alertruleresources_server.go @@ -111,7 +111,7 @@ func (a *AlertRuleResourcesServerTransport) dispatchCreateOrUpdate(req *http.Req 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdatabasewatcher.AlertRuleResource](req) @@ -152,7 +152,7 @@ func (a *AlertRuleResourcesServerTransport) dispatchDelete(req *http.Request) (* 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -189,7 +189,7 @@ func (a *AlertRuleResourcesServerTransport) dispatchGet(req *http.Request) (*htt 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -228,7 +228,7 @@ func (a *AlertRuleResourcesServerTransport) dispatchNewListByParentPager(req *ht 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/healthvalidations_server.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/healthvalidations_server.go index 95b7ca6aa035..2fbe1ab12625 100644 --- a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/healthvalidations_server.go +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/healthvalidations_server.go @@ -107,7 +107,7 @@ func (h *HealthValidationsServerTransport) dispatchGet(req *http.Request) (*http 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -146,7 +146,7 @@ func (h *HealthValidationsServerTransport) dispatchNewListByParentPager(req *htt 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -187,7 +187,7 @@ func (h *HealthValidationsServerTransport) dispatchBeginStartValidation(req *htt 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/sharedprivatelinkresources_server.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/sharedprivatelinkresources_server.go index 0efdaae954e7..66b8c82d0497 100644 --- a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/sharedprivatelinkresources_server.go +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/sharedprivatelinkresources_server.go @@ -117,7 +117,7 @@ func (s *SharedPrivateLinkResourcesServerTransport) dispatchBeginCreate(req *htt 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdatabasewatcher.SharedPrivateLinkResource](req) @@ -169,7 +169,7 @@ func (s *SharedPrivateLinkResourcesServerTransport) dispatchBeginDelete(req *htt 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -215,7 +215,7 @@ func (s *SharedPrivateLinkResourcesServerTransport) dispatchGet(req *http.Reques 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -254,7 +254,7 @@ func (s *SharedPrivateLinkResourcesServerTransport) dispatchNewListByWatcherPage 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/targets_server.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/targets_server.go index cacee3f65b09..f58553ce6893 100644 --- a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/targets_server.go +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/targets_server.go @@ -111,7 +111,7 @@ func (t *TargetsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*htt 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdatabasewatcher.Target](req) @@ -152,7 +152,7 @@ func (t *TargetsServerTransport) dispatchDelete(req *http.Request) (*http.Respon 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -189,7 +189,7 @@ func (t *TargetsServerTransport) dispatchGet(req *http.Request) (*http.Response, 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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -228,7 +228,7 @@ func (t *TargetsServerTransport) dispatchNewListByWatcherPager(req *http.Request 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/watchers_server.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/watchers_server.go index 62d4c81a7133..16bf9e21d6d1 100644 --- a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/watchers_server.go +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/fake/watchers_server.go @@ -149,7 +149,7 @@ func (w *WatchersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdatabasewatcher.Watcher](req) @@ -197,7 +197,7 @@ func (w *WatchersServerTransport) dispatchBeginDelete(req *http.Request) (*http. 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -239,7 +239,7 @@ func (w *WatchersServerTransport) dispatchGet(req *http.Request) (*http.Response 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -274,7 +274,7 @@ func (w *WatchersServerTransport) dispatchNewListByResourceGroupPager(req *http. 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 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -311,7 +311,7 @@ func (w *WatchersServerTransport) dispatchNewListBySubscriptionPager(req *http.R 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 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := w.srv.NewListBySubscriptionPager(nil) @@ -344,7 +344,7 @@ func (w *WatchersServerTransport) dispatchBeginStart(req *http.Request) (*http.R 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -388,7 +388,7 @@ func (w *WatchersServerTransport) dispatchBeginStop(req *http.Request) (*http.Re 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -432,7 +432,7 @@ func (w *WatchersServerTransport) dispatchBeginUpdate(req *http.Request) (*http. 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 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdatabasewatcher.WatcherUpdate](req) diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/healthvalidations_client_example_test.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/healthvalidations_client_example_test.go index f721a6d8e59f..30dfef35aca7 100644 --- a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/healthvalidations_client_example_test.go +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/healthvalidations_client_example_test.go @@ -155,6 +155,7 @@ func ExampleHealthValidationsClient_BeginStartValidation() { // Status: to.Ptr(armdatabasewatcher.ValidationStatusRunning), // Issues: []*armdatabasewatcher.ValidationIssue{ // }, + // ProvisioningState: to.Ptr(armdatabasewatcher.ResourceProvisioningState("Accepted")), // }, // ID: to.Ptr("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/rgWatcher/providers/microsoft.databasewatcher/watchers/testWatcher/healthValidations/testHealthValidation"), // Name: to.Ptr("testHealthValidation"), diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/models.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/models.go index 000a4d2e0879..6d2e932a9486 100644 --- a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/models.go +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/models.go @@ -139,7 +139,9 @@ type ManagedServiceIdentityV4 struct { TenantID *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/sharedprivatelinkresources_client_example_test.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/sharedprivatelinkresources_client_example_test.go index 2df401e2e1f4..09fdae71c453 100644 --- a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/sharedprivatelinkresources_client_example_test.go +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/sharedprivatelinkresources_client_example_test.go @@ -50,6 +50,7 @@ func ExampleSharedPrivateLinkResourcesClient_BeginCreate() { // RequestMessage: to.Ptr("request message"), // DNSZone: to.Ptr("ec3ae9d410ba"), // Status: to.Ptr(armdatabasewatcher.SharedPrivateLinkResourceStatusPending), + // ProvisioningState: to.Ptr(armdatabasewatcher.ResourceProvisioningState("Completed")), // }, // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.DatabaseWatcher/watchers/databasemo3ej9ih/sharedPrivateLinkResources/monitoringh22eed"), // Name: to.Ptr("monitoringh22eed"), @@ -113,6 +114,7 @@ func ExampleSharedPrivateLinkResourcesClient_Get() { // RequestMessage: to.Ptr("request message"), // DNSZone: to.Ptr("ec3ae9d410ba"), // Status: to.Ptr(armdatabasewatcher.SharedPrivateLinkResourceStatusPending), + // ProvisioningState: to.Ptr(armdatabasewatcher.ResourceProvisioningState("Completed")), // }, // ID: to.Ptr("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.DatabaseWatcher/watchers/databasemo3ej9ih/sharedPrivateLinkResources/monitoringh22eed"), // Name: to.Ptr("monitoringh22eed"), @@ -164,6 +166,7 @@ func ExampleSharedPrivateLinkResourcesClient_NewListByWatcherPager() { // RequestMessage: to.Ptr("request message"), // DNSZone: to.Ptr("ec3ae9d410ba"), // Status: to.Ptr(armdatabasewatcher.SharedPrivateLinkResourceStatusPending), + // ProvisioningState: to.Ptr(armdatabasewatcher.ResourceProvisioningState("Completed")), // }, // SystemData: &armdatabasewatcher.SystemData{ // CreatedBy: to.Ptr("enbpvlpqbwd"), diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/tsp-location.yaml b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/tsp-location.yaml index b49ef053e4e1..53df998a26ab 100644 --- a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/tsp-location.yaml +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/databasewatcher/DatabaseWatcher.Management -commit: 80a1036678da5411d44a18bc24c66cc6e14e3605 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/watchers_client_example_test.go b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/watchers_client_example_test.go index dfeb47ba5b7a..03d0bea0c60e 100644 --- a/sdk/resourcemanager/databasewatcher/armdatabasewatcher/watchers_client_example_test.go +++ b/sdk/resourcemanager/databasewatcher/armdatabasewatcher/watchers_client_example_test.go @@ -150,6 +150,7 @@ func ExampleWatchersClient_Get() { // ProvisioningState: to.Ptr(armdatabasewatcher.ProvisioningStateSucceeded), // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), @@ -206,6 +207,7 @@ func ExampleWatchersClient_NewListByResourceGroupPager() { // Tags: map[string]*string{ // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), @@ -254,6 +256,7 @@ func ExampleWatchersClient_NewListByResourceGroupPager() { // }, // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), @@ -290,6 +293,7 @@ func ExampleWatchersClient_NewListByResourceGroupPager() { // }, // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), @@ -326,6 +330,7 @@ func ExampleWatchersClient_NewListByResourceGroupPager() { // }, // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), @@ -362,6 +367,7 @@ func ExampleWatchersClient_NewListByResourceGroupPager() { // }, // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), @@ -406,6 +412,7 @@ func ExampleWatchersClient_NewListByResourceGroupPager() { // }, // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), @@ -434,6 +441,7 @@ func ExampleWatchersClient_NewListByResourceGroupPager() { // }, // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), @@ -535,6 +543,7 @@ func ExampleWatchersClient_NewListBySubscriptionPager() { // }, // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), @@ -571,6 +580,7 @@ func ExampleWatchersClient_NewListBySubscriptionPager() { // }, // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), @@ -607,6 +617,7 @@ func ExampleWatchersClient_NewListBySubscriptionPager() { // }, // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), @@ -643,6 +654,7 @@ func ExampleWatchersClient_NewListBySubscriptionPager() { // }, // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), @@ -687,6 +699,7 @@ func ExampleWatchersClient_NewListBySubscriptionPager() { // }, // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), @@ -715,6 +728,7 @@ func ExampleWatchersClient_NewListBySubscriptionPager() { // }, // }, // Identity: &armdatabasewatcher.ManagedServiceIdentityV4{ + // Type: to.Ptr(armdatabasewatcher.ManagedServiceIdentityType("SystemAssignedIdentity")), // UserAssignedIdentities: map[string]*armdatabasewatcher.UserAssignedIdentity{ // }, // PrincipalID: to.Ptr("49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"), diff --git a/sdk/resourcemanager/dependencymap/armdependencymap/CHANGELOG.md b/sdk/resourcemanager/dependencymap/armdependencymap/CHANGELOG.md index 5bdcef29e4ed..bd29fd28c343 100644 --- a/sdk/resourcemanager/dependencymap/armdependencymap/CHANGELOG.md +++ b/sdk/resourcemanager/dependencymap/armdependencymap/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2025-05-13) +### Other Changes + + ## 0.1.0 (2025-04-15) ### Other Changes diff --git a/sdk/resourcemanager/dependencymap/armdependencymap/constants.go b/sdk/resourcemanager/dependencymap/armdependencymap/constants.go index 05a2396fa0e1..737503e24f13 100644 --- a/sdk/resourcemanager/dependencymap/armdependencymap/constants.go +++ b/sdk/resourcemanager/dependencymap/armdependencymap/constants.go @@ -6,7 +6,7 @@ package armdependencymap const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/dependencymap/armdependencymap" - 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/dependencymap/armdependencymap/fake/discoverysources_server.go b/sdk/resourcemanager/dependencymap/armdependencymap/fake/discoverysources_server.go index 301a489fdf1c..1c58842aa5e0 100644 --- a/sdk/resourcemanager/dependencymap/armdependencymap/fake/discoverysources_server.go +++ b/sdk/resourcemanager/dependencymap/armdependencymap/fake/discoverysources_server.go @@ -125,7 +125,7 @@ func (d *DiscoverySourcesServerTransport) dispatchBeginCreateOrUpdate(req *http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoverySources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdependencymap.DiscoverySourceResource](req) @@ -177,7 +177,7 @@ func (d *DiscoverySourcesServerTransport) dispatchBeginDelete(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoverySources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -223,7 +223,7 @@ func (d *DiscoverySourcesServerTransport) dispatchGet(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoverySources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -262,7 +262,7 @@ func (d *DiscoverySourcesServerTransport) dispatchNewListByMapsResourcePager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoverySources` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -303,7 +303,7 @@ func (d *DiscoverySourcesServerTransport) dispatchBeginUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoverySources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdependencymap.DiscoverySourceResourceTagsUpdate](req) diff --git a/sdk/resourcemanager/dependencymap/armdependencymap/fake/maps_server.go b/sdk/resourcemanager/dependencymap/armdependencymap/fake/maps_server.go index 7bd15390ff81..df5086f77ad1 100644 --- a/sdk/resourcemanager/dependencymap/armdependencymap/fake/maps_server.go +++ b/sdk/resourcemanager/dependencymap/armdependencymap/fake/maps_server.go @@ -165,7 +165,7 @@ func (m *MapsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdependencymap.MapsResource](req) @@ -213,7 +213,7 @@ func (m *MapsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Resp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -257,7 +257,7 @@ func (m *MapsServerTransport) dispatchBeginExportDependencies(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/exportDependencies` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdependencymap.ExportDependenciesRequest](req) @@ -303,7 +303,7 @@ func (m *MapsServerTransport) dispatchGet(req *http.Request) (*http.Response, er const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -338,7 +338,7 @@ func (m *MapsServerTransport) dispatchBeginGetConnectionsForProcessOnFocusedMach const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getConnectionsForProcessOnFocusedMachine` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdependencymap.GetConnectionsForProcessOnFocusedMachineRequest](req) @@ -386,7 +386,7 @@ func (m *MapsServerTransport) dispatchBeginGetConnectionsWithConnectedMachineFor const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getConnectionsWithConnectedMachineForFocusedMachine` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdependencymap.GetConnectionsWithConnectedMachineForFocusedMachineRequest](req) @@ -434,7 +434,7 @@ func (m *MapsServerTransport) dispatchBeginGetDependencyViewForFocusedMachine(re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getDependencyViewForFocusedMachine` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdependencymap.GetDependencyViewForFocusedMachineRequest](req) @@ -482,7 +482,7 @@ func (m *MapsServerTransport) dispatchNewListByResourceGroupPager(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -519,7 +519,7 @@ func (m *MapsServerTransport) dispatchNewListBySubscriptionPager(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := m.srv.NewListBySubscriptionPager(nil) @@ -552,7 +552,7 @@ func (m *MapsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Resp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DependencyMap/maps/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdependencymap.MapsResourceTagsUpdate](req) diff --git a/sdk/resourcemanager/dependencymap/armdependencymap/models.go b/sdk/resourcemanager/dependencymap/armdependencymap/models.go index 76f4ffeef125..ddc09defa7dd 100644 --- a/sdk/resourcemanager/dependencymap/armdependencymap/models.go +++ b/sdk/resourcemanager/dependencymap/armdependencymap/models.go @@ -183,7 +183,9 @@ func (o *OffAzureDiscoverySourceResourceProperties) GetDiscoverySourceResourcePr } } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 diff --git a/sdk/resourcemanager/dependencymap/armdependencymap/tsp-location.yaml b/sdk/resourcemanager/dependencymap/armdependencymap/tsp-location.yaml index fa293b2599f5..716c2be44ed9 100644 --- a/sdk/resourcemanager/dependencymap/armdependencymap/tsp-location.yaml +++ b/sdk/resourcemanager/dependencymap/armdependencymap/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/azuredependencymap/DependencyMap.Management -commit: a730aea13a0bb551748ab41f5d36f00956f0a4f6 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md b/sdk/resourcemanager/deviceregistry/armdeviceregistry/CHANGELOG.md index 4d58f300b978..133dd44fd511 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-05-13) +### 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/fake/assetendpointprofiles_server.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assetendpointprofiles_server.go index 00771eb37e2c..30a858c4f767 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assetendpointprofiles_server.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assetendpointprofiles_server.go @@ -133,7 +133,7 @@ func (a *AssetEndpointProfilesServerTransport) dispatchBeginCreateOrReplace(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/assetEndpointProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdeviceregistry.AssetEndpointProfile](req) @@ -181,7 +181,7 @@ func (a *AssetEndpointProfilesServerTransport) dispatchBeginDelete(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/assetEndpointProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -223,7 +223,7 @@ func (a *AssetEndpointProfilesServerTransport) dispatchGet(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/assetEndpointProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -258,7 +258,7 @@ func (a *AssetEndpointProfilesServerTransport) dispatchNewListByResourceGroupPag const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/assetEndpointProfiles` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -295,7 +295,7 @@ func (a *AssetEndpointProfilesServerTransport) dispatchNewListBySubscriptionPage const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/assetEndpointProfiles` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := a.srv.NewListBySubscriptionPager(nil) @@ -328,7 +328,7 @@ func (a *AssetEndpointProfilesServerTransport) dispatchBeginUpdate(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/assetEndpointProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdeviceregistry.AssetEndpointProfileUpdate](req) diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assets_server.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assets_server.go index c5b80ba71ae5..5c4aabeb1555 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assets_server.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/assets_server.go @@ -133,7 +133,7 @@ func (a *AssetsServerTransport) dispatchBeginCreateOrReplace(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/assets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdeviceregistry.Asset](req) @@ -181,7 +181,7 @@ func (a *AssetsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/assets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -223,7 +223,7 @@ func (a *AssetsServerTransport) dispatchGet(req *http.Request) (*http.Response, const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/assets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -258,7 +258,7 @@ func (a *AssetsServerTransport) dispatchNewListByResourceGroupPager(req *http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/assets` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -295,7 +295,7 @@ func (a *AssetsServerTransport) dispatchNewListBySubscriptionPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/assets` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := a.srv.NewListBySubscriptionPager(nil) @@ -328,7 +328,7 @@ func (a *AssetsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/assets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdeviceregistry.AssetUpdate](req) diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/billingcontainers_server.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/billingcontainers_server.go index 53e05d5df94f..2403839b5357 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/billingcontainers_server.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/billingcontainers_server.go @@ -99,7 +99,7 @@ func (b *BillingContainersServerTransport) dispatchGet(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/billingContainers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } billingContainerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("billingContainerName")]) @@ -130,7 +130,7 @@ func (b *BillingContainersServerTransport) dispatchNewListBySubscriptionPager(re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/billingContainers` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := b.srv.NewListBySubscriptionPager(nil) diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/operationstatus_server.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/operationstatus_server.go index 4ec20aeea977..2e693f1bb8c7 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/operationstatus_server.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/operationstatus_server.go @@ -88,7 +88,7 @@ func (o *OperationStatusServerTransport) dispatchGet(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DeviceRegistry/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationStatuses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/time_rfc3339.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/deviceregistry/armdeviceregistry/models.go b/sdk/resourcemanager/deviceregistry/armdeviceregistry/models.go index f15645d0530e..cc5187033645 100644 --- a/sdk/resourcemanager/deviceregistry/armdeviceregistry/models.go +++ b/sdk/resourcemanager/deviceregistry/armdeviceregistry/models.go @@ -493,7 +493,9 @@ type MessageSchemaReference struct { SchemaVersion *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 diff --git a/sdk/resourcemanager/deviceregistry/armdeviceregistry/tsp-location.yaml b/sdk/resourcemanager/deviceregistry/armdeviceregistry/tsp-location.yaml index f6af95165e4f..d93a64f0d01f 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: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/CHANGELOG.md index ff3cd4b4c66f..8969379f5d3b 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-05-13) +### 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/imageversions_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go index f1deb466d4ac..0d005133385c 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/imageversions_server.go @@ -94,7 +94,7 @@ func (i *ImageVersionsServerTransport) dispatchNewListByImagePager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/images/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/versions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/pools_server.go index 170370591c3f..92874f2835b6 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 len(matches) < 2 { + 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")} @@ -133,7 +168,7 @@ func (p *PoolsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdevopsinfrastructure.Pool](req) @@ -181,7 +216,7 @@ func (p *PoolsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -223,7 +258,7 @@ func (p *PoolsServerTransport) dispatchGet(req *http.Request) (*http.Response, e const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -258,7 +293,7 @@ func (p *PoolsServerTransport) dispatchNewListByResourceGroupPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -295,7 +330,7 @@ func (p *PoolsServerTransport) dispatchNewListBySubscriptionPager(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := p.srv.NewListBySubscriptionPager(nil) @@ -328,7 +363,7 @@ func (p *PoolsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdevopsinfrastructure.PoolUpdate](req) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go index 1c8b334fc009..97adafb6c7fe 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/resourcedetails_server.go @@ -94,7 +94,7 @@ func (r *ResourceDetailsServerTransport) dispatchNewListByPoolPager(req *http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/pools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resources` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go index 77e4b048e3a6..6a651f4f2a77 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/sku_server.go @@ -94,7 +94,7 @@ func (s *SKUServerTransport) dispatchNewListByLocationPager(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("locationName")]) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go index 3cf219301c20..b8219619600e 100644 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go +++ b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/subscriptionusages_server.go @@ -94,7 +94,7 @@ func (s *SubscriptionUsagesServerTransport) dispatchNewUsagesPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DevOpsInfrastructure/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/usages` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) diff --git a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go b/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/devopsinfrastructure/armdevopsinfrastructure/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/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..00bf6a788af0 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 @@ -196,14 +220,16 @@ type NetworkProfile struct { SubnetID *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 +276,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 +348,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 +621,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..8d2c429f7cc1 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: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs additionalDirectories: diff --git a/sdk/resourcemanager/durabletask/armdurabletask/CHANGELOG.md b/sdk/resourcemanager/durabletask/armdurabletask/CHANGELOG.md index f098324d1648..d83aa61125ac 100644 --- a/sdk/resourcemanager/durabletask/armdurabletask/CHANGELOG.md +++ b/sdk/resourcemanager/durabletask/armdurabletask/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.2.1 (2025-05-13) +### Other Changes + + ## 0.2.0 (2025-04-15) ### Features Added diff --git a/sdk/resourcemanager/durabletask/armdurabletask/constants.go b/sdk/resourcemanager/durabletask/armdurabletask/constants.go index 77ab322ab146..7c1717d06c2f 100644 --- a/sdk/resourcemanager/durabletask/armdurabletask/constants.go +++ b/sdk/resourcemanager/durabletask/armdurabletask/constants.go @@ -6,7 +6,7 @@ package armdurabletask const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/durabletask/armdurabletask" - moduleVersion = "v0.2.0" + moduleVersion = "v0.2.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -107,7 +107,7 @@ func PossibleProvisioningStateValues() []ProvisioningState { type PurgeableOrchestrationState string const ( - // PurgeableOrchestrationStateCanceled - The orchestration is terminated + // PurgeableOrchestrationStateCanceled - The orchestration is canceled PurgeableOrchestrationStateCanceled PurgeableOrchestrationState = "Canceled" // PurgeableOrchestrationStateCompleted - The orchestration is completed PurgeableOrchestrationStateCompleted PurgeableOrchestrationState = "Completed" diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/retentionpolicies_server.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/retentionpolicies_server.go index 7ae13b7c9f34..8659ff50ed37 100644 --- a/sdk/resourcemanager/durabletask/armdurabletask/fake/retentionpolicies_server.go +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/retentionpolicies_server.go @@ -125,7 +125,7 @@ func (r *RetentionPoliciesServerTransport) dispatchBeginCreateOrReplace(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/retentionPolicies/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdurabletask.RetentionPolicy](req) @@ -173,7 +173,7 @@ func (r *RetentionPoliciesServerTransport) dispatchBeginDelete(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/retentionPolicies/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -215,7 +215,7 @@ func (r *RetentionPoliciesServerTransport) dispatchGet(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/retentionPolicies/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -250,7 +250,7 @@ func (r *RetentionPoliciesServerTransport) dispatchNewListBySchedulerPager(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/retentionPolicies` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -291,7 +291,7 @@ func (r *RetentionPoliciesServerTransport) dispatchBeginUpdate(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/retentionPolicies/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdurabletask.RetentionPolicy](req) diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/schedulers_server.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/schedulers_server.go index 6ea95ca938b0..149152cd0816 100644 --- a/sdk/resourcemanager/durabletask/armdurabletask/fake/schedulers_server.go +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/schedulers_server.go @@ -133,7 +133,7 @@ func (s *SchedulersServerTransport) dispatchBeginCreateOrUpdate(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdurabletask.Scheduler](req) @@ -181,7 +181,7 @@ func (s *SchedulersServerTransport) dispatchBeginDelete(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -223,7 +223,7 @@ func (s *SchedulersServerTransport) dispatchGet(req *http.Request) (*http.Respon const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -258,7 +258,7 @@ func (s *SchedulersServerTransport) dispatchNewListByResourceGroupPager(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -295,7 +295,7 @@ func (s *SchedulersServerTransport) dispatchNewListBySubscriptionPager(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := s.srv.NewListBySubscriptionPager(nil) @@ -328,7 +328,7 @@ func (s *SchedulersServerTransport) dispatchBeginUpdate(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdurabletask.SchedulerUpdate](req) diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/taskhubs_server.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/taskhubs_server.go index 07438a60184c..e370102af862 100644 --- a/sdk/resourcemanager/durabletask/armdurabletask/fake/taskhubs_server.go +++ b/sdk/resourcemanager/durabletask/armdurabletask/fake/taskhubs_server.go @@ -117,7 +117,7 @@ func (t *TaskHubsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskHubs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armdurabletask.TaskHub](req) @@ -169,7 +169,7 @@ func (t *TaskHubsServerTransport) dispatchBeginDelete(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskHubs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -215,7 +215,7 @@ func (t *TaskHubsServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskHubs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -254,7 +254,7 @@ func (t *TaskHubsServerTransport) dispatchNewListBySchedulerPager(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DurableTask/schedulers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/taskHubs` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/durabletask/armdurabletask/fake/time_rfc3339.go b/sdk/resourcemanager/durabletask/armdurabletask/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/durabletask/armdurabletask/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) - -const ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - if len(data) == 0 { - return nil - } - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/durabletask/armdurabletask/models.go b/sdk/resourcemanager/durabletask/armdurabletask/models.go index b45b7375e077..d3a7322c0ea7 100644 --- a/sdk/resourcemanager/durabletask/armdurabletask/models.go +++ b/sdk/resourcemanager/durabletask/armdurabletask/models.go @@ -6,7 +6,9 @@ package armdurabletask import "time" -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 diff --git a/sdk/resourcemanager/durabletask/armdurabletask/tsp-location.yaml b/sdk/resourcemanager/durabletask/armdurabletask/tsp-location.yaml index 569d0255b202..4d7a3b0ef903 100644 --- a/sdk/resourcemanager/durabletask/armdurabletask/tsp-location.yaml +++ b/sdk/resourcemanager/durabletask/armdurabletask/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/durabletask/DurableTask.Management -commit: 95eda2b9a673690afab68824d5d68b09c026dcdd +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md b/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md index ca1869b2b5e7..80223ca8efbc 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md +++ b/sdk/resourcemanager/edgezones/armedgezones/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.1 (2025-05-13) +### Other Changes + + ## 0.1.0 (2024-07-08) ### Other Changes diff --git a/sdk/resourcemanager/edgezones/armedgezones/constants.go b/sdk/resourcemanager/edgezones/armedgezones/constants.go index 63895bc68229..252cf1ee0675 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/constants.go +++ b/sdk/resourcemanager/edgezones/armedgezones/constants.go @@ -6,7 +6,7 @@ package armedgezones const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones" - moduleVersion = "v0.1.0" + moduleVersion = "v0.1.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go b/sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go new file mode 100644 index 000000000000..fd5ddbe17eca --- /dev/null +++ b/sdk/resourcemanager/edgezones/armedgezones/extendedzones_client_example_test.go @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armedgezones_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones" + "log" +) + +// Generated from example definition: 2024-04-01-preview/ExtendedZones_Get.json +func ExampleExtendedZonesClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExtendedZonesClient().Get(ctx, "losangeles", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armedgezones.ExtendedZonesClientGetResponse{ + // ExtendedZone: &armedgezones.ExtendedZone{ + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStateNotRegistered), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-04-01-preview/ExtendedZones_ListBySubscription.json +func ExampleExtendedZonesClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewExtendedZonesClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armedgezones.ExtendedZonesClientListBySubscriptionResponse{ + // ExtendedZoneListResult: armedgezones.ExtendedZoneListResult{ + // Value: []*armedgezones.ExtendedZone{ + // { + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/redmond"), + // Name: to.Ptr("redmond"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStateNotRegistered), + // DisplayName: to.Ptr("Redmond"), + // RegionalDisplayName: to.Ptr("(US) Redmond"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-122.03197"), + // Latitude: to.Ptr("47.69106"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // { + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStateNotRegistered), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2024-04-01-preview/ExtendedZones_Register.json +func ExampleExtendedZonesClient_Register() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExtendedZonesClient().Register(ctx, "losangeles", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armedgezones.ExtendedZonesClientRegisterResponse{ + // ExtendedZone: &armedgezones.ExtendedZone{ + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStatePendingRegister), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // } +} + +// Generated from example definition: 2024-04-01-preview/ExtendedZones_Unregister.json +func ExampleExtendedZonesClient_Unregister() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("a1ffc958-d2c7-493e-9f1e-125a0477f536", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExtendedZonesClient().Unregister(ctx, "losangeles", nil) + if err != nil { + log.Fatalf("failed to finish the request: %v", err) + } + // You could use response here. We use blank identifier for just demo purposes. + _ = res + // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // res = armedgezones.ExtendedZonesClientUnregisterResponse{ + // ExtendedZone: &armedgezones.ExtendedZone{ + // ID: to.Ptr("/subscriptions/a1ffc958-d2c7-493e-9f1e-125a0477f536/providers/Microsoft.EdgeZones/extendedZones/losangeles"), + // Name: to.Ptr("losangeles"), + // Type: to.Ptr("Microsoft.EdgeZones/extendedZones"), + // Properties: &armedgezones.ExtendedZoneProperties{ + // ProvisioningState: to.Ptr(armedgezones.ProvisioningStateSucceeded), + // RegistrationState: to.Ptr(armedgezones.RegistrationStatePendingUnregister), + // DisplayName: to.Ptr("Los Angeles"), + // RegionalDisplayName: to.Ptr("(US) Los Angeles"), + // RegionType: to.Ptr("Physical"), + // RegionCategory: to.Ptr("Other"), + // Geography: to.Ptr("usa"), + // GeographyGroup: to.Ptr("US"), + // Longitude: to.Ptr("-118.23537"), + // Latitude: to.Ptr("34.058414"), + // HomeLocation: to.Ptr("westus"), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/edgezones/armedgezones/fake/extendedzones_server.go b/sdk/resourcemanager/edgezones/armedgezones/fake/extendedzones_server.go index a7afa6c3916b..df93494c2199 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/fake/extendedzones_server.go +++ b/sdk/resourcemanager/edgezones/armedgezones/fake/extendedzones_server.go @@ -66,23 +66,42 @@ func (e *ExtendedZonesServerTransport) Do(req *http.Request) (*http.Response, er } func (e *ExtendedZonesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error - - switch method { - case "ExtendedZonesClient.Get": - resp, err = e.dispatchGet(req) - case "ExtendedZonesClient.NewListBySubscriptionPager": - resp, err = e.dispatchNewListBySubscriptionPager(req) - case "ExtendedZonesClient.Register": - resp, err = e.dispatchRegister(req) - case "ExtendedZonesClient.Unregister": - resp, err = e.dispatchUnregister(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - return resp, err + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if extendedZonesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = extendedZonesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ExtendedZonesClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "ExtendedZonesClient.NewListBySubscriptionPager": + res.resp, res.err = e.dispatchNewListBySubscriptionPager(req) + case "ExtendedZonesClient.Register": + res.resp, res.err = e.dispatchRegister(req) + case "ExtendedZonesClient.Unregister": + res.resp, res.err = e.dispatchUnregister(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (e *ExtendedZonesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -92,7 +111,7 @@ func (e *ExtendedZonesServerTransport) dispatchGet(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeZones/extendedZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } extendedZoneNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extendedZoneName")]) @@ -123,7 +142,7 @@ func (e *ExtendedZonesServerTransport) dispatchNewListBySubscriptionPager(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeZones/extendedZones` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := e.srv.NewListBySubscriptionPager(nil) @@ -154,7 +173,7 @@ func (e *ExtendedZonesServerTransport) dispatchRegister(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeZones/extendedZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/register` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } extendedZoneNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extendedZoneName")]) @@ -183,7 +202,7 @@ func (e *ExtendedZonesServerTransport) dispatchUnregister(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.EdgeZones/extendedZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/unregister` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } extendedZoneNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("extendedZoneName")]) @@ -204,3 +223,9 @@ func (e *ExtendedZonesServerTransport) dispatchUnregister(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to ExtendedZonesServerTransport +var extendedZonesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/edgezones/armedgezones/fake/internal.go b/sdk/resourcemanager/edgezones/armedgezones/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/fake/internal.go +++ b/sdk/resourcemanager/edgezones/armedgezones/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/edgezones/armedgezones/fake/operations_server.go b/sdk/resourcemanager/edgezones/armedgezones/fake/operations_server.go index ce9c5fa14931..63dddb8e075e 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/fake/operations_server.go +++ b/sdk/resourcemanager/edgezones/armedgezones/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/edgezones/armedgezones/fake/time_rfc3339.go b/sdk/resourcemanager/edgezones/armedgezones/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/edgezones/armedgezones/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/edgezones/armedgezones/go.mod b/sdk/resourcemanager/edgezones/armedgezones/go.mod index 6562f785cbce..453dfbb41304 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/go.mod +++ b/sdk/resourcemanager/edgezones/armedgezones/go.mod @@ -4,13 +4,13 @@ go 1.23.0 require ( github.com/Azure/azure-sdk-for-go/sdk/azcore v1.17.1 + github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.1 github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3 v3.1.0 github.com/stretchr/testify v1.10.0 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.8.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources v1.2.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.4.2 // indirect github.com/davecgh/go-spew v1.1.1 // indirect diff --git a/sdk/resourcemanager/edgezones/armedgezones/models.go b/sdk/resourcemanager/edgezones/armedgezones/models.go index 8545bdd4066e..299e1e0635a6 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/models.go +++ b/sdk/resourcemanager/edgezones/armedgezones/models.go @@ -69,14 +69,16 @@ type ExtendedZoneProperties struct { RegistrationState *RegistrationState } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 - // 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 @@ -92,17 +94,19 @@ type Operation struct { // OperationDisplay - Localized display information for and operation. type OperationDisplay struct { - // The short, localized friendly description of the operation; suitable for tool tips and detailed views. + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual Machine", - // "Restart Virtual Machine". + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". Operation *string - // The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft Compute". + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". Provider *string - // The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job Schedule Collections". + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". Resource *string } diff --git a/sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go b/sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go new file mode 100644 index 000000000000..bee1cac63758 --- /dev/null +++ b/sdk/resourcemanager/edgezones/armedgezones/operations_client_example_test.go @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armedgezones_test + +import ( + "context" + "github.com/Azure/azure-sdk-for-go/sdk/azidentity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/edgezones/armedgezones" + "log" +) + +// Generated from example definition: 2024-04-01-preview/Operations_List.json +func ExampleOperationsClient_NewListPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armedgezones.NewClientFactory("", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOperationsClient().NewListPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armedgezones.OperationsClientListResponse{ + // OperationListResult: armedgezones.OperationListResult{ + // Value: []*armedgezones.Operation{ + // { + // Name: to.Ptr("Microsoft.EdgeZones/extendedZones/read"), + // Display: &armedgezones.OperationDisplay{ + // Provider: to.Ptr("Microsoft.EdgeZones"), + // Resource: to.Ptr("extendedZones"), + // Operation: to.Ptr("read"), + // }, + // }, + // }, + // }, + // } + } +} diff --git a/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml b/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml index 5f0bfa9f57a2..5e9d4047b5ad 100644 --- a/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml +++ b/sdk/resourcemanager/edgezones/armedgezones/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/edgezones/EdgeZones.Management -commit: ab064e0047ec560a700d6b501097d99471ad817b -repo: https://github.com/Azure/azure-rest-api-specs -additionalDirectories: +commit: 079f70d6f2b754db6b736e117196104efd2dd496 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md b/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md index ca9847d062ac..a8c3881b656f 100644 --- a/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md +++ b/sdk/resourcemanager/fabric/armfabric/CHANGELOG.md @@ -1,5 +1,14 @@ # Release History +## 1.1.0-beta.1 (2025-05-13) +### Features Added + +- New function `*CapacitiesClient.NewListUsagesPager(string, *CapacitiesClientListUsagesOptions) *runtime.Pager[CapacitiesClientListUsagesResponse]` +- New struct `PagedQuota` +- New struct `Quota` +- New struct `QuotaName` + + ## 1.0.0 (2024-10-22) ### Other Changes diff --git a/sdk/resourcemanager/fabric/armfabric/capacities_client.go b/sdk/resourcemanager/fabric/armfabric/capacities_client.go index 53232ffbf5ad..458c3985e5c5 100644 --- a/sdk/resourcemanager/fabric/armfabric/capacities_client.go +++ b/sdk/resourcemanager/fabric/armfabric/capacities_client.go @@ -42,8 +42,8 @@ func NewCapacitiesClient(subscriptionID string, credential azcore.TokenCredentia // CheckNameAvailability - Implements local CheckNameAvailability operations // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 -// - location - The location name. +// Generated from API version 2025-01-15-preview +// - location - The name of the Azure region. // - body - The CheckAvailability request // - options - CapacitiesClientCheckNameAvailabilityOptions contains the optional parameters for the CapacitiesClient.CheckNameAvailability // method. @@ -85,7 +85,7 @@ func (client *CapacitiesClient) checkNameAvailabilityCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -107,7 +107,7 @@ func (client *CapacitiesClient) checkNameAvailabilityHandleResponse(resp *http.R // BeginCreateOrUpdate - Create a FabricCapacity // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - capacityName - The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a maximum of 63. // - resource - Resource create parameters. @@ -133,7 +133,7 @@ func (client *CapacitiesClient) BeginCreateOrUpdate(ctx context.Context, resourc // CreateOrUpdate - Create a FabricCapacity // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview func (client *CapacitiesClient) createOrUpdate(ctx context.Context, resourceGroupName string, capacityName string, resource Capacity, options *CapacitiesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CapacitiesClient.BeginCreateOrUpdate" @@ -175,7 +175,7 @@ func (client *CapacitiesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -188,7 +188,7 @@ func (client *CapacitiesClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Delete a FabricCapacity // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - capacityName - The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a maximum of 63. // - options - CapacitiesClientBeginDeleteOptions contains the optional parameters for the CapacitiesClient.BeginDelete method. @@ -212,7 +212,7 @@ func (client *CapacitiesClient) BeginDelete(ctx context.Context, resourceGroupNa // Delete - Delete a FabricCapacity // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview func (client *CapacitiesClient) deleteOperation(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CapacitiesClient.BeginDelete" @@ -254,7 +254,7 @@ func (client *CapacitiesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -263,7 +263,7 @@ func (client *CapacitiesClient) deleteCreateRequest(ctx context.Context, resourc // Get - Get a FabricCapacity // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - capacityName - The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a maximum of 63. // - options - CapacitiesClientGetOptions contains the optional parameters for the CapacitiesClient.Get method. @@ -309,7 +309,7 @@ func (client *CapacitiesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -326,7 +326,7 @@ func (client *CapacitiesClient) getHandleResponse(resp *http.Response) (Capaciti // NewListByResourceGroupPager - List FabricCapacity resources by resource group // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CapacitiesClientListByResourceGroupOptions contains the optional parameters for the CapacitiesClient.NewListByResourceGroupPager // method. @@ -369,7 +369,7 @@ func (client *CapacitiesClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -386,7 +386,7 @@ func (client *CapacitiesClient) listByResourceGroupHandleResponse(resp *http.Res // NewListBySubscriptionPager - List FabricCapacity resources by subscription ID // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview // - options - CapacitiesClientListBySubscriptionOptions contains the optional parameters for the CapacitiesClient.NewListBySubscriptionPager // method. func (client *CapacitiesClient) NewListBySubscriptionPager(options *CapacitiesClientListBySubscriptionOptions) *runtime.Pager[CapacitiesClientListBySubscriptionResponse] { @@ -424,7 +424,7 @@ func (client *CapacitiesClient) listBySubscriptionCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -441,7 +441,7 @@ func (client *CapacitiesClient) listBySubscriptionHandleResponse(resp *http.Resp // NewListSKUsPager - List eligible SKUs for Microsoft Fabric resource provider // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview // - options - CapacitiesClientListSKUsOptions contains the optional parameters for the CapacitiesClient.NewListSKUsPager method. func (client *CapacitiesClient) NewListSKUsPager(options *CapacitiesClientListSKUsOptions) *runtime.Pager[CapacitiesClientListSKUsResponse] { return runtime.NewPager(runtime.PagingHandler[CapacitiesClientListSKUsResponse]{ @@ -478,7 +478,7 @@ func (client *CapacitiesClient) listSKUsCreateRequest(ctx context.Context, _ *Ca return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -495,7 +495,7 @@ func (client *CapacitiesClient) listSKUsHandleResponse(resp *http.Response) (Cap // NewListSKUsForCapacityPager - List eligible SKUs for a Microsoft Fabric resource // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - capacityName - The name of the capacity. // - options - CapacitiesClientListSKUsForCapacityOptions contains the optional parameters for the CapacitiesClient.NewListSKUsForCapacityPager @@ -543,7 +543,7 @@ func (client *CapacitiesClient) listSKUsForCapacityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -558,10 +558,70 @@ func (client *CapacitiesClient) listSKUsForCapacityHandleResponse(resp *http.Res return result, nil } +// NewListUsagesPager - List the current consumption and limit in this location for the provided subscription +// +// Generated from API version 2025-01-15-preview +// - location - The location name. +// - options - CapacitiesClientListUsagesOptions contains the optional parameters for the CapacitiesClient.NewListUsagesPager +// method. +func (client *CapacitiesClient) NewListUsagesPager(location string, options *CapacitiesClientListUsagesOptions) *runtime.Pager[CapacitiesClientListUsagesResponse] { + return runtime.NewPager(runtime.PagingHandler[CapacitiesClientListUsagesResponse]{ + More: func(page CapacitiesClientListUsagesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CapacitiesClientListUsagesResponse) (CapacitiesClientListUsagesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CapacitiesClient.NewListUsagesPager") + 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.listUsagesCreateRequest(ctx, location, options) + }, nil) + if err != nil { + return CapacitiesClientListUsagesResponse{}, err + } + return client.listUsagesHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listUsagesCreateRequest creates the ListUsages request. +func (client *CapacitiesClient) listUsagesCreateRequest(ctx context.Context, location string, _ *CapacitiesClientListUsagesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Fabric/locations/{location}/usages" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-01-15-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listUsagesHandleResponse handles the ListUsages response. +func (client *CapacitiesClient) listUsagesHandleResponse(resp *http.Response) (CapacitiesClientListUsagesResponse, error) { + result := CapacitiesClientListUsagesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PagedQuota); err != nil { + return CapacitiesClientListUsagesResponse{}, err + } + return result, nil +} + // BeginResume - Resume operation of the specified Fabric capacity instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - capacityName - The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a maximum of 63. // - options - CapacitiesClientBeginResumeOptions contains the optional parameters for the CapacitiesClient.BeginResume method. @@ -585,7 +645,7 @@ func (client *CapacitiesClient) BeginResume(ctx context.Context, resourceGroupNa // Resume - Resume operation of the specified Fabric capacity instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview func (client *CapacitiesClient) resume(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientBeginResumeOptions) (*http.Response, error) { var err error const operationName = "CapacitiesClient.BeginResume" @@ -627,7 +687,7 @@ func (client *CapacitiesClient) resumeCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -636,7 +696,7 @@ func (client *CapacitiesClient) resumeCreateRequest(ctx context.Context, resourc // BeginSuspend - Suspend operation of the specified Fabric capacity instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - capacityName - The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a maximum of 63. // - options - CapacitiesClientBeginSuspendOptions contains the optional parameters for the CapacitiesClient.BeginSuspend method. @@ -660,7 +720,7 @@ func (client *CapacitiesClient) BeginSuspend(ctx context.Context, resourceGroupN // Suspend - Suspend operation of the specified Fabric capacity instance. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview func (client *CapacitiesClient) suspend(ctx context.Context, resourceGroupName string, capacityName string, options *CapacitiesClientBeginSuspendOptions) (*http.Response, error) { var err error const operationName = "CapacitiesClient.BeginSuspend" @@ -702,7 +762,7 @@ func (client *CapacitiesClient) suspendCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -711,7 +771,7 @@ func (client *CapacitiesClient) suspendCreateRequest(ctx context.Context, resour // BeginUpdate - Update a FabricCapacity // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - capacityName - The name of the Microsoft Fabric capacity. It must be a minimum of 3 characters, and a maximum of 63. // - properties - The resource properties to be updated. @@ -736,7 +796,7 @@ func (client *CapacitiesClient) BeginUpdate(ctx context.Context, resourceGroupNa // Update - Update a FabricCapacity // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-11-01 +// Generated from API version 2025-01-15-preview func (client *CapacitiesClient) update(ctx context.Context, resourceGroupName string, capacityName string, properties CapacityUpdate, options *CapacitiesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CapacitiesClient.BeginUpdate" @@ -778,7 +838,7 @@ func (client *CapacitiesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-11-01") + reqQP.Set("api-version", "2025-01-15-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/fabric/armfabric/capacities_client_example_test.go b/sdk/resourcemanager/fabric/armfabric/capacities_client_example_test.go index 58b8beee0c84..3ca525439d01 100644 --- a/sdk/resourcemanager/fabric/armfabric/capacities_client_example_test.go +++ b/sdk/resourcemanager/fabric/armfabric/capacities_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2023-11-01/FabricCapacities_CheckNameAvailability.json +// Generated from example definition: 2025-01-15-preview/FabricCapacities_CheckNameAvailability.json func ExampleCapacitiesClient_CheckNameAvailability() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -40,7 +40,7 @@ func ExampleCapacitiesClient_CheckNameAvailability() { // } } -// Generated from example definition: 2023-11-01/FabricCapacities_CreateOrUpdate.json +// Generated from example definition: 2025-01-15-preview/FabricCapacities_CreateOrUpdate.json func ExampleCapacitiesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -103,7 +103,7 @@ func ExampleCapacitiesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: 2023-11-01/FabricCapacities_Delete.json +// Generated from example definition: 2025-01-15-preview/FabricCapacities_Delete.json func ExampleCapacitiesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -124,7 +124,7 @@ func ExampleCapacitiesClient_BeginDelete() { } } -// Generated from example definition: 2023-11-01/FabricCapacities_Get.json +// Generated from example definition: 2025-01-15-preview/FabricCapacities_Get.json func ExampleCapacitiesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -168,7 +168,7 @@ func ExampleCapacitiesClient_Get() { // } } -// Generated from example definition: 2023-11-01/FabricCapacities_ListByResourceGroup.json +// Generated from example definition: 2025-01-15-preview/FabricCapacities_ListByResourceGroup.json func ExampleCapacitiesClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -242,7 +242,7 @@ func ExampleCapacitiesClient_NewListByResourceGroupPager() { } } -// Generated from example definition: 2023-11-01/FabricCapacities_ListBySubscription.json +// Generated from example definition: 2025-01-15-preview/FabricCapacities_ListBySubscription.json func ExampleCapacitiesClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -316,7 +316,7 @@ func ExampleCapacitiesClient_NewListBySubscriptionPager() { } } -// Generated from example definition: 2023-11-01/FabricCapacities_ListSkus.json +// Generated from example definition: 2025-01-15-preview/FabricCapacities_ListSkus.json func ExampleCapacitiesClient_NewListSKUsPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -375,7 +375,7 @@ func ExampleCapacitiesClient_NewListSKUsPager() { } } -// Generated from example definition: 2023-11-01/FabricCapacities_ListSkusForCapacity.json +// Generated from example definition: 2025-01-15-preview/FabricCapacities_ListSkusForCapacity.json func ExampleCapacitiesClient_NewListSKUsForCapacityPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -483,7 +483,47 @@ func ExampleCapacitiesClient_NewListSKUsForCapacityPager() { } } -// Generated from example definition: 2023-11-01/FabricCapacities_Resume.json +// Generated from example definition: 2025-01-15-preview/FabricCapacities_ListUsagesBySubscription.json +func ExampleCapacitiesClient_NewListUsagesPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armfabric.NewClientFactory("548B7FB7-3B2A-4F46-BB02-66473F1FC22C", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewCapacitiesClient().NewListUsagesPager("centraluseuap", 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 = armfabric.CapacitiesClientListUsagesResponse{ + // PagedQuota: armfabric.PagedQuota{ + // Value: []*armfabric.Quota{ + // { + // Name: &armfabric.QuotaName{ + // Value: to.Ptr("CapacityQuota"), + // LocalizedValue: to.Ptr("CapacityQuota"), + // }, + // Unit: to.Ptr("CU"), + // CurrentValue: to.Ptr[int64](378), + // Limit: to.Ptr[int64](512), + // }, + // }, + // }, + // } + } +} + +// Generated from example definition: 2025-01-15-preview/FabricCapacities_Resume.json func ExampleCapacitiesClient_BeginResume() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -509,7 +549,7 @@ func ExampleCapacitiesClient_BeginResume() { // } } -// Generated from example definition: 2023-11-01/FabricCapacities_Suspend.json +// Generated from example definition: 2025-01-15-preview/FabricCapacities_Suspend.json func ExampleCapacitiesClient_BeginSuspend() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -535,7 +575,7 @@ func ExampleCapacitiesClient_BeginSuspend() { // } } -// Generated from example definition: 2023-11-01/FabricCapacities_Update.json +// Generated from example definition: 2025-01-15-preview/FabricCapacities_Update.json func ExampleCapacitiesClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/fabric/armfabric/constants.go b/sdk/resourcemanager/fabric/armfabric/constants.go index c6bf0e2ecc4f..52addf8cfeaa 100644 --- a/sdk/resourcemanager/fabric/armfabric/constants.go +++ b/sdk/resourcemanager/fabric/armfabric/constants.go @@ -6,7 +6,7 @@ package armfabric const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/fabric/armfabric" - moduleVersion = "v1.0.0" + moduleVersion = "v1.1.0-beta.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go b/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go index e9598083e361..1910e2d7babb 100644 --- a/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go +++ b/sdk/resourcemanager/fabric/armfabric/fake/capacities_server.go @@ -29,7 +29,7 @@ type CapacitiesServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, capacityName string, resource armfabric.Capacity, options *armfabric.CapacitiesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CapacitiesClient.BeginDelete - // HTTP status codes to indicate success: http.StatusAccepted, http.StatusNoContent + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginDelete func(ctx context.Context, resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientBeginDeleteOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method CapacitiesClient.Get @@ -52,12 +52,16 @@ type CapacitiesServer struct { // HTTP status codes to indicate success: http.StatusOK NewListSKUsForCapacityPager func(resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientListSKUsForCapacityOptions) (resp azfake.PagerResponder[armfabric.CapacitiesClientListSKUsForCapacityResponse]) + // NewListUsagesPager is the fake for method CapacitiesClient.NewListUsagesPager + // HTTP status codes to indicate success: http.StatusOK + NewListUsagesPager func(location string, options *armfabric.CapacitiesClientListUsagesOptions) (resp azfake.PagerResponder[armfabric.CapacitiesClientListUsagesResponse]) + // BeginResume is the fake for method CapacitiesClient.BeginResume - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginResume func(ctx context.Context, resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientBeginResumeOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientResumeResponse], errResp azfake.ErrorResponder) // BeginSuspend is the fake for method CapacitiesClient.BeginSuspend - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginSuspend func(ctx context.Context, resourceGroupName string, capacityName string, options *armfabric.CapacitiesClientBeginSuspendOptions) (resp azfake.PollerResponder[armfabric.CapacitiesClientSuspendResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method CapacitiesClient.BeginUpdate @@ -77,6 +81,7 @@ func NewCapacitiesServerTransport(srv *CapacitiesServer) *CapacitiesServerTransp newListBySubscriptionPager: newTracker[azfake.PagerResponder[armfabric.CapacitiesClientListBySubscriptionResponse]](), newListSKUsPager: newTracker[azfake.PagerResponder[armfabric.CapacitiesClientListSKUsResponse]](), newListSKUsForCapacityPager: newTracker[azfake.PagerResponder[armfabric.CapacitiesClientListSKUsForCapacityResponse]](), + newListUsagesPager: newTracker[azfake.PagerResponder[armfabric.CapacitiesClientListUsagesResponse]](), beginResume: newTracker[azfake.PollerResponder[armfabric.CapacitiesClientResumeResponse]](), beginSuspend: newTracker[azfake.PollerResponder[armfabric.CapacitiesClientSuspendResponse]](), beginUpdate: newTracker[azfake.PollerResponder[armfabric.CapacitiesClientUpdateResponse]](), @@ -93,6 +98,7 @@ type CapacitiesServerTransport struct { newListBySubscriptionPager *tracker[azfake.PagerResponder[armfabric.CapacitiesClientListBySubscriptionResponse]] newListSKUsPager *tracker[azfake.PagerResponder[armfabric.CapacitiesClientListSKUsResponse]] newListSKUsForCapacityPager *tracker[azfake.PagerResponder[armfabric.CapacitiesClientListSKUsForCapacityResponse]] + newListUsagesPager *tracker[azfake.PagerResponder[armfabric.CapacitiesClientListUsagesResponse]] beginResume *tracker[azfake.PollerResponder[armfabric.CapacitiesClientResumeResponse]] beginSuspend *tracker[azfake.PollerResponder[armfabric.CapacitiesClientSuspendResponse]] beginUpdate *tracker[azfake.PollerResponder[armfabric.CapacitiesClientUpdateResponse]] @@ -110,37 +116,58 @@ func (c *CapacitiesServerTransport) Do(req *http.Request) (*http.Response, error } func (c *CapacitiesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error - - switch method { - case "CapacitiesClient.CheckNameAvailability": - resp, err = c.dispatchCheckNameAvailability(req) - case "CapacitiesClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "CapacitiesClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CapacitiesClient.Get": - resp, err = c.dispatchGet(req) - case "CapacitiesClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "CapacitiesClient.NewListBySubscriptionPager": - resp, err = c.dispatchNewListBySubscriptionPager(req) - case "CapacitiesClient.NewListSKUsPager": - resp, err = c.dispatchNewListSKUsPager(req) - case "CapacitiesClient.NewListSKUsForCapacityPager": - resp, err = c.dispatchNewListSKUsForCapacityPager(req) - case "CapacitiesClient.BeginResume": - resp, err = c.dispatchBeginResume(req) - case "CapacitiesClient.BeginSuspend": - resp, err = c.dispatchBeginSuspend(req) - case "CapacitiesClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - return resp, err + resultChan := make(chan result) + defer close(resultChan) + + go func() { + var intercepted bool + var res result + if capacitiesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = capacitiesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CapacitiesClient.CheckNameAvailability": + res.resp, res.err = c.dispatchCheckNameAvailability(req) + case "CapacitiesClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "CapacitiesClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CapacitiesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CapacitiesClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "CapacitiesClient.NewListBySubscriptionPager": + res.resp, res.err = c.dispatchNewListBySubscriptionPager(req) + case "CapacitiesClient.NewListSKUsPager": + res.resp, res.err = c.dispatchNewListSKUsPager(req) + case "CapacitiesClient.NewListSKUsForCapacityPager": + res.resp, res.err = c.dispatchNewListSKUsForCapacityPager(req) + case "CapacitiesClient.NewListUsagesPager": + res.resp, res.err = c.dispatchNewListUsagesPager(req) + case "CapacitiesClient.BeginResume": + res.resp, res.err = c.dispatchBeginResume(req) + case "CapacitiesClient.BeginSuspend": + res.resp, res.err = c.dispatchBeginSuspend(req) + case "CapacitiesClient.BeginUpdate": + res.resp, res.err = c.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *CapacitiesServerTransport) dispatchCheckNameAvailability(req *http.Request) (*http.Response, error) { @@ -150,7 +177,7 @@ func (c *CapacitiesServerTransport) dispatchCheckNameAvailability(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkNameAvailability` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armfabric.CheckNameAvailabilityRequest](req) @@ -185,7 +212,7 @@ func (c *CapacitiesServerTransport) dispatchBeginCreateOrUpdate(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armfabric.Capacity](req) @@ -233,7 +260,7 @@ func (c *CapacitiesServerTransport) dispatchBeginDelete(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -257,9 +284,9 @@ func (c *CapacitiesServerTransport) dispatchBeginDelete(req *http.Request) (*htt return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginDelete.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginDelete) { c.beginDelete.remove(req) @@ -275,7 +302,7 @@ func (c *CapacitiesServerTransport) dispatchGet(req *http.Request) (*http.Respon const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -310,7 +337,7 @@ func (c *CapacitiesServerTransport) dispatchNewListByResourceGroupPager(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -347,7 +374,7 @@ func (c *CapacitiesServerTransport) dispatchNewListBySubscriptionPager(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := c.srv.NewListBySubscriptionPager(nil) @@ -380,7 +407,7 @@ func (c *CapacitiesServerTransport) dispatchNewListSKUsPager(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/skus` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := c.srv.NewListSKUsPager(nil) @@ -413,7 +440,7 @@ func (c *CapacitiesServerTransport) dispatchNewListSKUsForCapacityPager(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/skus` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -445,6 +472,43 @@ func (c *CapacitiesServerTransport) dispatchNewListSKUsForCapacityPager(req *htt return resp, nil } +func (c *CapacitiesServerTransport) dispatchNewListUsagesPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListUsagesPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListUsagesPager not implemented")} + } + newListUsagesPager := c.newListUsagesPager.get(req) + if newListUsagesPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/usages` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListUsagesPager(locationParam, nil) + newListUsagesPager = &resp + c.newListUsagesPager.add(req, newListUsagesPager) + server.PagerResponderInjectNextLinks(newListUsagesPager, req, func(page *armfabric.CapacitiesClientListUsagesResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListUsagesPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListUsagesPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListUsagesPager) { + c.newListUsagesPager.remove(req) + } + return resp, nil +} + func (c *CapacitiesServerTransport) dispatchBeginResume(req *http.Request) (*http.Response, error) { if c.srv.BeginResume == nil { return nil, &nonRetriableError{errors.New("fake for method BeginResume not implemented")} @@ -454,7 +518,7 @@ func (c *CapacitiesServerTransport) dispatchBeginResume(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resume` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -478,9 +542,9 @@ func (c *CapacitiesServerTransport) dispatchBeginResume(req *http.Request) (*htt return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginResume.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginResume) { c.beginResume.remove(req) @@ -498,7 +562,7 @@ func (c *CapacitiesServerTransport) dispatchBeginSuspend(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/suspend` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -522,9 +586,9 @@ func (c *CapacitiesServerTransport) dispatchBeginSuspend(req *http.Request) (*ht return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { c.beginSuspend.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginSuspend) { c.beginSuspend.remove(req) @@ -542,7 +606,7 @@ func (c *CapacitiesServerTransport) dispatchBeginUpdate(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Fabric/capacities/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armfabric.CapacityUpdate](req) @@ -580,3 +644,9 @@ func (c *CapacitiesServerTransport) dispatchBeginUpdate(req *http.Request) (*htt return resp, nil } + +// set this to conditionally intercept incoming requests to CapacitiesServerTransport +var capacitiesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/fabric/armfabric/fake/internal.go b/sdk/resourcemanager/fabric/armfabric/fake/internal.go index 56a8f624f5f3..7425b6a669e2 100644 --- a/sdk/resourcemanager/fabric/armfabric/fake/internal.go +++ b/sdk/resourcemanager/fabric/armfabric/fake/internal.go @@ -10,6 +10,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } diff --git a/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go b/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go index aef0b331c388..b37b6f368961 100644 --- a/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go +++ b/sdk/resourcemanager/fabric/armfabric/fake/operations_server.go @@ -51,17 +51,36 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error } func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { - var resp *http.Response - var err error + resultChan := make(chan result) + defer close(resultChan) - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() - return resp, err + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -90,3 +109,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/fabric/armfabric/fake/time_rfc3339.go b/sdk/resourcemanager/fabric/armfabric/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/fabric/armfabric/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/fabric/armfabric/models.go b/sdk/resourcemanager/fabric/armfabric/models.go index 618a47a859c2..f629e3d5f6c4 100644 --- a/sdk/resourcemanager/fabric/armfabric/models.go +++ b/sdk/resourcemanager/fabric/armfabric/models.go @@ -100,14 +100,16 @@ type CheckNameAvailabilityResponse struct { Reason *CheckNameAvailabilityReason } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 @@ -149,6 +151,39 @@ type OperationListResult struct { NextLink *string } +// PagedQuota - Paged collection of Quota items +type PagedQuota struct { + // REQUIRED; The Quota items on this page + Value []*Quota + + // The link to the next page of items + NextLink *string +} + +// Quota - Describes Resource Quota +type Quota struct { + // REQUIRED; The current usage of the resource. + CurrentValue *int64 + + // REQUIRED; The maximum permitted usage of the resource. + Limit *int64 + + // REQUIRED; The unit of usage measurement. + Unit *string + + // READ-ONLY; The name of the quota. + Name *QuotaName +} + +// QuotaName - The Quota Names +type QuotaName struct { + // The localized name of the resource. + LocalizedValue *string + + // The name of the resource. + Value *string +} + // RpSKU - Represents the SKU name and Azure pricing tier for Microsoft Fabric capacity resource. type RpSKU struct { // REQUIRED; The name of the SKU level. diff --git a/sdk/resourcemanager/fabric/armfabric/models_serde.go b/sdk/resourcemanager/fabric/armfabric/models_serde.go index e7c7e1dcb1a5..ebbb34b1b0e2 100644 --- a/sdk/resourcemanager/fabric/armfabric/models_serde.go +++ b/sdk/resourcemanager/fabric/armfabric/models_serde.go @@ -400,6 +400,107 @@ func (o *OperationListResult) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PagedQuota. +func (p PagedQuota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PagedQuota. +func (p *PagedQuota) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Quota. +func (q Quota) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "currentValue", q.CurrentValue) + populate(objectMap, "limit", q.Limit) + populate(objectMap, "name", q.Name) + populate(objectMap, "unit", q.Unit) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Quota. +func (q *Quota) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "currentValue": + err = unpopulate(val, "CurrentValue", &q.CurrentValue) + delete(rawMsg, key) + case "limit": + err = unpopulate(val, "Limit", &q.Limit) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &q.Name) + delete(rawMsg, key) + case "unit": + err = unpopulate(val, "Unit", &q.Unit) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QuotaName. +func (q QuotaName) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "localizedValue", q.LocalizedValue) + populate(objectMap, "value", q.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QuotaName. +func (q *QuotaName) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "localizedValue": + err = unpopulate(val, "LocalizedValue", &q.LocalizedValue) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &q.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type RpSKU. func (r RpSKU) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/fabric/armfabric/operations_client.go b/sdk/resourcemanager/fabric/armfabric/operations_client.go index 8b8c355efd2a..7e1bf1afbccd 100644 --- a/sdk/resourcemanager/fabric/armfabric/operations_client.go +++ b/sdk/resourcemanager/fabric/armfabric/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 2023-11-01 +// Generated from API version 2025-01-15-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", "2023-11-01") + reqQP.Set("api-version", "2025-01-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/fabric/armfabric/operations_client_example_test.go b/sdk/resourcemanager/fabric/armfabric/operations_client_example_test.go index b16accbd798d..08e28eee0cc9 100644 --- a/sdk/resourcemanager/fabric/armfabric/operations_client_example_test.go +++ b/sdk/resourcemanager/fabric/armfabric/operations_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2023-11-01/Operations_List.json +// Generated from example definition: 2025-01-15-preview/Operations_List.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/fabric/armfabric/options.go b/sdk/resourcemanager/fabric/armfabric/options.go index 0a19abe35209..183ddedbf67c 100644 --- a/sdk/resourcemanager/fabric/armfabric/options.go +++ b/sdk/resourcemanager/fabric/armfabric/options.go @@ -69,6 +69,11 @@ type CapacitiesClientListSKUsOptions struct { // placeholder for future optional parameters } +// CapacitiesClientListUsagesOptions contains the optional parameters for the CapacitiesClient.NewListUsagesPager method. +type CapacitiesClientListUsagesOptions struct { + // placeholder for future optional parameters +} + // OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/fabric/armfabric/responses.go b/sdk/resourcemanager/fabric/armfabric/responses.go index 4b603a062cd5..04ba346cf2d4 100644 --- a/sdk/resourcemanager/fabric/armfabric/responses.go +++ b/sdk/resourcemanager/fabric/armfabric/responses.go @@ -51,6 +51,12 @@ type CapacitiesClientListSKUsResponse struct { RpSKUEnumerationForNewResourceResult } +// CapacitiesClientListUsagesResponse contains the response from method CapacitiesClient.NewListUsagesPager. +type CapacitiesClientListUsagesResponse struct { + // Paged collection of Quota items + PagedQuota +} + // CapacitiesClientResumeResponse contains the response from method CapacitiesClient.BeginResume. type CapacitiesClientResumeResponse struct { // placeholder for future response values diff --git a/sdk/resourcemanager/fabric/armfabric/tsp-location.yaml b/sdk/resourcemanager/fabric/armfabric/tsp-location.yaml index 9c366cac6466..4ef8b614bd94 100644 --- a/sdk/resourcemanager/fabric/armfabric/tsp-location.yaml +++ b/sdk/resourcemanager/fabric/armfabric/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/fabric/Microsoft.Fabric.Management -commit: 366aaa13cdd218b9adac716680e49473673410c8 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs additionalDirectories: diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md index 9076ff31acee..ef6770c085b9 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.1 (2025-05-13) +### Other Changes + + ## 1.0.0 (2024-11-20) ### Breaking Changes diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go index d400bac39794..14354ead46f0 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/constants.go @@ -6,7 +6,7 @@ package armhealthdataaiservices const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices" - moduleVersion = "v1.0.0" + moduleVersion = "v1.0.1" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -124,7 +124,7 @@ type PrivateEndpointServiceConnectionStatus string const ( // PrivateEndpointServiceConnectionStatusApproved - Connection approved PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - // PrivateEndpointServiceConnectionStatusPending - Connectionaiting for approval or rejection + // PrivateEndpointServiceConnectionStatusPending - Connection waiting for approval or rejection PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" // PrivateEndpointServiceConnectionStatusRejected - Connection Rejected PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/deidservices_server.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/deidservices_server.go index 3da7dc2fe250..10a940a8681f 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/deidservices_server.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/deidservices_server.go @@ -133,7 +133,7 @@ func (d *DeidServicesServerTransport) dispatchBeginCreate(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armhealthdataaiservices.DeidService](req) @@ -181,7 +181,7 @@ func (d *DeidServicesServerTransport) dispatchBeginDelete(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -223,7 +223,7 @@ func (d *DeidServicesServerTransport) dispatchGet(req *http.Request) (*http.Resp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -258,7 +258,7 @@ func (d *DeidServicesServerTransport) dispatchNewListByResourceGroupPager(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -295,7 +295,7 @@ func (d *DeidServicesServerTransport) dispatchNewListBySubscriptionPager(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := d.srv.NewListBySubscriptionPager(nil) @@ -328,7 +328,7 @@ func (d *DeidServicesServerTransport) dispatchBeginUpdate(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armhealthdataaiservices.DeidUpdate](req) diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privateendpointconnections_server.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privateendpointconnections_server.go index bfca92be1328..8ffe7b452bb5 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privateendpointconnections_server.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privateendpointconnections_server.go @@ -117,7 +117,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreate(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armhealthdataaiservices.PrivateEndpointConnectionResource](req) @@ -169,7 +169,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -215,7 +215,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -254,7 +254,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByDeidService const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privatelinks_server.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privatelinks_server.go index 77aafe7fe043..eecb705192cf 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privatelinks_server.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/privatelinks_server.go @@ -94,7 +94,7 @@ func (p *PrivateLinksServerTransport) dispatchNewListByDeidServicePager(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HealthDataAIServices/deidServices/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/time_rfc3339.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/healthdataaiservices/armhealthdataaiservices/models.go b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/models.go index 7357178da338..42bb163a342a 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/models.go +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/models.go @@ -100,14 +100,16 @@ type ManagedServiceIdentityUpdate struct { UserAssignedIdentities map[string]*UserAssignedIdentity } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 @@ -149,9 +151,9 @@ type OperationListResult struct { NextLink *string } -// PrivateEndpoint - The Private Endpoint resource. +// PrivateEndpoint - The private endpoint resource. type PrivateEndpoint struct { - // READ-ONLY; The resource identifier for private endpoint + // READ-ONLY; The resource identifier of the private endpoint ID *string } diff --git a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/tsp-location.yaml b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/tsp-location.yaml index d2f75c664dcb..09576e3d147e 100644 --- a/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/tsp-location.yaml +++ b/sdk/resourcemanager/healthdataaiservices/armhealthdataaiservices/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/healthdataaiservices/HealthDataAIServices.Management -commit: d477c7caa09bf82e22c419be0a99d170552b5892 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs additionalDirectories: diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md index 7bcbafa76855..25bd2cc4c662 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/CHANGELOG.md @@ -1,5 +1,75 @@ # Release History +## 2.0.0 (2025-05-13) +### Breaking Changes + +- Type of `ErrorAdditionalInfo.Info` has been changed from `any` to `*ErrorAdditionalInfoInfo` +- Struct `ErrorResponse` has been removed +- Struct `ProxyResource` has been removed +- Struct `Resource` has been removed + +### Features Added + +- New enum type `CloudNativeType` with values `CloudNativeTypeEc2` +- New enum type `HostType` with values `HostTypeAWS` +- New enum type `ResourceProvisioningState` with values `ResourceProvisioningStateCanceled`, `ResourceProvisioningStateFailed`, `ResourceProvisioningStateSucceeded` +- New enum type `SolutionConfigurationStatus` with values `SolutionConfigurationStatusCompleted`, `SolutionConfigurationStatusFailed`, `SolutionConfigurationStatusInProgress`, `SolutionConfigurationStatusNew` +- New function `*ClientFactory.NewGenerateAwsTemplateClient(string) *GenerateAwsTemplateClient` +- New function `*ClientFactory.NewInventoryClient() *InventoryClient` +- New function `*ClientFactory.NewPublicCloudConnectorsClient(string) *PublicCloudConnectorsClient` +- New function `*ClientFactory.NewSolutionConfigurationsClient() *SolutionConfigurationsClient` +- New function `*ClientFactory.NewSolutionTypesClient(string) *SolutionTypesClient` +- New function `NewGenerateAwsTemplateClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GenerateAwsTemplateClient, error)` +- New function `*GenerateAwsTemplateClient.Post(context.Context, GenerateAwsTemplateRequest, *GenerateAwsTemplateClientPostOptions) (GenerateAwsTemplateClientPostResponse, error)` +- New function `NewInventoryClient(azcore.TokenCredential, *arm.ClientOptions) (*InventoryClient, error)` +- New function `*InventoryClient.Get(context.Context, string, string, string, *InventoryClientGetOptions) (InventoryClientGetResponse, error)` +- New function `*InventoryClient.NewListBySolutionConfigurationPager(string, string, *InventoryClientListBySolutionConfigurationOptions) *runtime.Pager[InventoryClientListBySolutionConfigurationResponse]` +- New function `NewPublicCloudConnectorsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*PublicCloudConnectorsClient, error)` +- New function `*PublicCloudConnectorsClient.BeginCreateOrUpdate(context.Context, string, string, PublicCloudConnector, *PublicCloudConnectorsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PublicCloudConnectorsClientCreateOrUpdateResponse], error)` +- New function `*PublicCloudConnectorsClient.Delete(context.Context, string, string, *PublicCloudConnectorsClientDeleteOptions) (PublicCloudConnectorsClientDeleteResponse, error)` +- New function `*PublicCloudConnectorsClient.Get(context.Context, string, string, *PublicCloudConnectorsClientGetOptions) (PublicCloudConnectorsClientGetResponse, error)` +- New function `*PublicCloudConnectorsClient.NewListByResourceGroupPager(string, *PublicCloudConnectorsClientListByResourceGroupOptions) *runtime.Pager[PublicCloudConnectorsClientListByResourceGroupResponse]` +- New function `*PublicCloudConnectorsClient.NewListBySubscriptionPager(*PublicCloudConnectorsClientListBySubscriptionOptions) *runtime.Pager[PublicCloudConnectorsClientListBySubscriptionResponse]` +- New function `*PublicCloudConnectorsClient.BeginTestPermissions(context.Context, string, string, *PublicCloudConnectorsClientBeginTestPermissionsOptions) (*runtime.Poller[PublicCloudConnectorsClientTestPermissionsResponse], error)` +- New function `*PublicCloudConnectorsClient.Update(context.Context, string, string, PublicCloudConnectorUpdate, *PublicCloudConnectorsClientUpdateOptions) (PublicCloudConnectorsClientUpdateResponse, error)` +- New function `NewSolutionConfigurationsClient(azcore.TokenCredential, *arm.ClientOptions) (*SolutionConfigurationsClient, error)` +- New function `*SolutionConfigurationsClient.CreateOrUpdate(context.Context, string, string, SolutionConfiguration, *SolutionConfigurationsClientCreateOrUpdateOptions) (SolutionConfigurationsClientCreateOrUpdateResponse, error)` +- New function `*SolutionConfigurationsClient.Delete(context.Context, string, string, *SolutionConfigurationsClientDeleteOptions) (SolutionConfigurationsClientDeleteResponse, error)` +- New function `*SolutionConfigurationsClient.Get(context.Context, string, string, *SolutionConfigurationsClientGetOptions) (SolutionConfigurationsClientGetResponse, error)` +- New function `*SolutionConfigurationsClient.NewListPager(string, *SolutionConfigurationsClientListOptions) *runtime.Pager[SolutionConfigurationsClientListResponse]` +- New function `*SolutionConfigurationsClient.BeginSyncNow(context.Context, string, string, *SolutionConfigurationsClientBeginSyncNowOptions) (*runtime.Poller[SolutionConfigurationsClientSyncNowResponse], error)` +- New function `*SolutionConfigurationsClient.Update(context.Context, string, string, SolutionConfigurationUpdate, *SolutionConfigurationsClientUpdateOptions) (SolutionConfigurationsClientUpdateResponse, error)` +- New function `NewSolutionTypesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SolutionTypesClient, error)` +- New function `*SolutionTypesClient.Get(context.Context, string, string, *SolutionTypesClientGetOptions) (SolutionTypesClientGetResponse, error)` +- New function `*SolutionTypesClient.NewListByResourceGroupPager(string, *SolutionTypesClientListByResourceGroupOptions) *runtime.Pager[SolutionTypesClientListByResourceGroupResponse]` +- New function `*SolutionTypesClient.NewListBySubscriptionPager(*SolutionTypesClientListBySubscriptionOptions) *runtime.Pager[SolutionTypesClientListBySubscriptionResponse]` +- New struct `AwsCloudProfile` +- New struct `AwsCloudProfileUpdate` +- New struct `ErrorAdditionalInfoInfo` +- New struct `GenerateAwsTemplateRequest` +- New struct `GenerateAwsTemplateResponse` +- New struct `InventoryProperties` +- New struct `InventoryResource` +- New struct `InventoryResourceListResult` +- New struct `OperationStatusResult` +- New struct `PublicCloudConnector` +- New struct `PublicCloudConnectorListResult` +- New struct `PublicCloudConnectorProperties` +- New struct `PublicCloudConnectorPropertiesUpdate` +- New struct `PublicCloudConnectorUpdate` +- New struct `SolutionConfiguration` +- New struct `SolutionConfigurationListResult` +- New struct `SolutionConfigurationProperties` +- New struct `SolutionConfigurationPropertiesUpdate` +- New struct `SolutionConfigurationUpdate` +- New struct `SolutionSettings` +- New struct `SolutionTypeProperties` +- New struct `SolutionTypeResource` +- New struct `SolutionTypeResourceListResult` +- New struct `SolutionTypeSettings` +- New struct `SolutionTypeSettingsProperties` + + ## 1.2.0-beta.1 (2025-02-27) ### Features Added diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/README.md b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/README.md index e106a85421c3..f58350fc924a 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/README.md +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Arc Connectivity module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2 ``` ## Authorization @@ -36,7 +36,7 @@ For more information on authentication, please see the documentation for `aziden Azure Arc Connectivity 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 := armhybridconnectivity.NewClientFactory(, cred, nil) +clientFactory, err := armhybridconnectivity.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). @@ -47,7 +47,7 @@ options := arm.ClientOptions { Cloud: cloud.AzureChina, }, } -clientFactory, err := armhybridconnectivity.NewClientFactory(, cred, &options) +clientFactory, err := armhybridconnectivity.NewClientFactory(cred, &options) ``` ## Clients diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go index fdad98be1429..ad9c7249c38a 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/constants.go @@ -6,7 +6,7 @@ package armhybridconnectivity const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity" - moduleVersion = "v1.2.0-beta.1" + moduleVersion = "v2.0.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client_example_test.go index 735aff7d2697..11754c9b5835 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_client_example_test.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/endpoints_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/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "log" ) @@ -23,7 +23,7 @@ func ExampleEndpointsClient_CreateOrUpdate_hybridConnectivityEndpointsPutCustom( if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEndpointsClient().CreateOrUpdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "custom", armhybridconnectivity.EndpointResource{}, nil) + res, err := clientFactory.NewEndpointsClient().CreateOrUpdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "custom", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -55,7 +55,7 @@ func ExampleEndpointsClient_CreateOrUpdate_hybridConnectivityEndpointsPutDefault if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEndpointsClient().CreateOrUpdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", armhybridconnectivity.EndpointResource{}, nil) + res, err := clientFactory.NewEndpointsClient().CreateOrUpdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -217,11 +217,11 @@ func ExampleEndpointsClient_ListCredentials() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEndpointsClient().ListCredentials(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", &armhybridconnectivity.EndpointsClientListCredentialsOptions{ - ListCredentialsRequest: &armhybridconnectivity.ListCredentialsRequest{ + res, err := clientFactory.NewEndpointsClient().ListCredentials(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", &EndpointsClientListCredentialsOptions{ + listCredentialsRequest: &armhybridconnectivity.ListCredentialsRequest{ ServiceName: to.Ptr(armhybridconnectivity.ServiceNameSSH), }, - Expiresin: to.Ptr[int64](10800)}) + expiresin: to.Ptr[int64](10800)}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -253,8 +253,8 @@ func ExampleEndpointsClient_ListIngressGatewayCredentials() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEndpointsClient().ListIngressGatewayCredentials(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.ArcPlaceHolder/ProvisionedClusters/cluster0", "default", &armhybridconnectivity.EndpointsClientListIngressGatewayCredentialsOptions{ - Expiresin: to.Ptr[int64](10800)}) + res, err := clientFactory.NewEndpointsClient().ListIngressGatewayCredentials(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.ArcPlaceHolder/ProvisionedClusters/cluster0", "default", &EndpointsClientListIngressGatewayCredentialsOptions{ + expiresin: to.Ptr[int64](10800)}) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -293,7 +293,7 @@ func ExampleEndpointsClient_ListManagedProxyDetails() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEndpointsClient().ListManagedProxyDetails(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.Compute/virtualMachines/vm00006", "default", armhybridconnectivity.ManagedProxyRequest{}, nil) + res, err := clientFactory.NewEndpointsClient().ListManagedProxyDetails(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/arcGroup/providers/Microsoft.Compute/virtualMachines/vm00006", "default", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -319,7 +319,7 @@ func ExampleEndpointsClient_Update() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewEndpointsClient().Update(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", armhybridconnectivity.EndpointResource{}, nil) + res, err := clientFactory.NewEndpointsClient().Update(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine", "default", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/endpoints_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/endpoints_server.go index c72ed0812c87..960e757c0a6e 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/endpoints_server.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/endpoints_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/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "net/http" "net/url" "reflect" @@ -137,7 +137,7 @@ func (e *EndpointsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*h const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.EndpointResource](req) @@ -174,7 +174,7 @@ func (e *EndpointsServerTransport) dispatchDelete(req *http.Request) (*http.Resp const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -207,7 +207,7 @@ func (e *EndpointsServerTransport) dispatchGet(req *http.Request) (*http.Respons const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -242,7 +242,7 @@ func (e *EndpointsServerTransport) dispatchNewListPager(req *http.Request) (*htt const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -277,7 +277,7 @@ func (e *EndpointsServerTransport) dispatchListCredentials(req *http.Request) (* const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listCredentials` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -336,7 +336,7 @@ func (e *EndpointsServerTransport) dispatchListIngressGatewayCredentials(req *ht const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listIngressGatewayCredentials` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -395,7 +395,7 @@ func (e *EndpointsServerTransport) dispatchListManagedProxyDetails(req *http.Req const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listManagedProxyDetails` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.ManagedProxyRequest](req) @@ -432,7 +432,7 @@ func (e *EndpointsServerTransport) dispatchUpdate(req *http.Request) (*http.Resp const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.EndpointResource](req) diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/generateawstemplate_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/generateawstemplate_server.go index 41fac446844d..26c435e4146c 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/generateawstemplate_server.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/generateawstemplate_server.go @@ -11,7 +11,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "net/http" "regexp" ) @@ -87,7 +87,7 @@ func (g *GenerateAwsTemplateServerTransport) dispatchPost(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/generateAwsTemplate` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.GenerateAwsTemplateRequest](req) @@ -102,7 +102,7 @@ func (g *GenerateAwsTemplateServerTransport) dispatchPost(req *http.Request) (*h if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PostResponse, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GenerateAwsTemplateResponse, req) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/inventory_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/inventory_server.go index 6176ac210603..225ee2b01774 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/inventory_server.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/inventory_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/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "net/http" "net/url" "regexp" @@ -99,7 +99,7 @@ func (i *InventoryServerTransport) dispatchGet(req *http.Request) (*http.Respons const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inventory/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -138,7 +138,7 @@ func (i *InventoryServerTransport) dispatchNewListBySolutionConfigurationPager(r const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inventory` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/operations_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/operations_server.go index 528d3811ce14..52715dd2b0a3 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/operations_server.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/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/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "net/http" ) diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/publiccloudconnectors_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/publiccloudconnectors_server.go index c9c8bd1e17cf..c86c830da554 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/publiccloudconnectors_server.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/publiccloudconnectors_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/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "net/http" "net/url" "regexp" @@ -46,7 +46,7 @@ type PublicCloudConnectorsServer struct { // Update is the fake for method PublicCloudConnectorsClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceGroupName string, publicCloudConnector string, properties armhybridconnectivity.PublicCloudConnector, options *armhybridconnectivity.PublicCloudConnectorsClientUpdateOptions) (resp azfake.Responder[armhybridconnectivity.PublicCloudConnectorsClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceGroupName string, publicCloudConnector string, properties armhybridconnectivity.PublicCloudConnectorUpdate, options *armhybridconnectivity.PublicCloudConnectorsClientUpdateOptions) (resp azfake.Responder[armhybridconnectivity.PublicCloudConnectorsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewPublicCloudConnectorsServerTransport creates a new instance of PublicCloudConnectorsServerTransport with the provided implementation. @@ -137,7 +137,7 @@ func (p *PublicCloudConnectorsServerTransport) dispatchBeginCreateOrUpdate(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.PublicCloudConnector](req) @@ -183,7 +183,7 @@ func (p *PublicCloudConnectorsServerTransport) dispatchDelete(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -216,7 +216,7 @@ func (p *PublicCloudConnectorsServerTransport) dispatchGet(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -251,7 +251,7 @@ func (p *PublicCloudConnectorsServerTransport) dispatchNewListByResourceGroupPag const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -288,7 +288,7 @@ func (p *PublicCloudConnectorsServerTransport) dispatchNewListBySubscriptionPage const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := p.srv.NewListBySubscriptionPager(nil) @@ -321,7 +321,7 @@ func (p *PublicCloudConnectorsServerTransport) dispatchBeginTestPermissions(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/testPermissions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -363,10 +363,10 @@ func (p *PublicCloudConnectorsServerTransport) dispatchUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/publicCloudConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.PublicCloudConnector](req) + body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.PublicCloudConnectorUpdate](req) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/serviceconfigurations_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/serviceconfigurations_server.go index c62c23c93448..f96e09047dcf 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/serviceconfigurations_server.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/serviceconfigurations_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/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "net/http" "net/url" "regexp" @@ -117,7 +117,7 @@ func (s *ServiceConfigurationsServerTransport) dispatchCreateOrupdate(req *http. const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.ServiceConfigurationResource](req) @@ -158,7 +158,7 @@ func (s *ServiceConfigurationsServerTransport) dispatchDelete(req *http.Request) const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -195,7 +195,7 @@ func (s *ServiceConfigurationsServerTransport) dispatchGet(req *http.Request) (* const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -234,7 +234,7 @@ func (s *ServiceConfigurationsServerTransport) dispatchNewListByEndpointResource const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -273,7 +273,7 @@ func (s *ServiceConfigurationsServerTransport) dispatchUpdate(req *http.Request) const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/serviceConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.ServiceConfigurationResourcePatch](req) diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutionconfigurations_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutionconfigurations_server.go index 3d5e16bd7e34..d395838263fa 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutionconfigurations_server.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutionconfigurations_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/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "net/http" "net/url" "regexp" @@ -42,7 +42,7 @@ type SolutionConfigurationsServer struct { // Update is the fake for method SolutionConfigurationsClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, resourceURI string, solutionConfiguration string, properties armhybridconnectivity.SolutionConfiguration, options *armhybridconnectivity.SolutionConfigurationsClientUpdateOptions) (resp azfake.Responder[armhybridconnectivity.SolutionConfigurationsClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, resourceURI string, solutionConfiguration string, properties armhybridconnectivity.SolutionConfigurationUpdate, options *armhybridconnectivity.SolutionConfigurationsClientUpdateOptions) (resp azfake.Responder[armhybridconnectivity.SolutionConfigurationsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewSolutionConfigurationsServerTransport creates a new instance of SolutionConfigurationsServerTransport with the provided implementation. @@ -125,7 +125,7 @@ func (s *SolutionConfigurationsServerTransport) dispatchCreateOrUpdate(req *http const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.SolutionConfiguration](req) @@ -162,7 +162,7 @@ func (s *SolutionConfigurationsServerTransport) dispatchDelete(req *http.Request const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -195,7 +195,7 @@ func (s *SolutionConfigurationsServerTransport) dispatchGet(req *http.Request) ( const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -230,7 +230,7 @@ func (s *SolutionConfigurationsServerTransport) dispatchNewListPager(req *http.R const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -267,7 +267,7 @@ func (s *SolutionConfigurationsServerTransport) dispatchBeginSyncNow(req *http.R const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/syncNow` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceURIParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceUri")]) @@ -309,10 +309,10 @@ func (s *SolutionConfigurationsServerTransport) dispatchUpdate(req *http.Request const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionConfigurations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.SolutionConfiguration](req) + body, err := server.UnmarshalRequestAsJSON[armhybridconnectivity.SolutionConfigurationUpdate](req) if err != nil { return nil, err } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutiontypes_server.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutiontypes_server.go index 49771ddfed71..4ea6d1f5a2be 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutiontypes_server.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/solutiontypes_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/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "net/http" "net/url" "regexp" @@ -107,7 +107,7 @@ func (s *SolutionTypesServerTransport) dispatchGet(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionTypes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -142,7 +142,7 @@ func (s *SolutionTypesServerTransport) dispatchNewListByResourceGroupPager(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionTypes` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -179,7 +179,7 @@ func (s *SolutionTypesServerTransport) dispatchNewListBySubscriptionPager(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.HybridConnectivity/solutionTypes` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := s.srv.NewListBySubscriptionPager(nil) diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/time_rfc3339.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/hybridconnectivity/armhybridconnectivity/generateawstemplate_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client.go index 76eba82d7603..c00a7a5957c0 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client.go @@ -93,7 +93,7 @@ func (client *GenerateAwsTemplateClient) postCreateRequest(ctx context.Context, // postHandleResponse handles the Post response. func (client *GenerateAwsTemplateClient) postHandleResponse(resp *http.Response) (GenerateAwsTemplateClientPostResponse, error) { result := GenerateAwsTemplateClientPostResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PostResponse); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.GenerateAwsTemplateResponse); err != nil { return GenerateAwsTemplateClientPostResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client_example_test.go index d48645a9362b..18d53f2d5c90 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_client_example_test.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/generateawstemplate_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/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "log" ) @@ -39,7 +39,7 @@ func ExampleGenerateAwsTemplateClient_Post() { _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res = armhybridconnectivity.GenerateAwsTemplateClientPostResponse{ - // PostResponse: &armhybridconnectivity.PostResponse{ + // GenerateAwsTemplateResponse: &armhybridconnectivity.GenerateAwsTemplateResponse{ // }, // } } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod index c60c012edfd0..64e2e15773c7 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2 go 1.23.0 diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client_example_test.go index b2e19968ab5f..f644042de9d1 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client_example_test.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/inventory_client_example_test.go @@ -7,7 +7,7 @@ package armhybridconnectivity_test import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "log" ) diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go index 89edf51d4017..4483fb9f605e 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models.go @@ -28,6 +28,12 @@ type AwsCloudProfile struct { IsOrganizationalAccount *bool } +// AwsCloudProfileUpdate - cloud profile for AWS. +type AwsCloudProfileUpdate struct { + // List of AWS accounts which need to be excluded. + ExcludedAccounts []*string +} + // EndpointAccessResource - The endpoint access for the target resource. type EndpointAccessResource struct { // Azure relay hybrid connection access properties @@ -112,6 +118,10 @@ type GenerateAwsTemplateRequest struct { SolutionTypes []*SolutionTypeSettings } +// GenerateAwsTemplateResponse - The HybridConnectivity post operation response +type GenerateAwsTemplateResponse struct { +} + // IngressGatewayResource - The ingress gateway access credentials type IngressGatewayResource struct { // Ingress gateway profile @@ -212,7 +222,9 @@ type ManagedProxyResource struct { Proxy *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 @@ -291,9 +303,6 @@ type OperationStatusResult struct { ResourceID *string } -type PostResponse struct { -} - // PublicCloudConnector - Public Cloud Connector type PublicCloudConnector struct { // REQUIRED; The geo-location where the resource lives @@ -342,6 +351,33 @@ type PublicCloudConnectorProperties struct { ProvisioningState *ResourceProvisioningState } +// PublicCloudConnectorPropertiesUpdate - Properties of public cloud connectors. +type PublicCloudConnectorPropertiesUpdate struct { + // Cloud profile for AWS. + AwsCloudProfile *AwsCloudProfileUpdate +} + +// PublicCloudConnectorUpdate - Public Cloud Connector +type PublicCloudConnectorUpdate struct { + // The resource-specific properties for this resource. + Properties *PublicCloudConnectorPropertiesUpdate + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + // RelayNamespaceAccessProperties - Azure relay hybrid connection access properties type RelayNamespaceAccessProperties struct { // REQUIRED; Azure Relay hybrid connection name for the resource. @@ -465,6 +501,33 @@ type SolutionConfigurationProperties struct { StatusDetails *string } +// SolutionConfigurationPropertiesUpdate - Solution configuration resource. +type SolutionConfigurationPropertiesUpdate struct { + // Solution settings + SolutionSettings *SolutionSettings + + // The type of the solution + SolutionType *string +} + +// SolutionConfigurationUpdate - Solution Configuration +type SolutionConfigurationUpdate struct { + // The resource-specific properties for this resource. + Properties *SolutionConfigurationPropertiesUpdate + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + // SolutionSettings - Solution settings type SolutionSettings struct { AdditionalProperties map[string]*string diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go index 9ca32ddad55c..a49a77f79e88 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/models_serde.go @@ -77,6 +77,33 @@ func (a *AwsCloudProfile) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AwsCloudProfileUpdate. +func (a AwsCloudProfileUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "excludedAccounts", a.ExcludedAccounts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCloudProfileUpdate. +func (a *AwsCloudProfileUpdate) UnmarshalJSON(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 "excludedAccounts": + err = unpopulate(val, "ExcludedAccounts", &a.ExcludedAccounts) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type EndpointAccessResource. func (e EndpointAccessResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -914,6 +941,80 @@ func (p *PublicCloudConnectorProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PublicCloudConnectorPropertiesUpdate. +func (p PublicCloudConnectorPropertiesUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "awsCloudProfile", p.AwsCloudProfile) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicCloudConnectorPropertiesUpdate. +func (p *PublicCloudConnectorPropertiesUpdate) UnmarshalJSON(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 "awsCloudProfile": + err = unpopulate(val, "AwsCloudProfile", &p.AwsCloudProfile) + 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 PublicCloudConnectorUpdate. +func (p PublicCloudConnectorUpdate) 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, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublicCloudConnectorUpdate. +func (p *PublicCloudConnectorUpdate) UnmarshalJSON(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 "tags": + err = unpopulate(val, "Tags", &p.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type RelayNamespaceAccessProperties. func (r RelayNamespaceAccessProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1249,6 +1350,80 @@ func (s *SolutionConfigurationProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type SolutionConfigurationPropertiesUpdate. +func (s SolutionConfigurationPropertiesUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "solutionSettings", s.SolutionSettings) + populate(objectMap, "solutionType", s.SolutionType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionConfigurationPropertiesUpdate. +func (s *SolutionConfigurationPropertiesUpdate) UnmarshalJSON(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 "solutionSettings": + err = unpopulate(val, "SolutionSettings", &s.SolutionSettings) + delete(rawMsg, key) + case "solutionType": + err = unpopulate(val, "SolutionType", &s.SolutionType) + 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 SolutionConfigurationUpdate. +func (s SolutionConfigurationUpdate) 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 SolutionConfigurationUpdate. +func (s *SolutionConfigurationUpdate) UnmarshalJSON(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 SolutionSettings. func (s SolutionSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client_example_test.go index 85db23c73333..4fd8edc508f6 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client_example_test.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/operations_client_example_test.go @@ -7,7 +7,7 @@ package armhybridconnectivity_test import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "log" ) diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client.go index 28eb57d5d6ce..d377c4b44559 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client.go @@ -440,7 +440,7 @@ func (client *PublicCloudConnectorsClient) testPermissionsCreateRequest(ctx cont // - properties - The resource properties to be updated. // - options - PublicCloudConnectorsClientUpdateOptions contains the optional parameters for the PublicCloudConnectorsClient.Update // method. -func (client *PublicCloudConnectorsClient) Update(ctx context.Context, resourceGroupName string, publicCloudConnector string, properties PublicCloudConnector, options *PublicCloudConnectorsClientUpdateOptions) (PublicCloudConnectorsClientUpdateResponse, error) { +func (client *PublicCloudConnectorsClient) Update(ctx context.Context, resourceGroupName string, publicCloudConnector string, properties PublicCloudConnectorUpdate, options *PublicCloudConnectorsClientUpdateOptions) (PublicCloudConnectorsClientUpdateResponse, error) { var err error const operationName = "PublicCloudConnectorsClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) @@ -463,7 +463,7 @@ func (client *PublicCloudConnectorsClient) Update(ctx context.Context, resourceG } // updateCreateRequest creates the Update request. -func (client *PublicCloudConnectorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, publicCloudConnector string, properties PublicCloudConnector, _ *PublicCloudConnectorsClientUpdateOptions) (*policy.Request, error) { +func (client *PublicCloudConnectorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, publicCloudConnector string, properties PublicCloudConnectorUpdate, _ *PublicCloudConnectorsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridConnectivity/publicCloudConnectors/{publicCloudConnector}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client_example_test.go index a462661bef4d..9c32b34e05af 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_client_example_test.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/publiccloudconnectors_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/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "log" ) @@ -358,10 +358,10 @@ func ExamplePublicCloudConnectorsClient_Update() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewPublicCloudConnectorsClient("5ACC4579-DB34-4C2F-8F8C-25061168F342").Update(ctx, "rgpublicCloud", "svtirlbyqpepbzyessjenlueeznhg", armhybridconnectivity.PublicCloudConnector{ + res, err := clientFactory.NewPublicCloudConnectorsClient("5ACC4579-DB34-4C2F-8F8C-25061168F342").Update(ctx, "rgpublicCloud", "svtirlbyqpepbzyessjenlueeznhg", armhybridconnectivity.PublicCloudConnectorUpdate{ Tags: map[string]*string{}, - Properties: &armhybridconnectivity.PublicCloudConnectorProperties{ - AwsCloudProfile: &armhybridconnectivity.AwsCloudProfile{ + Properties: &armhybridconnectivity.PublicCloudConnectorPropertiesUpdate{ + AwsCloudProfile: &armhybridconnectivity.AwsCloudProfileUpdate{ ExcludedAccounts: []*string{ to.Ptr("zrbtd"), }, diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/responses.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/responses.go index d036bd1df71a..17424c3b8162 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/responses.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/responses.go @@ -53,7 +53,8 @@ type EndpointsClientUpdateResponse struct { // GenerateAwsTemplateClientPostResponse contains the response from method GenerateAwsTemplateClient.Post. type GenerateAwsTemplateClientPostResponse struct { - PostResponse + // The HybridConnectivity post operation response + GenerateAwsTemplateResponse } // InventoryClientGetResponse contains the response from method InventoryClient.Get. diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client_example_test.go index f19358e24452..53ea49900f23 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client_example_test.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/serviceconfigurations_client_example_test.go @@ -7,7 +7,7 @@ package armhybridconnectivity_test import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "log" ) @@ -22,7 +22,7 @@ func ExampleServiceConfigurationsClient_CreateOrupdate_serviceConfigurationsPutS if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewServiceConfigurationsClient().CreateOrupdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "SSH", armhybridconnectivity.ServiceConfigurationResource{}, nil) + res, err := clientFactory.NewServiceConfigurationsClient().CreateOrupdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "SSH", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -53,7 +53,7 @@ func ExampleServiceConfigurationsClient_CreateOrupdate_serviceConfigurationsPutW if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewServiceConfigurationsClient().CreateOrupdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "WAC", armhybridconnectivity.ServiceConfigurationResource{}, nil) + res, err := clientFactory.NewServiceConfigurationsClient().CreateOrupdate(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "WAC", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -213,7 +213,7 @@ func ExampleServiceConfigurationsClient_Update() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewServiceConfigurationsClient().Update(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "SSH", armhybridconnectivity.ServiceConfigurationResourcePatch{}, nil) + res, err := clientFactory.NewServiceConfigurationsClient().Update(ctx, "subscriptions/f5bcc1d9-23af-4ae9-aca1-041d0f593a63/resourceGroups/hybridRG/providers/Microsoft.HybridCompute/machines/testMachine/providers/Microsoft.HybridConnectivity/endpoints/default", "default", "SSH", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client.go index 62d0293c43cd..02e27a31ffea 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client.go @@ -336,7 +336,7 @@ func (client *SolutionConfigurationsClient) syncNowCreateRequest(ctx context.Con // - properties - The resource properties to be updated. // - options - SolutionConfigurationsClientUpdateOptions contains the optional parameters for the SolutionConfigurationsClient.Update // method. -func (client *SolutionConfigurationsClient) Update(ctx context.Context, resourceURI string, solutionConfiguration string, properties SolutionConfiguration, options *SolutionConfigurationsClientUpdateOptions) (SolutionConfigurationsClientUpdateResponse, error) { +func (client *SolutionConfigurationsClient) Update(ctx context.Context, resourceURI string, solutionConfiguration string, properties SolutionConfigurationUpdate, options *SolutionConfigurationsClientUpdateOptions) (SolutionConfigurationsClientUpdateResponse, error) { var err error const operationName = "SolutionConfigurationsClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) @@ -359,7 +359,7 @@ func (client *SolutionConfigurationsClient) Update(ctx context.Context, resource } // updateCreateRequest creates the Update request. -func (client *SolutionConfigurationsClient) updateCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, properties SolutionConfiguration, _ *SolutionConfigurationsClientUpdateOptions) (*policy.Request, error) { +func (client *SolutionConfigurationsClient) updateCreateRequest(ctx context.Context, resourceURI string, solutionConfiguration string, properties SolutionConfigurationUpdate, _ *SolutionConfigurationsClientUpdateOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.HybridConnectivity/solutionConfigurations/{solutionConfiguration}" urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) if solutionConfiguration == "" { diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client_example_test.go index f1051d436fc8..4165fe471b10 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_client_example_test.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutionconfigurations_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/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "log" ) @@ -158,6 +158,7 @@ func ExampleSolutionConfigurationsClient_NewListPager() { // SolutionSettings: &armhybridconnectivity.SolutionSettings{ // }, // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // Status: to.Ptr(armhybridconnectivity.SolutionConfigurationStatus("AuthorizationPending")), // StatusDetails: to.Ptr("Aws authorization validation pending in Aws account"), // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-20T03:24:15.820Z"); return t}()), // }, @@ -179,6 +180,7 @@ func ExampleSolutionConfigurationsClient_NewListPager() { // SolutionSettings: &armhybridconnectivity.SolutionSettings{ // }, // ProvisioningState: to.Ptr(armhybridconnectivity.ResourceProvisioningStateSucceeded), + // Status: to.Ptr(armhybridconnectivity.SolutionConfigurationStatus("AuthorizationSuccess")), // StatusDetails: to.Ptr("Aws authorization validation succeeded in Aws account"), // LastSyncTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-20T03:24:15.820Z"); return t}()), // }, @@ -263,8 +265,8 @@ func ExampleSolutionConfigurationsClient_Update() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewSolutionConfigurationsClient().Update(ctx, "ymuj", "dxt", armhybridconnectivity.SolutionConfiguration{ - Properties: &armhybridconnectivity.SolutionConfigurationProperties{ + res, err := clientFactory.NewSolutionConfigurationsClient().Update(ctx, "ymuj", "dxt", armhybridconnectivity.SolutionConfigurationUpdate{ + Properties: &armhybridconnectivity.SolutionConfigurationPropertiesUpdate{ SolutionType: to.Ptr("myzljlstvmgkp"), SolutionSettings: &armhybridconnectivity.SolutionSettings{}, }, diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client_example_test.go b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client_example_test.go index 25c4f2a97dc8..2307ef148af4 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client_example_test.go +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/solutiontypes_client_example_test.go @@ -7,7 +7,7 @@ package armhybridconnectivity_test import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/v2" "log" ) diff --git a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/tsp-location.yaml b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/tsp-location.yaml index 34b0c0dceb55..3bec6b168fd6 100644 --- a/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/tsp-location.yaml +++ b/sdk/resourcemanager/hybridconnectivity/armhybridconnectivity/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/hybridconnectivity/HybridConnectivity.Management -commit: 9d3547622288137fd36f086afcdaea5408dbe48c +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/impactreporting/armimpactreporting/CHANGELOG.md b/sdk/resourcemanager/impactreporting/armimpactreporting/CHANGELOG.md index 4109b5bd2a2e..a395069fd558 100644 --- a/sdk/resourcemanager/impactreporting/armimpactreporting/CHANGELOG.md +++ b/sdk/resourcemanager/impactreporting/armimpactreporting/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 0.2.0 (2025-05-13) +### Breaking Changes + +- Type of `WorkloadImpactProperties.AdditionalProperties` has been changed from `*WorkloadImpactPropertiesAdditionalProperties` to `map[string]any` +- Struct `WorkloadImpactPropertiesAdditionalProperties` has been removed + + ## 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..e83a3a24fe41 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.2.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/impactreporting/armimpactreporting/fake/connectors_server.go b/sdk/resourcemanager/impactreporting/armimpactreporting/fake/connectors_server.go index 62735e4e4134..d8f8ff4d350d 100644 --- a/sdk/resourcemanager/impactreporting/armimpactreporting/fake/connectors_server.go +++ b/sdk/resourcemanager/impactreporting/armimpactreporting/fake/connectors_server.go @@ -121,7 +121,7 @@ func (c *ConnectorsServerTransport) dispatchBeginCreateOrUpdate(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/connectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armimpactreporting.Connector](req) @@ -163,7 +163,7 @@ func (c *ConnectorsServerTransport) dispatchDelete(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/connectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } connectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectorName")]) @@ -192,7 +192,7 @@ func (c *ConnectorsServerTransport) dispatchGet(req *http.Request) (*http.Respon const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/connectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } connectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectorName")]) @@ -223,7 +223,7 @@ func (c *ConnectorsServerTransport) dispatchNewListBySubscriptionPager(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/connectors` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := c.srv.NewListBySubscriptionPager(nil) @@ -254,7 +254,7 @@ func (c *ConnectorsServerTransport) dispatchUpdate(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/connectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armimpactreporting.ConnectorUpdate](req) diff --git a/sdk/resourcemanager/impactreporting/armimpactreporting/fake/impactcategories_server.go b/sdk/resourcemanager/impactreporting/armimpactreporting/fake/impactcategories_server.go index 27547cce0d90..db6a3375320d 100644 --- a/sdk/resourcemanager/impactreporting/armimpactreporting/fake/impactcategories_server.go +++ b/sdk/resourcemanager/impactreporting/armimpactreporting/fake/impactcategories_server.go @@ -99,7 +99,7 @@ func (i *ImpactCategoriesServerTransport) dispatchGet(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/impactCategories/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } impactCategoryNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("impactCategoryName")]) @@ -130,7 +130,7 @@ func (i *ImpactCategoriesServerTransport) dispatchNewListBySubscriptionPager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/impactCategories` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() diff --git a/sdk/resourcemanager/impactreporting/armimpactreporting/fake/insights_server.go b/sdk/resourcemanager/impactreporting/armimpactreporting/fake/insights_server.go index 8cd6f4c36a42..28167a42ac59 100644 --- a/sdk/resourcemanager/impactreporting/armimpactreporting/fake/insights_server.go +++ b/sdk/resourcemanager/impactreporting/armimpactreporting/fake/insights_server.go @@ -111,7 +111,7 @@ func (i *InsightsServerTransport) dispatchCreate(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/workloadImpacts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/insights/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armimpactreporting.Insight](req) @@ -148,7 +148,7 @@ func (i *InsightsServerTransport) dispatchDelete(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/workloadImpacts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/insights/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } workloadImpactNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workloadImpactName")]) @@ -181,7 +181,7 @@ func (i *InsightsServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/workloadImpacts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/insights/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } workloadImpactNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workloadImpactName")]) @@ -216,7 +216,7 @@ func (i *InsightsServerTransport) dispatchNewListBySubscriptionPager(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/workloadImpacts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/insights` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } workloadImpactNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workloadImpactName")]) diff --git a/sdk/resourcemanager/impactreporting/armimpactreporting/fake/time_rfc3339.go b/sdk/resourcemanager/impactreporting/armimpactreporting/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/impactreporting/armimpactreporting/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/impactreporting/armimpactreporting/fake/workloadimpacts_server.go b/sdk/resourcemanager/impactreporting/armimpactreporting/fake/workloadimpacts_server.go index b15a8d61120f..ea0b9f59638a 100644 --- a/sdk/resourcemanager/impactreporting/armimpactreporting/fake/workloadimpacts_server.go +++ b/sdk/resourcemanager/impactreporting/armimpactreporting/fake/workloadimpacts_server.go @@ -115,7 +115,7 @@ func (w *WorkloadImpactsServerTransport) dispatchBeginCreate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/workloadImpacts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armimpactreporting.WorkloadImpact](req) @@ -157,7 +157,7 @@ func (w *WorkloadImpactsServerTransport) dispatchDelete(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/workloadImpacts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } workloadImpactNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workloadImpactName")]) @@ -186,7 +186,7 @@ func (w *WorkloadImpactsServerTransport) dispatchGet(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/workloadImpacts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } workloadImpactNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workloadImpactName")]) @@ -217,7 +217,7 @@ func (w *WorkloadImpactsServerTransport) dispatchNewListBySubscriptionPager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Impact/workloadImpacts` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := w.srv.NewListBySubscriptionPager(nil) diff --git a/sdk/resourcemanager/impactreporting/armimpactreporting/models.go b/sdk/resourcemanager/impactreporting/armimpactreporting/models.go index 386b2b7784ab..7cf449c0a0a1 100644 --- a/sdk/resourcemanager/impactreporting/armimpactreporting/models.go +++ b/sdk/resourcemanager/impactreporting/armimpactreporting/models.go @@ -240,7 +240,9 @@ type InsightProperties struct { type InsightPropertiesAdditionalDetails struct { } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 @@ -391,7 +393,7 @@ type WorkloadImpactProperties struct { StartDateTime *time.Time // Additional fields related to impact, applicable fields per resource type are list under /impactCategories API - AdditionalProperties *WorkloadImpactPropertiesAdditionalProperties + AdditionalProperties map[string]any // The ARM correlation ids, this is important field for control plane related impacts ArmCorrelationIDs []*string @@ -434,6 +436,3 @@ type WorkloadImpactProperties struct { // READ-ONLY; Time at which impact is reported ReportedTimeUTC *time.Time } - -type WorkloadImpactPropertiesAdditionalProperties struct { -} diff --git a/sdk/resourcemanager/impactreporting/armimpactreporting/tsp-location.yaml b/sdk/resourcemanager/impactreporting/armimpactreporting/tsp-location.yaml index f5b1e4191a76..e55f99bf738a 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: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/impactreporting/armimpactreporting/workloadimpacts_client_example_test.go b/sdk/resourcemanager/impactreporting/armimpactreporting/workloadimpacts_client_example_test.go index 308dd6b2736c..ac07bf021961 100644 --- a/sdk/resourcemanager/impactreporting/armimpactreporting/workloadimpacts_client_example_test.go +++ b/sdk/resourcemanager/impactreporting/armimpactreporting/workloadimpacts_client_example_test.go @@ -251,6 +251,7 @@ func ExampleWorkloadImpactsClient_BeginCreate_reportingPerformanceRelatedImpact( MetricName: to.Ptr("CPU"), Actual: to.Ptr[float64](90), Expected: to.Ptr[float64](60), + Unit: to.Ptr(armimpactreporting.MetricUnit("garbage")), }, }, ClientIncidentDetails: &armimpactreporting.ClientIncidentDetails{ @@ -288,6 +289,7 @@ func ExampleWorkloadImpactsClient_BeginCreate_reportingPerformanceRelatedImpact( // MetricName: to.Ptr("CPU"), // Actual: to.Ptr[float64](90), // Expected: to.Ptr[float64](60), + // Unit: to.Ptr(armimpactreporting.MetricUnit("garbage")), // }, // }, // ClientIncidentDetails: &armimpactreporting.ClientIncidentDetails{ @@ -402,7 +404,9 @@ func ExampleWorkloadImpactsClient_NewListBySubscriptionPager() { // StartDateTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-06-15T05:59:46.6517821Z"); return t}()), // ImpactDescription: to.Ptr(""), // ImpactCategory: to.Ptr("Resource.Other"), - // AdditionalProperties: &armimpactreporting.WorkloadImpactPropertiesAdditionalProperties{ + // AdditionalProperties: map[string]any{ + // "errorCode": "504", + // "errorMessage": "Gateway timeout error", // }, // Workload: &armimpactreporting.Workload{ // Context: to.Ptr("webapp/scenario1"), diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md b/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md index 127b7a374721..62ab88a50eef 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md +++ b/sdk/resourcemanager/iotoperations/armiotoperations/CHANGELOG.md @@ -1,5 +1,13 @@ # Release History +## 1.1.0 (2025-05-13) +### Features Added + +- New enum type `InstanceFeatureMode` with values `InstanceFeatureModeDisabled`, `InstanceFeatureModePreview`, `InstanceFeatureModeStable` +- New struct `InstanceFeature` +- New field `Features` in struct `InstanceProperties` + + ## 1.0.0 (2024-12-12) ### Breaking Changes diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/broker_client.go b/sdk/resourcemanager/iotoperations/armiotoperations/broker_client.go index 37b7519f4430..59f0811b411b 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/broker_client.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/broker_client.go @@ -42,7 +42,7 @@ func NewBrokerClient(subscriptionID string, credential azcore.TokenCredential, o // BeginCreateOrUpdate - Create a BrokerResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -69,7 +69,7 @@ func (client *BrokerClient) BeginCreateOrUpdate(ctx context.Context, resourceGro // CreateOrUpdate - Create a BrokerResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *BrokerClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, resource BrokerResource, options *BrokerClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "BrokerClient.BeginCreateOrUpdate" @@ -115,7 +115,7 @@ func (client *BrokerClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -128,7 +128,7 @@ func (client *BrokerClient) createOrUpdateCreateRequest(ctx context.Context, res // BeginDelete - Delete a BrokerResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -153,7 +153,7 @@ func (client *BrokerClient) BeginDelete(ctx context.Context, resourceGroupName s // Delete - Delete a BrokerResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *BrokerClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, options *BrokerClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "BrokerClient.BeginDelete" @@ -199,7 +199,7 @@ func (client *BrokerClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -208,7 +208,7 @@ func (client *BrokerClient) deleteCreateRequest(ctx context.Context, resourceGro // Get - Get a BrokerResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -259,7 +259,7 @@ func (client *BrokerClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -276,7 +276,7 @@ func (client *BrokerClient) getHandleResponse(resp *http.Response) (BrokerClient // NewListByResourceGroupPager - List BrokerResource resources by InstanceResource // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - options - BrokerClientListByResourceGroupOptions contains the optional parameters for the BrokerClient.NewListByResourceGroupPager @@ -324,7 +324,7 @@ func (client *BrokerClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/broker_client_example_test.go b/sdk/resourcemanager/iotoperations/armiotoperations/broker_client_example_test.go index f487e3915e76..00bb93b7b5a4 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/broker_client_example_test.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/broker_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2024-11-01/Broker_CreateOrUpdate_Complex.json +// Generated from example definition: 2025-04-01/Broker_CreateOrUpdate_Complex.json func ExampleBrokerClient_BeginCreateOrUpdate_brokerCreateOrUpdateComplex() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -101,7 +101,7 @@ func ExampleBrokerClient_BeginCreateOrUpdate_brokerCreateOrUpdateComplex() { // } } -// Generated from example definition: 2024-11-01/Broker_CreateOrUpdate_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Broker_CreateOrUpdate_MaximumSet_Gen.json func ExampleBrokerClient_BeginCreateOrUpdate_brokerCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -442,7 +442,7 @@ func ExampleBrokerClient_BeginCreateOrUpdate_brokerCreateOrUpdate() { // } } -// Generated from example definition: 2024-11-01/Broker_CreateOrUpdate_Minimal.json +// Generated from example definition: 2025-04-01/Broker_CreateOrUpdate_Minimal.json func ExampleBrokerClient_BeginCreateOrUpdate_brokerCreateOrUpdateMinimal() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -640,7 +640,7 @@ func ExampleBrokerClient_BeginCreateOrUpdate_brokerCreateOrUpdateMinimal() { // } } -// Generated from example definition: 2024-11-01/Broker_CreateOrUpdate_Simple.json +// Generated from example definition: 2025-04-01/Broker_CreateOrUpdate_Simple.json func ExampleBrokerClient_BeginCreateOrUpdate_brokerCreateOrUpdateSimple() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -852,7 +852,7 @@ func ExampleBrokerClient_BeginCreateOrUpdate_brokerCreateOrUpdateSimple() { // } } -// Generated from example definition: 2024-11-01/Broker_Delete_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Broker_Delete_MaximumSet_Gen.json func ExampleBrokerClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -873,7 +873,7 @@ func ExampleBrokerClient_BeginDelete() { } } -// Generated from example definition: 2024-11-01/Broker_Get_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Broker_Get_MaximumSet_Gen.json func ExampleBrokerClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1059,7 +1059,7 @@ func ExampleBrokerClient_Get() { // } } -// Generated from example definition: 2024-11-01/Broker_ListByResourceGroup_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Broker_ListByResourceGroup_MaximumSet_Gen.json func ExampleBrokerClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthentication_client.go b/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthentication_client.go index b3d56310071b..e0eaef1d958b 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthentication_client.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthentication_client.go @@ -42,7 +42,7 @@ func NewBrokerAuthenticationClient(subscriptionID string, credential azcore.Toke // BeginCreateOrUpdate - Create a BrokerAuthenticationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -70,7 +70,7 @@ func (client *BrokerAuthenticationClient) BeginCreateOrUpdate(ctx context.Contex // CreateOrUpdate - Create a BrokerAuthenticationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *BrokerAuthenticationClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, resource BrokerAuthenticationResource, options *BrokerAuthenticationClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "BrokerAuthenticationClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *BrokerAuthenticationClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -133,7 +133,7 @@ func (client *BrokerAuthenticationClient) createOrUpdateCreateRequest(ctx contex // BeginDelete - Delete a BrokerAuthenticationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -160,7 +160,7 @@ func (client *BrokerAuthenticationClient) BeginDelete(ctx context.Context, resou // Delete - Delete a BrokerAuthenticationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *BrokerAuthenticationClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authenticationName string, options *BrokerAuthenticationClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "BrokerAuthenticationClient.BeginDelete" @@ -210,7 +210,7 @@ func (client *BrokerAuthenticationClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -219,7 +219,7 @@ func (client *BrokerAuthenticationClient) deleteCreateRequest(ctx context.Contex // Get - Get a BrokerAuthenticationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -276,7 +276,7 @@ func (client *BrokerAuthenticationClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -293,7 +293,7 @@ func (client *BrokerAuthenticationClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - List BrokerAuthenticationResource resources by BrokerResource // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -346,7 +346,7 @@ func (client *BrokerAuthenticationClient) listByResourceGroupCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthentication_client_example_test.go b/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthentication_client_example_test.go index cb45957019e6..21a70bec7e82 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthentication_client_example_test.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthentication_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2024-11-01/BrokerAuthentication_CreateOrUpdate_Complex.json +// Generated from example definition: 2025-04-01/BrokerAuthentication_CreateOrUpdate_Complex.json func ExampleBrokerAuthenticationClient_BeginCreateOrUpdate_brokerAuthenticationCreateOrUpdateComplex() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -139,7 +139,7 @@ func ExampleBrokerAuthenticationClient_BeginCreateOrUpdate_brokerAuthenticationC // } } -// Generated from example definition: 2024-11-01/BrokerAuthentication_CreateOrUpdate_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/BrokerAuthentication_CreateOrUpdate_MaximumSet_Gen.json func ExampleBrokerAuthenticationClient_BeginCreateOrUpdate_brokerAuthenticationCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -258,7 +258,7 @@ func ExampleBrokerAuthenticationClient_BeginCreateOrUpdate_brokerAuthenticationC // } } -// Generated from example definition: 2024-11-01/BrokerAuthentication_Delete_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/BrokerAuthentication_Delete_MaximumSet_Gen.json func ExampleBrokerAuthenticationClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -279,7 +279,7 @@ func ExampleBrokerAuthenticationClient_BeginDelete() { } } -// Generated from example definition: 2024-11-01/BrokerAuthentication_Get_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/BrokerAuthentication_Get_MaximumSet_Gen.json func ExampleBrokerAuthenticationClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -354,7 +354,7 @@ func ExampleBrokerAuthenticationClient_Get() { // } } -// Generated from example definition: 2024-11-01/BrokerAuthentication_ListByResourceGroup_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/BrokerAuthentication_ListByResourceGroup_MaximumSet_Gen.json func ExampleBrokerAuthenticationClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthorization_client.go b/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthorization_client.go index 4230c82e8d45..9f3268d19dd8 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthorization_client.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthorization_client.go @@ -42,7 +42,7 @@ func NewBrokerAuthorizationClient(subscriptionID string, credential azcore.Token // BeginCreateOrUpdate - Create a BrokerAuthorizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -70,7 +70,7 @@ func (client *BrokerAuthorizationClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Create a BrokerAuthorizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *BrokerAuthorizationClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, resource BrokerAuthorizationResource, options *BrokerAuthorizationClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "BrokerAuthorizationClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *BrokerAuthorizationClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -133,7 +133,7 @@ func (client *BrokerAuthorizationClient) createOrUpdateCreateRequest(ctx context // BeginDelete - Delete a BrokerAuthorizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -160,7 +160,7 @@ func (client *BrokerAuthorizationClient) BeginDelete(ctx context.Context, resour // Delete - Delete a BrokerAuthorizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *BrokerAuthorizationClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, authorizationName string, options *BrokerAuthorizationClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "BrokerAuthorizationClient.BeginDelete" @@ -210,7 +210,7 @@ func (client *BrokerAuthorizationClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -219,7 +219,7 @@ func (client *BrokerAuthorizationClient) deleteCreateRequest(ctx context.Context // Get - Get a BrokerAuthorizationResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -275,7 +275,7 @@ func (client *BrokerAuthorizationClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -292,7 +292,7 @@ func (client *BrokerAuthorizationClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - List BrokerAuthorizationResource resources by BrokerResource // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -345,7 +345,7 @@ func (client *BrokerAuthorizationClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthorization_client_example_test.go b/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthorization_client_example_test.go index 853476987e2e..dee3f89bd125 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthorization_client_example_test.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/brokerauthorization_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2024-11-01/BrokerAuthorization_CreateOrUpdate_Complex.json +// Generated from example definition: 2025-04-01/BrokerAuthorization_CreateOrUpdate_Complex.json func ExampleBrokerAuthorizationClient_BeginCreateOrUpdate_brokerAuthorizationCreateOrUpdateComplex() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -181,7 +181,7 @@ func ExampleBrokerAuthorizationClient_BeginCreateOrUpdate_brokerAuthorizationCre // } } -// Generated from example definition: 2024-11-01/BrokerAuthorization_CreateOrUpdate_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/BrokerAuthorization_CreateOrUpdate_MaximumSet_Gen.json func ExampleBrokerAuthorizationClient_BeginCreateOrUpdate_brokerAuthorizationCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -314,7 +314,7 @@ func ExampleBrokerAuthorizationClient_BeginCreateOrUpdate_brokerAuthorizationCre // } } -// Generated from example definition: 2024-11-01/BrokerAuthorization_CreateOrUpdate_Simple.json +// Generated from example definition: 2025-04-01/BrokerAuthorization_CreateOrUpdate_Simple.json func ExampleBrokerAuthorizationClient_BeginCreateOrUpdate_brokerAuthorizationCreateOrUpdateSimple() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -445,7 +445,7 @@ func ExampleBrokerAuthorizationClient_BeginCreateOrUpdate_brokerAuthorizationCre // } } -// Generated from example definition: 2024-11-01/BrokerAuthorization_Delete_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/BrokerAuthorization_Delete_MaximumSet_Gen.json func ExampleBrokerAuthorizationClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -466,7 +466,7 @@ func ExampleBrokerAuthorizationClient_BeginDelete() { } } -// Generated from example definition: 2024-11-01/BrokerAuthorization_Get_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/BrokerAuthorization_Get_MaximumSet_Gen.json func ExampleBrokerAuthorizationClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -548,7 +548,7 @@ func ExampleBrokerAuthorizationClient_Get() { // } } -// Generated from example definition: 2024-11-01/BrokerAuthorization_ListByResourceGroup_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/BrokerAuthorization_ListByResourceGroup_MaximumSet_Gen.json func ExampleBrokerAuthorizationClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/brokerlistener_client.go b/sdk/resourcemanager/iotoperations/armiotoperations/brokerlistener_client.go index d5d1ea22c305..c84bb90e224c 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/brokerlistener_client.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/brokerlistener_client.go @@ -42,7 +42,7 @@ func NewBrokerListenerClient(subscriptionID string, credential azcore.TokenCrede // BeginCreateOrUpdate - Create a BrokerListenerResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -70,7 +70,7 @@ func (client *BrokerListenerClient) BeginCreateOrUpdate(ctx context.Context, res // CreateOrUpdate - Create a BrokerListenerResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *BrokerListenerClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, resource BrokerListenerResource, options *BrokerListenerClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "BrokerListenerClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *BrokerListenerClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -133,7 +133,7 @@ func (client *BrokerListenerClient) createOrUpdateCreateRequest(ctx context.Cont // BeginDelete - Delete a BrokerListenerResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -160,7 +160,7 @@ func (client *BrokerListenerClient) BeginDelete(ctx context.Context, resourceGro // Delete - Delete a BrokerListenerResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *BrokerListenerClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, brokerName string, listenerName string, options *BrokerListenerClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "BrokerListenerClient.BeginDelete" @@ -210,7 +210,7 @@ func (client *BrokerListenerClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -219,7 +219,7 @@ func (client *BrokerListenerClient) deleteCreateRequest(ctx context.Context, res // Get - Get a BrokerListenerResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -275,7 +275,7 @@ func (client *BrokerListenerClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -292,7 +292,7 @@ func (client *BrokerListenerClient) getHandleResponse(resp *http.Response) (Brok // NewListByResourceGroupPager - List BrokerListenerResource resources by BrokerResource // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - brokerName - Name of broker. @@ -345,7 +345,7 @@ func (client *BrokerListenerClient) listByResourceGroupCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/brokerlistener_client_example_test.go b/sdk/resourcemanager/iotoperations/armiotoperations/brokerlistener_client_example_test.go index 3a4f968f43f4..6abf34fa0fbb 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/brokerlistener_client_example_test.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/brokerlistener_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_Complex.json +// Generated from example definition: 2025-04-01/BrokerListener_CreateOrUpdate_Complex.json func ExampleBrokerListenerClient_BeginCreateOrUpdate_brokerListenerCreateOrUpdateComplex() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -140,7 +140,7 @@ func ExampleBrokerListenerClient_BeginCreateOrUpdate_brokerListenerCreateOrUpdat // } } -// Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/BrokerListener_CreateOrUpdate_MaximumSet_Gen.json func ExampleBrokerListenerClient_BeginCreateOrUpdate_brokerListenerCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -271,7 +271,7 @@ func ExampleBrokerListenerClient_BeginCreateOrUpdate_brokerListenerCreateOrUpdat // } } -// Generated from example definition: 2024-11-01/BrokerListener_CreateOrUpdate_Simple.json +// Generated from example definition: 2025-04-01/BrokerListener_CreateOrUpdate_Simple.json func ExampleBrokerListenerClient_BeginCreateOrUpdate_brokerListenerCreateOrUpdateSimple() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -336,7 +336,7 @@ func ExampleBrokerListenerClient_BeginCreateOrUpdate_brokerListenerCreateOrUpdat // } } -// Generated from example definition: 2024-11-01/BrokerListener_Delete_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/BrokerListener_Delete_MaximumSet_Gen.json func ExampleBrokerListenerClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -357,7 +357,7 @@ func ExampleBrokerListenerClient_BeginDelete() { } } -// Generated from example definition: 2024-11-01/BrokerListener_Get_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/BrokerListener_Get_MaximumSet_Gen.json func ExampleBrokerListenerClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -438,7 +438,7 @@ func ExampleBrokerListenerClient_Get() { // } } -// Generated from example definition: 2024-11-01/BrokerListener_ListByResourceGroup_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/BrokerListener_ListByResourceGroup_MaximumSet_Gen.json func ExampleBrokerListenerClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/constants.go b/sdk/resourcemanager/iotoperations/armiotoperations/constants.go index 1cf40a4b83ed..b7b9d61bd079 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.1.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. @@ -421,6 +421,27 @@ func PossibleFilterTypeValues() []FilterType { } } +// InstanceFeatureMode - The enum defining mode of a feature. +type InstanceFeatureMode string + +const ( + // InstanceFeatureModeDisabled - Opt out of a feature + InstanceFeatureModeDisabled InstanceFeatureMode = "Disabled" + // InstanceFeatureModePreview - Opt in to enable a preview feature + InstanceFeatureModePreview InstanceFeatureMode = "Preview" + // InstanceFeatureModeStable - Opt in to enable a stable feature + InstanceFeatureModeStable InstanceFeatureMode = "Stable" +) + +// PossibleInstanceFeatureModeValues returns the possible values for the InstanceFeatureMode const type. +func PossibleInstanceFeatureModeValues() []InstanceFeatureMode { + return []InstanceFeatureMode{ + InstanceFeatureModeDisabled, + InstanceFeatureModePreview, + InstanceFeatureModeStable, + } +} + // KafkaAuthMethod - DataflowEndpoint Kafka Authentication Method properties type KafkaAuthMethod string diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/dataflow_client.go b/sdk/resourcemanager/iotoperations/armiotoperations/dataflow_client.go index d094e917ed61..833aeebbbbb4 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/dataflow_client.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/dataflow_client.go @@ -42,7 +42,7 @@ func NewDataflowClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Create a DataflowResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - dataflowProfileName - Name of Instance dataflowProfile resource @@ -70,7 +70,7 @@ func (client *DataflowClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create a DataflowResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *DataflowClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, resource DataflowResource, options *DataflowClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DataflowClient.BeginCreateOrUpdate" @@ -120,7 +120,7 @@ func (client *DataflowClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -133,7 +133,7 @@ func (client *DataflowClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Delete a DataflowResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - dataflowProfileName - Name of Instance dataflowProfile resource @@ -159,7 +159,7 @@ func (client *DataflowClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete a DataflowResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *DataflowClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, dataflowName string, options *DataflowClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DataflowClient.BeginDelete" @@ -209,7 +209,7 @@ func (client *DataflowClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,7 +218,7 @@ func (client *DataflowClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get a DataflowResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - dataflowProfileName - Name of Instance dataflowProfile resource @@ -274,7 +274,7 @@ func (client *DataflowClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -291,7 +291,7 @@ func (client *DataflowClient) getHandleResponse(resp *http.Response) (DataflowCl // NewListByResourceGroupPager - List DataflowResource resources by DataflowProfileResource // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - dataflowProfileName - Name of Instance dataflowProfile resource @@ -344,7 +344,7 @@ func (client *DataflowClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/dataflow_client_example_test.go b/sdk/resourcemanager/iotoperations/armiotoperations/dataflow_client_example_test.go index 15ac41e36e71..203ff4da08b9 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/dataflow_client_example_test.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/dataflow_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_ComplexContextualization.json +// Generated from example definition: 2025-04-01/Dataflow_CreateOrUpdate_ComplexContextualization.json func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateComplexContextualization() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -167,7 +167,7 @@ func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateComplexCont // } } -// Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_ComplexEventHub.json +// Generated from example definition: 2025-04-01/Dataflow_CreateOrUpdate_ComplexEventHub.json func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateComplexEventHub() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -355,7 +355,7 @@ func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateComplexEven // } } -// Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_FilterToTopic.json +// Generated from example definition: 2025-04-01/Dataflow_CreateOrUpdate_FilterToTopic.json func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateFilterToTopic() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -502,7 +502,7 @@ func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateFilterToTop // } } -// Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Dataflow_CreateOrUpdate_MaximumSet_Gen.json func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -667,7 +667,7 @@ func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdate() { // } } -// Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_SimpleEventGrid.json +// Generated from example definition: 2025-04-01/Dataflow_CreateOrUpdate_SimpleEventGrid.json func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateSimpleEventGrid() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -762,7 +762,7 @@ func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateSimpleEvent // } } -// Generated from example definition: 2024-11-01/Dataflow_CreateOrUpdate_SimpleFabric.json +// Generated from example definition: 2025-04-01/Dataflow_CreateOrUpdate_SimpleFabric.json func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateSimpleFabric() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -871,7 +871,7 @@ func ExampleDataflowClient_BeginCreateOrUpdate_dataflowCreateOrUpdateSimpleFabri // } } -// Generated from example definition: 2024-11-01/Dataflow_Delete_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Dataflow_Delete_MaximumSet_Gen.json func ExampleDataflowClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -892,7 +892,7 @@ func ExampleDataflowClient_BeginDelete() { } } -// Generated from example definition: 2024-11-01/Dataflow_Get_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Dataflow_Get_MaximumSet_Gen.json func ExampleDataflowClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -990,7 +990,7 @@ func ExampleDataflowClient_Get() { // } } -// Generated from example definition: 2024-11-01/Dataflow_ListByProfileResource_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Dataflow_ListByProfileResource_MaximumSet_Gen.json func ExampleDataflowClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client.go b/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client.go index 3e3e7658f5a3..809b663a32e3 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client.go @@ -42,7 +42,7 @@ func NewDataflowEndpointClient(subscriptionID string, credential azcore.TokenCre // BeginCreateOrUpdate - Create a DataflowEndpointResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - dataflowEndpointName - Name of Instance dataflowEndpoint resource @@ -69,7 +69,7 @@ func (client *DataflowEndpointClient) BeginCreateOrUpdate(ctx context.Context, r // CreateOrUpdate - Create a DataflowEndpointResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *DataflowEndpointClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, resource DataflowEndpointResource, options *DataflowEndpointClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DataflowEndpointClient.BeginCreateOrUpdate" @@ -115,7 +115,7 @@ func (client *DataflowEndpointClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -128,7 +128,7 @@ func (client *DataflowEndpointClient) createOrUpdateCreateRequest(ctx context.Co // BeginDelete - Delete a DataflowEndpointResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - dataflowEndpointName - Name of Instance dataflowEndpoint resource @@ -154,7 +154,7 @@ func (client *DataflowEndpointClient) BeginDelete(ctx context.Context, resourceG // Delete - Delete a DataflowEndpointResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *DataflowEndpointClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, dataflowEndpointName string, options *DataflowEndpointClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DataflowEndpointClient.BeginDelete" @@ -200,7 +200,7 @@ func (client *DataflowEndpointClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -209,7 +209,7 @@ func (client *DataflowEndpointClient) deleteCreateRequest(ctx context.Context, r // Get - Get a DataflowEndpointResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - dataflowEndpointName - Name of Instance dataflowEndpoint resource @@ -260,7 +260,7 @@ func (client *DataflowEndpointClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -277,7 +277,7 @@ func (client *DataflowEndpointClient) getHandleResponse(resp *http.Response) (Da // NewListByResourceGroupPager - List DataflowEndpointResource resources by InstanceResource // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - options - DataflowEndpointClientListByResourceGroupOptions contains the optional parameters for the DataflowEndpointClient.NewListByResourceGroupPager @@ -325,7 +325,7 @@ func (client *DataflowEndpointClient) listByResourceGroupCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client_example_test.go b/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client_example_test.go index 804413411bf4..dd481daa6909 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client_example_test.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/dataflowendpoint_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_ADLSv2.json +// Generated from example definition: 2025-04-01/DataflowEndpoint_CreateOrUpdate_ADLSv2.json func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdateAdlsv2() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -85,7 +85,7 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // } } -// Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_ADX.json +// Generated from example definition: 2025-04-01/DataflowEndpoint_CreateOrUpdate_ADX.json func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdateAdx() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -165,7 +165,7 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // } } -// Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_AIO.json +// Generated from example definition: 2025-04-01/DataflowEndpoint_CreateOrUpdate_AIO.json func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdateAio() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -182,6 +182,7 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU MqttSettings: &armiotoperations.DataflowEndpointMqtt{ Host: to.Ptr("aio-broker:18883"), Authentication: &armiotoperations.DataflowEndpointMqttAuthentication{ + Method: to.Ptr(armiotoperations.MqttAuthMethod("Kubernetes")), ServiceAccountTokenSettings: &armiotoperations.DataflowEndpointAuthenticationServiceAccountToken{ Audience: to.Ptr("aio-internal"), }, @@ -214,6 +215,7 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // MqttSettings: &armiotoperations.DataflowEndpointMqtt{ // Host: to.Ptr("aio-broker:18883"), // Authentication: &armiotoperations.DataflowEndpointMqttAuthentication{ + // Method: to.Ptr(armiotoperations.MqttAuthMethod("Kubernetes")), // ServiceAccountTokenSettings: &armiotoperations.DataflowEndpointAuthenticationServiceAccountToken{ // Audience: to.Ptr("aio-internal"), // }, @@ -244,7 +246,7 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // } } -// Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_EventGrid.json +// Generated from example definition: 2025-04-01/DataflowEndpoint_CreateOrUpdate_EventGrid.json func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdateEventGrid() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -320,7 +322,7 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // } } -// Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_EventHub.json +// Generated from example definition: 2025-04-01/DataflowEndpoint_CreateOrUpdate_EventHub.json func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdateEventHub() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -398,7 +400,7 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // } } -// Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_Fabric.json +// Generated from example definition: 2025-04-01/DataflowEndpoint_CreateOrUpdate_Fabric.json func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdateFabric() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -478,7 +480,7 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // } } -// Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_Kafka.json +// Generated from example definition: 2025-04-01/DataflowEndpoint_CreateOrUpdate_Kafka.json func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdateKafka() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -585,7 +587,7 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // } } -// Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_LocalStorage.json +// Generated from example definition: 2025-04-01/DataflowEndpoint_CreateOrUpdate_LocalStorage.json func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdateLocalStorage() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -646,7 +648,100 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // } } -// Generated from example definition: 2024-11-01/DataflowEndpoint_CreateOrUpdate_MaximumSet_Gen.json +// Generated from example definition: 2025-04-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: 2025-04-01/DataflowEndpoint_CreateOrUpdate_MaximumSet_Gen.json func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -758,6 +853,7 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU Mode: to.Ptr(armiotoperations.OperationalModeEnabled), TrustedCaCertificateConfigMapRef: to.Ptr("tectjjvukvelsreihwadh"), }, + CloudEventAttributes: to.Ptr(armiotoperations.CloudEventAttributeType("PassThrough")), }, LocalStorageSettings: &armiotoperations.DataflowEndpointLocalStorage{ PersistentVolumeClaimRef: to.Ptr("jjwqwvd"), @@ -792,6 +888,7 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU Mode: to.Ptr(armiotoperations.OperationalModeEnabled), TrustedCaCertificateConfigMapRef: to.Ptr("tectjjvukvelsreihwadh"), }, + CloudEventAttributes: to.Ptr(armiotoperations.CloudEventAttributeType("PassThrough")), }, }, ExtendedLocation: &armiotoperations.ExtendedLocation{ @@ -911,6 +1008,7 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // Mode: to.Ptr(armiotoperations.OperationalModeEnabled), // TrustedCaCertificateConfigMapRef: to.Ptr("tectjjvukvelsreihwadh"), // }, + // CloudEventAttributes: to.Ptr(armiotoperations.CloudEventAttributeType("PassThrough")), // }, // LocalStorageSettings: &armiotoperations.DataflowEndpointLocalStorage{ // PersistentVolumeClaimRef: to.Ptr("jjwqwvd"), @@ -945,6 +1043,7 @@ func ExampleDataflowEndpointClient_BeginCreateOrUpdate_dataflowEndpointCreateOrU // Mode: to.Ptr(armiotoperations.OperationalModeEnabled), // TrustedCaCertificateConfigMapRef: to.Ptr("tectjjvukvelsreihwadh"), // }, + // CloudEventAttributes: to.Ptr(armiotoperations.CloudEventAttributeType("PassThrough")), // }, // ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded), // }, @@ -967,100 +1066,7 @@ 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 +// Generated from example definition: 2025-04-01/DataflowEndpoint_Delete_MaximumSet_Gen.json func ExampleDataflowEndpointClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1081,7 +1087,7 @@ func ExampleDataflowEndpointClient_BeginDelete() { } } -// Generated from example definition: 2024-11-01/DataflowEndpoint_Get_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/DataflowEndpoint_Get_MaximumSet_Gen.json func ExampleDataflowEndpointClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1201,6 +1207,7 @@ func ExampleDataflowEndpointClient_Get() { // Mode: to.Ptr(armiotoperations.OperationalModeEnabled), // TrustedCaCertificateConfigMapRef: to.Ptr("tectjjvukvelsreihwadh"), // }, + // CloudEventAttributes: to.Ptr(armiotoperations.CloudEventAttributeType("PassThrough")), // }, // LocalStorageSettings: &armiotoperations.DataflowEndpointLocalStorage{ // PersistentVolumeClaimRef: to.Ptr("jjwqwvd"), @@ -1235,6 +1242,7 @@ func ExampleDataflowEndpointClient_Get() { // Mode: to.Ptr(armiotoperations.OperationalModeEnabled), // TrustedCaCertificateConfigMapRef: to.Ptr("tectjjvukvelsreihwadh"), // }, + // CloudEventAttributes: to.Ptr(armiotoperations.CloudEventAttributeType("PassThrough")), // }, // ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded), // }, @@ -1257,7 +1265,7 @@ func ExampleDataflowEndpointClient_Get() { // } } -// Generated from example definition: 2024-11-01/DataflowEndpoint_ListByResourceGroup_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/DataflowEndpoint_ListByResourceGroup_MaximumSet_Gen.json func ExampleDataflowEndpointClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -1383,6 +1391,7 @@ func ExampleDataflowEndpointClient_NewListByResourceGroupPager() { // Mode: to.Ptr(armiotoperations.OperationalModeEnabled), // TrustedCaCertificateConfigMapRef: to.Ptr("tectjjvukvelsreihwadh"), // }, + // CloudEventAttributes: to.Ptr(armiotoperations.CloudEventAttributeType("PassThrough")), // }, // LocalStorageSettings: &armiotoperations.DataflowEndpointLocalStorage{ // PersistentVolumeClaimRef: to.Ptr("jjwqwvd"), @@ -1417,6 +1426,7 @@ func ExampleDataflowEndpointClient_NewListByResourceGroupPager() { // Mode: to.Ptr(armiotoperations.OperationalModeEnabled), // TrustedCaCertificateConfigMapRef: to.Ptr("tectjjvukvelsreihwadh"), // }, + // CloudEventAttributes: to.Ptr(armiotoperations.CloudEventAttributeType("PassThrough")), // }, // ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded), // }, diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/dataflowprofile_client.go b/sdk/resourcemanager/iotoperations/armiotoperations/dataflowprofile_client.go index 0136425e5598..a08145a7ccb2 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/dataflowprofile_client.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/dataflowprofile_client.go @@ -42,7 +42,7 @@ func NewDataflowProfileClient(subscriptionID string, credential azcore.TokenCred // BeginCreateOrUpdate - Create a DataflowProfileResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - dataflowProfileName - Name of Instance dataflowProfile resource @@ -69,7 +69,7 @@ func (client *DataflowProfileClient) BeginCreateOrUpdate(ctx context.Context, re // CreateOrUpdate - Create a DataflowProfileResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *DataflowProfileClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, resource DataflowProfileResource, options *DataflowProfileClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DataflowProfileClient.BeginCreateOrUpdate" @@ -115,7 +115,7 @@ func (client *DataflowProfileClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -128,7 +128,7 @@ func (client *DataflowProfileClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - Delete a DataflowProfileResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - dataflowProfileName - Name of Instance dataflowProfile resource @@ -154,7 +154,7 @@ func (client *DataflowProfileClient) BeginDelete(ctx context.Context, resourceGr // Delete - Delete a DataflowProfileResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *DataflowProfileClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, dataflowProfileName string, options *DataflowProfileClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DataflowProfileClient.BeginDelete" @@ -200,7 +200,7 @@ func (client *DataflowProfileClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -209,7 +209,7 @@ func (client *DataflowProfileClient) deleteCreateRequest(ctx context.Context, re // Get - Get a DataflowProfileResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - dataflowProfileName - Name of Instance dataflowProfile resource @@ -260,7 +260,7 @@ func (client *DataflowProfileClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -277,7 +277,7 @@ func (client *DataflowProfileClient) getHandleResponse(resp *http.Response) (Dat // NewListByResourceGroupPager - List DataflowProfileResource resources by InstanceResource // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - options - DataflowProfileClientListByResourceGroupOptions contains the optional parameters for the DataflowProfileClient.NewListByResourceGroupPager @@ -325,7 +325,7 @@ func (client *DataflowProfileClient) listByResourceGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/dataflowprofile_client_example_test.go b/sdk/resourcemanager/iotoperations/armiotoperations/dataflowprofile_client_example_test.go index fa2e2c5abc3a..a563b99972e6 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/dataflowprofile_client_example_test.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/dataflowprofile_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2024-11-01/DataflowProfile_CreateOrUpdate_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/DataflowProfile_CreateOrUpdate_MaximumSet_Gen.json func ExampleDataflowProfileClient_BeginCreateOrUpdate_dataflowProfileCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -83,7 +83,7 @@ func ExampleDataflowProfileClient_BeginCreateOrUpdate_dataflowProfileCreateOrUpd // } } -// Generated from example definition: 2024-11-01/DataflowProfile_CreateOrUpdate_Minimal.json +// Generated from example definition: 2025-04-01/DataflowProfile_CreateOrUpdate_Minimal.json func ExampleDataflowProfileClient_BeginCreateOrUpdate_dataflowProfileCreateOrUpdateMinimal() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -138,7 +138,7 @@ func ExampleDataflowProfileClient_BeginCreateOrUpdate_dataflowProfileCreateOrUpd // } } -// Generated from example definition: 2024-11-01/DataflowProfile_CreateOrUpdate_Multi.json +// Generated from example definition: 2025-04-01/DataflowProfile_CreateOrUpdate_Multi.json func ExampleDataflowProfileClient_BeginCreateOrUpdate_dataflowProfileCreateOrUpdateMulti() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -193,7 +193,7 @@ func ExampleDataflowProfileClient_BeginCreateOrUpdate_dataflowProfileCreateOrUpd // } } -// Generated from example definition: 2024-11-01/DataflowProfile_Delete_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/DataflowProfile_Delete_MaximumSet_Gen.json func ExampleDataflowProfileClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -214,7 +214,7 @@ func ExampleDataflowProfileClient_BeginDelete() { } } -// Generated from example definition: 2024-11-01/DataflowProfile_Get_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/DataflowProfile_Get_MaximumSet_Gen.json func ExampleDataflowProfileClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -265,7 +265,7 @@ func ExampleDataflowProfileClient_Get() { // } } -// Generated from example definition: 2024-11-01/DataflowProfile_ListByResourceGroup_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/DataflowProfile_ListByResourceGroup_MaximumSet_Gen.json func ExampleDataflowProfileClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/broker_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/broker_server.go index 67b5ac3a9a4e..479b666e00b2 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/broker_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/broker_server.go @@ -117,7 +117,7 @@ func (b *BrokerServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armiotoperations.BrokerResource](req) @@ -169,7 +169,7 @@ func (b *BrokerServerTransport) dispatchBeginDelete(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -215,7 +215,7 @@ func (b *BrokerServerTransport) dispatchGet(req *http.Request) (*http.Response, const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -254,7 +254,7 @@ func (b *BrokerServerTransport) dispatchNewListByResourceGroupPager(req *http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthentication_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthentication_server.go index 41db4c63b617..b222b5631ef7 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthentication_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthentication_server.go @@ -117,7 +117,7 @@ func (b *BrokerAuthenticationServerTransport) dispatchBeginCreateOrUpdate(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authentications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armiotoperations.BrokerAuthenticationResource](req) @@ -173,7 +173,7 @@ func (b *BrokerAuthenticationServerTransport) dispatchBeginDelete(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authentications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -223,7 +223,7 @@ func (b *BrokerAuthenticationServerTransport) dispatchGet(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authentications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -266,7 +266,7 @@ func (b *BrokerAuthenticationServerTransport) dispatchNewListByResourceGroupPage const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authentications` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthorization_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthorization_server.go index c7ab5780363d..9ced6f4e6053 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthorization_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerauthorization_server.go @@ -117,7 +117,7 @@ func (b *BrokerAuthorizationServerTransport) dispatchBeginCreateOrUpdate(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authorizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armiotoperations.BrokerAuthorizationResource](req) @@ -173,7 +173,7 @@ func (b *BrokerAuthorizationServerTransport) dispatchBeginDelete(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authorizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -223,7 +223,7 @@ func (b *BrokerAuthorizationServerTransport) dispatchGet(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authorizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -266,7 +266,7 @@ func (b *BrokerAuthorizationServerTransport) dispatchNewListByResourceGroupPager const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/authorizations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerlistener_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerlistener_server.go index 3d1143862494..c8ae06cdfcf4 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerlistener_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/brokerlistener_server.go @@ -117,7 +117,7 @@ func (b *BrokerListenerServerTransport) dispatchBeginCreateOrUpdate(req *http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listeners/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armiotoperations.BrokerListenerResource](req) @@ -173,7 +173,7 @@ func (b *BrokerListenerServerTransport) dispatchBeginDelete(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listeners/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -223,7 +223,7 @@ func (b *BrokerListenerServerTransport) dispatchGet(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listeners/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -266,7 +266,7 @@ func (b *BrokerListenerServerTransport) dispatchNewListByResourceGroupPager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/brokers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listeners` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflow_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflow_server.go index 59cb0f102922..5199b0fac52b 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflow_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflow_server.go @@ -117,7 +117,7 @@ func (d *DataflowServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflows/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armiotoperations.DataflowResource](req) @@ -173,7 +173,7 @@ func (d *DataflowServerTransport) dispatchBeginDelete(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflows/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -223,7 +223,7 @@ func (d *DataflowServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflows/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -266,7 +266,7 @@ func (d *DataflowServerTransport) dispatchNewListByResourceGroupPager(req *http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflows` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowendpoint_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowendpoint_server.go index 85e95d3fee3d..3a031add6f3b 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowendpoint_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowendpoint_server.go @@ -117,7 +117,7 @@ func (d *DataflowEndpointServerTransport) dispatchBeginCreateOrUpdate(req *http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armiotoperations.DataflowEndpointResource](req) @@ -169,7 +169,7 @@ func (d *DataflowEndpointServerTransport) dispatchBeginDelete(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -215,7 +215,7 @@ func (d *DataflowEndpointServerTransport) dispatchGet(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowEndpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -254,7 +254,7 @@ func (d *DataflowEndpointServerTransport) dispatchNewListByResourceGroupPager(re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowEndpoints` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowprofile_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowprofile_server.go index 6d0d4c67b302..8615fb4037c3 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowprofile_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/dataflowprofile_server.go @@ -117,7 +117,7 @@ func (d *DataflowProfileServerTransport) dispatchBeginCreateOrUpdate(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armiotoperations.DataflowProfileResource](req) @@ -169,7 +169,7 @@ func (d *DataflowProfileServerTransport) dispatchBeginDelete(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -215,7 +215,7 @@ func (d *DataflowProfileServerTransport) dispatchGet(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -254,7 +254,7 @@ func (d *DataflowProfileServerTransport) dispatchNewListByResourceGroupPager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dataflowProfiles` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/instance_server.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/instance_server.go index 8f398c784034..fec7373f3eba 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/instance_server.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/fake/instance_server.go @@ -131,7 +131,7 @@ func (i *InstanceServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armiotoperations.InstanceResource](req) @@ -179,7 +179,7 @@ func (i *InstanceServerTransport) dispatchBeginDelete(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,7 +221,7 @@ func (i *InstanceServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -256,7 +256,7 @@ func (i *InstanceServerTransport) dispatchNewListByResourceGroupPager(req *http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -293,7 +293,7 @@ func (i *InstanceServerTransport) dispatchNewListBySubscriptionPager(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := i.srv.NewListBySubscriptionPager(nil) @@ -324,7 +324,7 @@ func (i *InstanceServerTransport) dispatchUpdate(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.IoTOperations/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armiotoperations.InstancePatchModel](req) diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/fake/time_rfc3339.go b/sdk/resourcemanager/iotoperations/armiotoperations/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/iotoperations/armiotoperations/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/iotoperations/armiotoperations/instance_client.go b/sdk/resourcemanager/iotoperations/armiotoperations/instance_client.go index 86e203739fdd..3c039d43e1bf 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/instance_client.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/instance_client.go @@ -42,7 +42,7 @@ func NewInstanceClient(subscriptionID string, credential azcore.TokenCredential, // BeginCreateOrUpdate - Create a InstanceResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - resource - Resource create parameters. @@ -68,7 +68,7 @@ func (client *InstanceClient) BeginCreateOrUpdate(ctx context.Context, resourceG // CreateOrUpdate - Create a InstanceResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *InstanceClient) createOrUpdate(ctx context.Context, resourceGroupName string, instanceName string, resource InstanceResource, options *InstanceClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "InstanceClient.BeginCreateOrUpdate" @@ -110,7 +110,7 @@ func (client *InstanceClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -123,7 +123,7 @@ func (client *InstanceClient) createOrUpdateCreateRequest(ctx context.Context, r // BeginDelete - Delete a InstanceResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - options - InstanceClientBeginDeleteOptions contains the optional parameters for the InstanceClient.BeginDelete method. @@ -147,7 +147,7 @@ func (client *InstanceClient) BeginDelete(ctx context.Context, resourceGroupName // Delete - Delete a InstanceResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 func (client *InstanceClient) deleteOperation(ctx context.Context, resourceGroupName string, instanceName string, options *InstanceClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "InstanceClient.BeginDelete" @@ -189,7 +189,7 @@ func (client *InstanceClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -198,7 +198,7 @@ func (client *InstanceClient) deleteCreateRequest(ctx context.Context, resourceG // Get - Get a InstanceResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - options - InstanceClientGetOptions contains the optional parameters for the InstanceClient.Get method. @@ -244,7 +244,7 @@ func (client *InstanceClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,7 +261,7 @@ func (client *InstanceClient) getHandleResponse(resp *http.Response) (InstanceCl // NewListByResourceGroupPager - List InstanceResource resources by resource group // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - InstanceClientListByResourceGroupOptions contains the optional parameters for the InstanceClient.NewListByResourceGroupPager // method. @@ -304,7 +304,7 @@ func (client *InstanceClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +321,7 @@ func (client *InstanceClient) listByResourceGroupHandleResponse(resp *http.Respo // NewListBySubscriptionPager - List InstanceResource resources by subscription ID // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - options - InstanceClientListBySubscriptionOptions contains the optional parameters for the InstanceClient.NewListBySubscriptionPager // method. func (client *InstanceClient) NewListBySubscriptionPager(options *InstanceClientListBySubscriptionOptions) *runtime.Pager[InstanceClientListBySubscriptionResponse] { @@ -359,7 +359,7 @@ func (client *InstanceClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -377,7 +377,7 @@ func (client *InstanceClient) listBySubscriptionHandleResponse(resp *http.Respon // Update - Update a InstanceResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-11-01 +// Generated from API version 2025-04-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instanceName - Name of instance. // - properties - The resource properties to be updated. @@ -424,7 +424,7 @@ func (client *InstanceClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-11-01") + reqQP.Set("api-version", "2025-04-01") 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/iotoperations/armiotoperations/instance_client_example_test.go b/sdk/resourcemanager/iotoperations/armiotoperations/instance_client_example_test.go index c5b0f765e49a..707d1feb8467 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/instance_client_example_test.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/instance_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2024-11-01/Instance_CreateOrUpdate_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Instance_CreateOrUpdate_MaximumSet_Gen.json func ExampleInstanceClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -90,7 +90,7 @@ func ExampleInstanceClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: 2024-11-01/Instance_Delete_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Instance_Delete_MaximumSet_Gen.json func ExampleInstanceClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -111,7 +111,7 @@ func ExampleInstanceClient_BeginDelete() { } } -// Generated from example definition: 2024-11-01/Instance_Get_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Instance_Get_MaximumSet_Gen.json func ExampleInstanceClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -138,6 +138,19 @@ func ExampleInstanceClient_Get() { // Description: to.Ptr("rlfvvnnhcypp"), // ProvisioningState: to.Ptr(armiotoperations.ProvisioningStateSucceeded), // Version: to.Ptr("vjjbmunthiphfmekvxgxcxkzdwjti"), + // Features: map[string]*armiotoperations.InstanceFeature{ + // "dataFlows": &armiotoperations.InstanceFeature{ + // Mode: to.Ptr(armiotoperations.InstanceFeatureModeDisabled), + // }, + // "akri": &armiotoperations.InstanceFeature{ + // Mode: to.Ptr(armiotoperations.InstanceFeatureModePreview), + // }, + // "mqttBroker": &armiotoperations.InstanceFeature{ + // Settings: map[string]*armiotoperations.OperationalMode{ + // "preview": to.Ptr(armiotoperations.OperationalModeEnabled), + // }, + // }, + // }, // }, // ExtendedLocation: &armiotoperations.ExtendedLocation{ // Name: to.Ptr("qmbrfwcpwwhggszhrdjv"), @@ -168,7 +181,7 @@ func ExampleInstanceClient_Get() { // } } -// Generated from example definition: 2024-11-01/Instance_ListByResourceGroup_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Instance_ListByResourceGroup_MaximumSet_Gen.json func ExampleInstanceClient_NewListByResourceGroupPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -235,7 +248,7 @@ func ExampleInstanceClient_NewListByResourceGroupPager() { } } -// Generated from example definition: 2024-11-01/Instance_ListBySubscription_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Instance_ListBySubscription_MaximumSet_Gen.json func ExampleInstanceClient_NewListBySubscriptionPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -302,7 +315,7 @@ func ExampleInstanceClient_NewListBySubscriptionPager() { } } -// Generated from example definition: 2024-11-01/Instance_Update_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Instance_Update_MaximumSet_Gen.json func ExampleInstanceClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/models.go b/sdk/resourcemanager/iotoperations/armiotoperations/models.go index ef1a2229ab7d..16dc0a1f5924 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/models.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/models.go @@ -997,6 +997,15 @@ type GenerateResourceLimits struct { CPU *OperationalMode } +// InstanceFeature - The features of the AIO Instance. +type InstanceFeature struct { + // The state of the feature. + Mode *InstanceFeatureMode + + // The settings of the feature. + Settings map[string]*OperationalMode +} + // InstancePatchModel - The Instance update model. type InstancePatchModel struct { // The managed service identities assigned to this resource. @@ -1014,6 +1023,9 @@ type InstanceProperties struct { // Detailed description of the Instance. Description *string + // The features of the AIO Instance. + Features map[string]*InstanceFeature + // READ-ONLY; The status of the last operation. ProvisioningState *ProvisioningState @@ -1132,14 +1144,16 @@ type Metrics struct { PrometheusPort *int32 } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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/models_serde.go b/sdk/resourcemanager/iotoperations/armiotoperations/models_serde.go index 9fcbb4351631..93ec3e9a2727 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/models_serde.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/models_serde.go @@ -2644,6 +2644,37 @@ func (g *GenerateResourceLimits) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type InstanceFeature. +func (i InstanceFeature) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "mode", i.Mode) + populate(objectMap, "settings", i.Settings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InstanceFeature. +func (i *InstanceFeature) UnmarshalJSON(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 "mode": + err = unpopulate(val, "Mode", &i.Mode) + delete(rawMsg, key) + case "settings": + err = unpopulate(val, "Settings", &i.Settings) + 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 InstancePatchModel. func (i InstancePatchModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2679,6 +2710,7 @@ func (i *InstancePatchModel) UnmarshalJSON(data []byte) error { func (i InstanceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "description", i.Description) + populate(objectMap, "features", i.Features) populate(objectMap, "provisioningState", i.ProvisioningState) populate(objectMap, "schemaRegistryRef", i.SchemaRegistryRef) populate(objectMap, "version", i.Version) @@ -2697,6 +2729,9 @@ func (i *InstanceProperties) UnmarshalJSON(data []byte) error { case "description": err = unpopulate(val, "Description", &i.Description) delete(rawMsg, key) + case "features": + err = unpopulate(val, "Features", &i.Features) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &i.ProvisioningState) delete(rawMsg, key) diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/operations_client.go b/sdk/resourcemanager/iotoperations/armiotoperations/operations_client.go index 04e962c7e463..f2bda7330416 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/operations_client.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/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-11-01 +// Generated from API version 2025-04-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]{ @@ -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-11-01") + reqQP.Set("api-version", "2025-04-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/operations_client_example_test.go b/sdk/resourcemanager/iotoperations/armiotoperations/operations_client_example_test.go index 352775a01946..964075187bd9 100644 --- a/sdk/resourcemanager/iotoperations/armiotoperations/operations_client_example_test.go +++ b/sdk/resourcemanager/iotoperations/armiotoperations/operations_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2024-11-01/Operations_List_MaximumSet_Gen.json +// Generated from example definition: 2025-04-01/Operations_List_MaximumSet_Gen.json func ExampleOperationsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/iotoperations/armiotoperations/tsp-location.yaml b/sdk/resourcemanager/iotoperations/armiotoperations/tsp-location.yaml index 613fd52508c3..dcbf0f0272de 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: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs additionalDirectories: diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md b/sdk/resourcemanager/mongocluster/armmongocluster/CHANGELOG.md index 47629dbbcb66..07b38c71fd5b 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-05-13) +### 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..789df63f389a 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 @@ -182,7 +200,7 @@ type PrivateEndpointServiceConnectionStatus string const ( // PrivateEndpointServiceConnectionStatusApproved - Connection approved PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" - // PrivateEndpointServiceConnectionStatusPending - Connectionaiting for approval or rejection + // PrivateEndpointServiceConnectionStatusPending - Connection waiting for approval or rejection PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" // PrivateEndpointServiceConnectionStatusRejected - Connection Rejected PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" diff --git a/sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/firewallrules_server.go index 2fa0dba5139c..5d48fdbd56a4 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) { @@ -98,7 +117,7 @@ func (f *FirewallRulesServerTransport) dispatchBeginCreateOrUpdate(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?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) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmongocluster.FirewallRule](req) @@ -150,7 +169,7 @@ func (f *FirewallRulesServerTransport) dispatchBeginDelete(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?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) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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) @@ -196,7 +215,7 @@ func (f *FirewallRulesServerTransport) dispatchGet(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?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) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -235,7 +254,7 @@ func (f *FirewallRulesServerTransport) dispatchNewListByMongoClusterPager(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/firewallRules` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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..b8f81df64e33 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) { @@ -132,7 +151,7 @@ func (m *MongoClustersServerTransport) dispatchCheckNameAvailability(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/checkMongoClusterNameAvailability` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmongocluster.CheckNameAvailabilityRequest](req) @@ -167,7 +186,7 @@ func (m *MongoClustersServerTransport) dispatchBeginCreateOrUpdate(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmongocluster.MongoCluster](req) @@ -215,7 +234,7 @@ func (m *MongoClustersServerTransport) dispatchBeginDelete(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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) @@ -257,7 +276,7 @@ func (m *MongoClustersServerTransport) dispatchGet(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -292,7 +311,7 @@ func (m *MongoClustersServerTransport) dispatchNewListPager(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := m.srv.NewListPager(nil) @@ -325,7 +344,7 @@ func (m *MongoClustersServerTransport) dispatchNewListByResourceGroupPager(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -360,7 +379,7 @@ func (m *MongoClustersServerTransport) dispatchListConnectionStrings(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listConnectionStrings` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -395,7 +414,7 @@ func (m *MongoClustersServerTransport) dispatchBeginPromote(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/promote` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmongocluster.PromoteReplicaRequest](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) @@ -443,7 +462,7 @@ func (m *MongoClustersServerTransport) dispatchBeginUpdate(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmongocluster.Update](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..3b94a63ba6d1 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) { @@ -98,7 +117,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreate(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armmongocluster.PrivateEndpointConnectionResource](req) @@ -150,7 +169,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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) @@ -196,7 +215,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?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 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -235,7 +254,7 @@ func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListByMongoCluste const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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..898f7da69897 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) { @@ -75,7 +94,7 @@ func (p *PrivateLinksServerTransport) dispatchNewListByMongoClusterPager(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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..3192e27b6c8e 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) { @@ -75,7 +94,7 @@ func (r *ReplicasServerTransport) dispatchNewListByParentPager(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.DocumentDB/mongoClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/replicas` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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/fake/time_rfc3339.go b/sdk/resourcemanager/mongocluster/armmongocluster/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/mongocluster/armmongocluster/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/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..bf63c6295b8d 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. @@ -146,14 +152,16 @@ type MongoCluster struct { Type *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 @@ -195,9 +203,9 @@ type OperationListResult struct { NextLink *string } -// PrivateEndpoint - The Private Endpoint resource. +// PrivateEndpoint - The private endpoint resource. type PrivateEndpoint struct { - // READ-ONLY; The resource identifier for private endpoint + // READ-ONLY; The resource identifier of the private endpoint ID *string } @@ -337,6 +345,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 +503,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..f734c2e138aa 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: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs additionalDirectories: diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/CHANGELOG.md b/sdk/resourcemanager/neonpostgres/armneonpostgres/CHANGELOG.md index a460778170ed..f8025204acb5 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/CHANGELOG.md +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/CHANGELOG.md @@ -1,5 +1,28 @@ # Release History +## 2.0.0 (2025-05-13) +### Breaking Changes + +- Function `*BranchesClient.BeginUpdate` has been removed +- Function `*ComputesClient.BeginCreateOrUpdate` has been removed +- Function `*ComputesClient.Delete` has been removed +- Function `*ComputesClient.Get` has been removed +- Function `*ComputesClient.BeginUpdate` has been removed +- Function `*EndpointsClient.BeginCreateOrUpdate` has been removed +- Function `*EndpointsClient.Delete` has been removed +- Function `*EndpointsClient.Get` has been removed +- Function `*EndpointsClient.BeginUpdate` has been removed +- Function `*ProjectsClient.BeginUpdate` has been removed +- Function `*NeonDatabasesClient.BeginCreateOrUpdate` has been removed +- Function `*NeonDatabasesClient.Delete` has been removed +- Function `*NeonDatabasesClient.Get` has been removed +- Function `*NeonDatabasesClient.BeginUpdate` has been removed +- Function `*NeonRolesClient.BeginCreateOrUpdate` has been removed +- Function `*NeonRolesClient.Delete` has been removed +- Function `*NeonRolesClient.Get` has been removed +- Function `*NeonRolesClient.BeginUpdate` has been removed + + ## 1.0.0 (2025-04-07) ### Features Added diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/README.md b/sdk/resourcemanager/neonpostgres/armneonpostgres/README.md index 6cfc1c475d34..3445ffe3a746 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/README.md +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Neon Postgres module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client.go index ad2d810cb2a4..d8625291e76c 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client.go @@ -336,93 +336,3 @@ func (client *BranchesClient) listHandleResponse(resp *http.Response) (BranchesC } return result, nil } - -// BeginUpdate - Update a Branch -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - properties - The resource properties to be updated. -// - options - BranchesClientBeginUpdateOptions contains the optional parameters for the BranchesClient.BeginUpdate method. -func (client *BranchesClient) BeginUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, properties Branch, options *BranchesClientBeginUpdateOptions) (*runtime.Poller[BranchesClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, organizationName, projectName, branchName, properties, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[BranchesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[BranchesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Update a Branch -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *BranchesClient) update(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, properties Branch, options *BranchesClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "BranchesClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, 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 *BranchesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, properties Branch, _ *BranchesClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - 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-03-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/neonpostgres/armneonpostgres/branches_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client_example_test.go index 68b151174101..d1908c40c322 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/branches_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/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) @@ -23,7 +23,7 @@ func ExampleBranchesClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewBranchesClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", "test-entity", "test-entity", armneonpostgres.Branch{ + poller, err := clientFactory.NewBranchesClient().BeginCreateOrUpdate(ctx, "rgneon", "contoso-org", "sample-resource", "sample-resource", armneonpostgres.Branch{ Properties: &armneonpostgres.BranchProperties{ EntityName: to.Ptr("entity-name"), Attributes: []*armneonpostgres.Attributes{ @@ -94,10 +94,7 @@ func ExampleBranchesClient_BeginCreateOrUpdate() { // res = armneonpostgres.BranchesClientCreateOrUpdateResponse{ // Branch: &armneonpostgres.Branch{ // Properties: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -110,10 +107,7 @@ func ExampleBranchesClient_BeginCreateOrUpdate() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -125,14 +119,14 @@ func ExampleBranchesClient_BeginCreateOrUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -141,14 +135,14 @@ func ExampleBranchesClient_BeginCreateOrUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -158,8 +152,14 @@ func ExampleBranchesClient_BeginCreateOrUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/test-entity/branches/test-entity"), // Name: to.Ptr("qdyblgfrtcnffzvm"), @@ -187,7 +187,7 @@ func ExampleBranchesClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewBranchesClient().Delete(ctx, "rgneon", "test-org", "entity-name", "entity-name", nil) + res, err := clientFactory.NewBranchesClient().Delete(ctx, "rgneon", "contoso-org", "sample-resource", "sample-resource", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -209,7 +209,7 @@ func ExampleBranchesClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewBranchesClient().Get(ctx, "rgneon", "test-org", "entity-name", "entity-name", nil) + res, err := clientFactory.NewBranchesClient().Get(ctx, "rgneon", "contoso-org", "sample-resource", "sample-resource", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -219,10 +219,7 @@ func ExampleBranchesClient_Get() { // res = armneonpostgres.BranchesClientGetResponse{ // Branch: &armneonpostgres.Branch{ // Properties: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -235,10 +232,7 @@ func ExampleBranchesClient_Get() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -250,14 +244,14 @@ func ExampleBranchesClient_Get() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -266,14 +260,14 @@ func ExampleBranchesClient_Get() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -283,8 +277,14 @@ func ExampleBranchesClient_Get() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/test-entity/branches/test-entity"), // Name: to.Ptr("qdyblgfrtcnffzvm"), @@ -312,7 +312,7 @@ func ExampleBranchesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewBranchesClient().NewListPager("rgneon", "test-org", "entity-name", nil) + pager := clientFactory.NewBranchesClient().NewListPager("rgneon", "contoso-org", "sample-resource", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -413,167 +413,3 @@ func ExampleBranchesClient_NewListPager() { // } } } - -// Generated from example definition: 2025-03-01/Branches_Update_MaximumSet_Gen.json -func ExampleBranchesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewBranchesClient().BeginUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", armneonpostgres.Branch{ - Properties: &armneonpostgres.BranchProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("oik"), - ParentID: to.Ptr("entity-id"), - RoleName: to.Ptr("qrrairsupyosxnqotdwhbpc"), - DatabaseName: to.Ptr("duhxebzhd"), - Roles: []*armneonpostgres.NeonRoleProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - Permissions: []*string{ - to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - }, - IsSuperUser: to.Ptr(true), - }, - }, - Databases: []*armneonpostgres.NeonDatabaseProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - OwnerName: to.Ptr("odmbeg"), - }, - }, - Endpoints: []*armneonpostgres.EndpointProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.BranchesClientUpdateResponse{ - // Branch: &armneonpostgres.Branch{ - // Properties: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("oik"), - // ParentID: to.Ptr("entity-id"), - // RoleName: to.Ptr("qrrairsupyosxnqotdwhbpc"), - // DatabaseName: to.Ptr("duhxebzhd"), - // Roles: []*armneonpostgres.NeonRoleProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - // Permissions: []*string{ - // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - // }, - // IsSuperUser: to.Ptr(true), - // }, - // }, - // Databases: []*armneonpostgres.NeonDatabaseProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - // OwnerName: to.Ptr("odmbeg"), - // }, - // }, - // Endpoints: []*armneonpostgres.EndpointProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - // }, - // }, - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/test-entity/branches/test-entity"), - // Name: to.Ptr("qdyblgfrtcnffzvm"), - // Type: to.Ptr("kciaergnu"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client.go index 5b75da4a0c5c..3e255f644cb8 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client.go @@ -39,250 +39,6 @@ func NewComputesClient(subscriptionID string, credential azcore.TokenCredential, return client, nil } -// BeginCreateOrUpdate - Create a Compute -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - computeName - The name of the Compute -// - resource - Resource create parameters. -// - options - ComputesClientBeginCreateOrUpdateOptions contains the optional parameters for the ComputesClient.BeginCreateOrUpdate -// method. -func (client *ComputesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, resource Compute, options *ComputesClientBeginCreateOrUpdateOptions) (*runtime.Poller[ComputesClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, organizationName, projectName, branchName, computeName, resource, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ComputesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ComputesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Create a Compute -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *ComputesClient) createOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, resource Compute, options *ComputesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "ComputesClient.BeginCreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, computeName, 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 *ComputesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, resource Compute, _ *ComputesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/computes/{computeName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if computeName == "" { - return nil, errors.New("parameter computeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) - 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-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, resource); err != nil { - return nil, err - } - return req, nil -} - -// Delete - Delete a Compute -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - computeName - The name of the Compute -// - options - ComputesClientDeleteOptions contains the optional parameters for the ComputesClient.Delete method. -func (client *ComputesClient) Delete(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, options *ComputesClientDeleteOptions) (ComputesClientDeleteResponse, error) { - var err error - const operationName = "ComputesClient.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, organizationName, projectName, branchName, computeName, options) - if err != nil { - return ComputesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ComputesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return ComputesClientDeleteResponse{}, err - } - return ComputesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *ComputesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, _ *ComputesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/computes/{computeName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if computeName == "" { - return nil, errors.New("parameter computeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) - 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-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get a Compute -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - computeName - The name of the Compute -// - options - ComputesClientGetOptions contains the optional parameters for the ComputesClient.Get method. -func (client *ComputesClient) Get(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, options *ComputesClientGetOptions) (ComputesClientGetResponse, error) { - var err error - const operationName = "ComputesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, computeName, options) - if err != nil { - return ComputesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return ComputesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return ComputesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *ComputesClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, _ *ComputesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/computes/{computeName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if computeName == "" { - return nil, errors.New("parameter computeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) - 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-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *ComputesClient) getHandleResponse(resp *http.Response) (ComputesClientGetResponse, error) { - result := ComputesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Compute); err != nil { - return ComputesClientGetResponse{}, err - } - return result, nil -} - // NewListPager - List Compute resources by Branch // // Generated from API version 2025-03-01 @@ -356,98 +112,3 @@ func (client *ComputesClient) listHandleResponse(resp *http.Response) (ComputesC } return result, nil } - -// BeginUpdate - Update a Compute -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - computeName - The name of the Compute -// - properties - The resource properties to be updated. -// - options - ComputesClientBeginUpdateOptions contains the optional parameters for the ComputesClient.BeginUpdate method. -func (client *ComputesClient) BeginUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, properties Compute, options *ComputesClientBeginUpdateOptions) (*runtime.Poller[ComputesClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, organizationName, projectName, branchName, computeName, properties, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ComputesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ComputesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Update a Compute -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *ComputesClient) update(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, properties Compute, options *ComputesClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "ComputesClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, computeName, 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 *ComputesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, properties Compute, _ *ComputesClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/computes/{computeName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if computeName == "" { - return nil, errors.New("parameter computeName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{computeName}", url.PathEscape(computeName)) - 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-03-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/neonpostgres/armneonpostgres/computes_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client_example_test.go index 287cccfd223b..a8adb8182fde 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/computes_client_example_test.go @@ -6,154 +6,11 @@ package armneonpostgres_test import ( "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) -// Generated from example definition: 2025-03-01/Computes_CreateOrUpdate_MaximumSet_Gen.json -func ExampleComputesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewComputesClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.Compute{ - Properties: &armneonpostgres.ComputeProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - Region: to.Ptr("mcfyojzptdliawyuxyxzqxif"), - CPUCores: to.Ptr[int32](29), - Memory: to.Ptr[int32](2), - Status: to.Ptr("upwdpznysuwt"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.ComputesClientCreateOrUpdateResponse{ - // Compute: &armneonpostgres.Compute{ - // Properties: &armneonpostgres.ComputeProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("fbxqppwovhddxpc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // Region: to.Ptr("mcfyojzptdliawyuxyxzqxif"), - // CPUCores: to.Ptr[int32](29), - // Memory: to.Ptr[int32](2), - // Status: to.Ptr("upwdpznysuwt"), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/computes/entity-name"), - // Name: to.Ptr("xwrkuiwarigqtxumarfxrnfizsir"), - // Type: to.Ptr("jijglysxkpqbduahmqtwokmefgrk"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: 2025-03-01/Computes_Delete_MaximumSet_Gen.json -func ExampleComputesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComputesClient().Delete(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.ComputesClientDeleteResponse{ - // } -} - -// Generated from example definition: 2025-03-01/Computes_Get_MaximumSet_Gen.json -func ExampleComputesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewComputesClient().Get(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.ComputesClientGetResponse{ - // Compute: &armneonpostgres.Compute{ - // Properties: &armneonpostgres.ComputeProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("fbxqppwovhddxpc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // Region: to.Ptr("mcfyojzptdliawyuxyxzqxif"), - // CPUCores: to.Ptr[int32](29), - // Memory: to.Ptr[int32](2), - // Status: to.Ptr("upwdpznysuwt"), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/computes/entity-name"), - // Name: to.Ptr("xwrkuiwarigqtxumarfxrnfizsir"), - // Type: to.Ptr("jijglysxkpqbduahmqtwokmefgrk"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - // Generated from example definition: 2025-03-01/Computes_List_MaximumSet_Gen.json func ExampleComputesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -165,7 +22,7 @@ func ExampleComputesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewComputesClient().NewListPager("rgneon", "test-org", "entity-name", "entity-name", nil) + pager := clientFactory.NewComputesClient().NewListPager("rgneon", "contoso-org", "sample-resource", "sample-resource", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -214,72 +71,3 @@ func ExampleComputesClient_NewListPager() { // } } } - -// Generated from example definition: 2025-03-01/Computes_Update_MaximumSet_Gen.json -func ExampleComputesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewComputesClient().BeginUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.Compute{ - Properties: &armneonpostgres.ComputeProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - Region: to.Ptr("mcfyojzptdliawyuxyxzqxif"), - CPUCores: to.Ptr[int32](29), - Memory: to.Ptr[int32](2), - Status: to.Ptr("upwdpznysuwt"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.ComputesClientUpdateResponse{ - // Compute: &armneonpostgres.Compute{ - // Properties: &armneonpostgres.ComputeProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("fbxqppwovhddxpc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // Region: to.Ptr("mcfyojzptdliawyuxyxzqxif"), - // CPUCores: to.Ptr[int32](29), - // Memory: to.Ptr[int32](2), - // Status: to.Ptr("upwdpznysuwt"), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/computes/entity-name"), - // Name: to.Ptr("xwrkuiwarigqtxumarfxrnfizsir"), - // Type: to.Ptr("jijglysxkpqbduahmqtwokmefgrk"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go index 971d13a2a83c..0cc2a1e6bbc4 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/constants.go @@ -6,7 +6,7 @@ package armneonpostgres const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" - moduleVersion = "v1.0.0" + moduleVersion = "v2.0.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client.go index 3aa39277f240..ee5c649c40f0 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client.go @@ -39,250 +39,6 @@ func NewEndpointsClient(subscriptionID string, credential azcore.TokenCredential return client, nil } -// BeginCreateOrUpdate - Create a Endpoint -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - endpointName - The name of the Endpoint -// - resource - Resource create parameters. -// - options - EndpointsClientBeginCreateOrUpdateOptions contains the optional parameters for the EndpointsClient.BeginCreateOrUpdate -// method. -func (client *EndpointsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, resource Endpoint, options *EndpointsClientBeginCreateOrUpdateOptions) (*runtime.Poller[EndpointsClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, organizationName, projectName, branchName, endpointName, resource, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EndpointsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EndpointsClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Create a Endpoint -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *EndpointsClient) createOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, resource Endpoint, options *EndpointsClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "EndpointsClient.BeginCreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, endpointName, 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 *EndpointsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, resource Endpoint, _ *EndpointsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/endpoints/{endpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if endpointName == "" { - return nil, errors.New("parameter endpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", url.PathEscape(endpointName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, resource); err != nil { - return nil, err - } - return req, nil -} - -// Delete - Delete a Endpoint -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - endpointName - The name of the Endpoint -// - options - EndpointsClientDeleteOptions contains the optional parameters for the EndpointsClient.Delete method. -func (client *EndpointsClient) Delete(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, options *EndpointsClientDeleteOptions) (EndpointsClientDeleteResponse, error) { - var err error - const operationName = "EndpointsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, endpointName, options) - if err != nil { - return EndpointsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientDeleteResponse{}, err - } - return EndpointsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *EndpointsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, _ *EndpointsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/endpoints/{endpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if endpointName == "" { - return nil, errors.New("parameter endpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", url.PathEscape(endpointName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get a Endpoint -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - endpointName - The name of the Endpoint -// - options - EndpointsClientGetOptions contains the optional parameters for the EndpointsClient.Get method. -func (client *EndpointsClient) Get(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, options *EndpointsClientGetOptions) (EndpointsClientGetResponse, error) { - var err error - const operationName = "EndpointsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, endpointName, options) - if err != nil { - return EndpointsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return EndpointsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return EndpointsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *EndpointsClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, _ *EndpointsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/endpoints/{endpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if endpointName == "" { - return nil, errors.New("parameter endpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", url.PathEscape(endpointName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *EndpointsClient) getHandleResponse(resp *http.Response) (EndpointsClientGetResponse, error) { - result := EndpointsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Endpoint); err != nil { - return EndpointsClientGetResponse{}, err - } - return result, nil -} - // NewListPager - List Endpoint resources by Branch // // Generated from API version 2025-03-01 @@ -356,98 +112,3 @@ func (client *EndpointsClient) listHandleResponse(resp *http.Response) (Endpoint } return result, nil } - -// BeginUpdate - Update a Endpoint -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - endpointName - The name of the Endpoint -// - properties - The resource properties to be updated. -// - options - EndpointsClientBeginUpdateOptions contains the optional parameters for the EndpointsClient.BeginUpdate method. -func (client *EndpointsClient) BeginUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, properties Endpoint, options *EndpointsClientBeginUpdateOptions) (*runtime.Poller[EndpointsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, organizationName, projectName, branchName, endpointName, properties, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[EndpointsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[EndpointsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Update a Endpoint -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *EndpointsClient) update(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, properties Endpoint, options *EndpointsClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "EndpointsClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, endpointName, 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 *EndpointsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, properties Endpoint, _ *EndpointsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/endpoints/{endpointName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if endpointName == "" { - return nil, errors.New("parameter endpointName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{endpointName}", url.PathEscape(endpointName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-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/neonpostgres/armneonpostgres/endpoints_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client_example_test.go index 25711eedf910..a40769a15f51 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/endpoints_client_example_test.go @@ -6,151 +6,11 @@ package armneonpostgres_test import ( "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) -// Generated from example definition: 2025-03-01/Endpoints_CreateOrUpdate_MaximumSet_Gen.json -func ExampleEndpointsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewEndpointsClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.Endpoint{ - Properties: &armneonpostgres.EndpointProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.EndpointsClientCreateOrUpdateResponse{ - // Endpoint: &armneonpostgres.Endpoint{ - // Properties: &armneonpostgres.EndpointProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/endpoints/entity-name"), - // Name: to.Ptr("btfgrpluxpodftoy"), - // Type: to.Ptr("ldmicxcfahaewxfelpamtgb"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: 2025-03-01/Endpoints_Delete_MaximumSet_Gen.json -func ExampleEndpointsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().Delete(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.EndpointsClientDeleteResponse{ - // } -} - -// Generated from example definition: 2025-03-01/Endpoints_Get_MaximumSet_Gen.json -func ExampleEndpointsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewEndpointsClient().Get(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.EndpointsClientGetResponse{ - // Endpoint: &armneonpostgres.Endpoint{ - // Properties: &armneonpostgres.EndpointProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/endpoints/entity-name"), - // Name: to.Ptr("btfgrpluxpodftoy"), - // Type: to.Ptr("ldmicxcfahaewxfelpamtgb"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - // Generated from example definition: 2025-03-01/Endpoints_List_MaximumSet_Gen.json func ExampleEndpointsClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -162,7 +22,7 @@ func ExampleEndpointsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewEndpointsClient().NewListPager("rgneon", "test-org", "entity-name", "entity-name", nil) + pager := clientFactory.NewEndpointsClient().NewListPager("rgneon", "contoso-org", "sample-resource", "sample-resource", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -210,70 +70,3 @@ func ExampleEndpointsClient_NewListPager() { // } } } - -// Generated from example definition: 2025-03-01/Endpoints_Update_MaximumSet_Gen.json -func ExampleEndpointsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewEndpointsClient().BeginUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.Endpoint{ - Properties: &armneonpostgres.EndpointProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.EndpointsClientUpdateResponse{ - // Endpoint: &armneonpostgres.Endpoint{ - // Properties: &armneonpostgres.EndpointProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/endpoints/entity-name"), - // Name: to.Ptr("btfgrpluxpodftoy"), - // Type: to.Ptr("ldmicxcfahaewxfelpamtgb"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/branches_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/branches_server.go index 99f8ab877d24..57440ad33ee7 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/branches_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/branches_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/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "regexp" @@ -35,10 +35,6 @@ type BranchesServer struct { // NewListPager is the fake for method BranchesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, organizationName string, projectName string, options *armneonpostgres.BranchesClientListOptions) (resp azfake.PagerResponder[armneonpostgres.BranchesClientListResponse]) - - // BeginUpdate is the fake for method BranchesClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, properties armneonpostgres.Branch, options *armneonpostgres.BranchesClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.BranchesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewBranchesServerTransport creates a new instance of BranchesServerTransport with the provided implementation. @@ -49,7 +45,6 @@ func NewBranchesServerTransport(srv *BranchesServer) *BranchesServerTransport { srv: srv, beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.BranchesClientCreateOrUpdateResponse]](), newListPager: newTracker[azfake.PagerResponder[armneonpostgres.BranchesClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.BranchesClientUpdateResponse]](), } } @@ -59,7 +54,6 @@ type BranchesServerTransport struct { srv *BranchesServer beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.BranchesClientCreateOrUpdateResponse]] newListPager *tracker[azfake.PagerResponder[armneonpostgres.BranchesClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.BranchesClientUpdateResponse]] } // Do implements the policy.Transporter interface for BranchesServerTransport. @@ -93,8 +87,6 @@ func (b *BranchesServerTransport) dispatchToMethodFake(req *http.Request, method res.resp, res.err = b.dispatchGet(req) case "BranchesClient.NewListPager": res.resp, res.err = b.dispatchNewListPager(req) - case "BranchesClient.BeginUpdate": - res.resp, res.err = b.dispatchBeginUpdate(req) default: res.err = fmt.Errorf("unhandled API %s", method) } @@ -123,7 +115,7 @@ func (b *BranchesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armneonpostgres.Branch](req) @@ -177,7 +169,7 @@ func (b *BranchesServerTransport) dispatchDelete(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -218,7 +210,7 @@ func (b *BranchesServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -261,7 +253,7 @@ func (b *BranchesServerTransport) dispatchNewListPager(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -297,62 +289,6 @@ func (b *BranchesServerTransport) dispatchNewListPager(req *http.Request) (*http return resp, nil } -func (b *BranchesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if b.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := b.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?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[armneonpostgres.Branch](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - respr, errRespr := b.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - b.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) { - b.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) { - b.beginUpdate.remove(req) - } - - return resp, nil -} - // set this to conditionally intercept incoming requests to BranchesServerTransport var branchesServerTransportInterceptor interface { // Do returns true if the server transport should use the returned response/error diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/computes_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/computes_server.go index fdfbe51b7b3f..f53742bb540a 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/computes_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/computes_server.go @@ -5,14 +5,13 @@ package fake import ( - "context" "errors" "fmt" azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "regexp" @@ -20,25 +19,9 @@ import ( // ComputesServer is a fake server for instances of the armneonpostgres.ComputesClient type. type ComputesServer struct { - // BeginCreateOrUpdate is the fake for method ComputesClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, resource armneonpostgres.Compute, options *armneonpostgres.ComputesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.ComputesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method ComputesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, options *armneonpostgres.ComputesClientDeleteOptions) (resp azfake.Responder[armneonpostgres.ComputesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method ComputesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, options *armneonpostgres.ComputesClientGetOptions) (resp azfake.Responder[armneonpostgres.ComputesClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method ComputesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, organizationName string, projectName string, branchName string, options *armneonpostgres.ComputesClientListOptions) (resp azfake.PagerResponder[armneonpostgres.ComputesClientListResponse]) - - // BeginUpdate is the fake for method ComputesClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, computeName string, properties armneonpostgres.Compute, options *armneonpostgres.ComputesClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.ComputesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewComputesServerTransport creates a new instance of ComputesServerTransport with the provided implementation. @@ -46,20 +29,16 @@ type ComputesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewComputesServerTransport(srv *ComputesServer) *ComputesServerTransport { return &ComputesServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.ComputesClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armneonpostgres.ComputesClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.ComputesClientUpdateResponse]](), + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armneonpostgres.ComputesClientListResponse]](), } } // ComputesServerTransport connects instances of armneonpostgres.ComputesClient to instances of ComputesServer. // Don't use this type directly, use NewComputesServerTransport instead. type ComputesServerTransport struct { - srv *ComputesServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.ComputesClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armneonpostgres.ComputesClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.ComputesClientUpdateResponse]] + srv *ComputesServer + newListPager *tracker[azfake.PagerResponder[armneonpostgres.ComputesClientListResponse]] } // Do implements the policy.Transporter interface for ComputesServerTransport. @@ -85,16 +64,8 @@ func (c *ComputesServerTransport) dispatchToMethodFake(req *http.Request, method } if !intercepted { switch method { - case "ComputesClient.BeginCreateOrUpdate": - res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) - case "ComputesClient.Delete": - res.resp, res.err = c.dispatchDelete(req) - case "ComputesClient.Get": - res.resp, res.err = c.dispatchGet(req) case "ComputesClient.NewListPager": res.resp, res.err = c.dispatchNewListPager(req) - case "ComputesClient.BeginUpdate": - res.resp, res.err = c.dispatchBeginUpdate(req) default: res.err = fmt.Errorf("unhandled API %s", method) } @@ -114,156 +85,6 @@ func (c *ComputesServerTransport) dispatchToMethodFake(req *http.Request, method } } -func (c *ComputesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if c.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := c.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.Compute](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, computeNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - c.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - c.beginCreateOrUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - c.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (c *ComputesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if c.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, computeNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *ComputesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if c.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, computeNameParam, 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).Compute, req) - if err != nil { - return nil, err - } - return resp, nil -} - func (c *ComputesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if c.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} @@ -273,7 +94,7 @@ func (c *ComputesServerTransport) dispatchNewListPager(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computes` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -313,66 +134,6 @@ func (c *ComputesServerTransport) dispatchNewListPager(req *http.Request) (*http return resp, nil } -func (c *ComputesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if c.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := c.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/computes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.Compute](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - computeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("computeName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, computeNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - c.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) { - c.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) { - c.beginUpdate.remove(req) - } - - return resp, nil -} - // set this to conditionally intercept incoming requests to ComputesServerTransport var computesServerTransportInterceptor interface { // Do returns true if the server transport should use the returned response/error diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/endpoints_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/endpoints_server.go index 03379f54df51..40c72cf7e457 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/endpoints_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/endpoints_server.go @@ -5,14 +5,13 @@ package fake import ( - "context" "errors" "fmt" azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "regexp" @@ -20,25 +19,9 @@ import ( // EndpointsServer is a fake server for instances of the armneonpostgres.EndpointsClient type. type EndpointsServer struct { - // BeginCreateOrUpdate is the fake for method EndpointsClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, resource armneonpostgres.Endpoint, options *armneonpostgres.EndpointsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.EndpointsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method EndpointsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, options *armneonpostgres.EndpointsClientDeleteOptions) (resp azfake.Responder[armneonpostgres.EndpointsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method EndpointsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, options *armneonpostgres.EndpointsClientGetOptions) (resp azfake.Responder[armneonpostgres.EndpointsClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method EndpointsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, organizationName string, projectName string, branchName string, options *armneonpostgres.EndpointsClientListOptions) (resp azfake.PagerResponder[armneonpostgres.EndpointsClientListResponse]) - - // BeginUpdate is the fake for method EndpointsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, endpointName string, properties armneonpostgres.Endpoint, options *armneonpostgres.EndpointsClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.EndpointsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewEndpointsServerTransport creates a new instance of EndpointsServerTransport with the provided implementation. @@ -46,20 +29,16 @@ type EndpointsServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewEndpointsServerTransport(srv *EndpointsServer) *EndpointsServerTransport { return &EndpointsServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.EndpointsClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armneonpostgres.EndpointsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.EndpointsClientUpdateResponse]](), + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armneonpostgres.EndpointsClientListResponse]](), } } // EndpointsServerTransport connects instances of armneonpostgres.EndpointsClient to instances of EndpointsServer. // Don't use this type directly, use NewEndpointsServerTransport instead. type EndpointsServerTransport struct { - srv *EndpointsServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.EndpointsClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armneonpostgres.EndpointsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.EndpointsClientUpdateResponse]] + srv *EndpointsServer + newListPager *tracker[azfake.PagerResponder[armneonpostgres.EndpointsClientListResponse]] } // Do implements the policy.Transporter interface for EndpointsServerTransport. @@ -85,16 +64,8 @@ func (e *EndpointsServerTransport) dispatchToMethodFake(req *http.Request, metho } if !intercepted { switch method { - case "EndpointsClient.BeginCreateOrUpdate": - res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) - case "EndpointsClient.Delete": - res.resp, res.err = e.dispatchDelete(req) - case "EndpointsClient.Get": - res.resp, res.err = e.dispatchGet(req) case "EndpointsClient.NewListPager": res.resp, res.err = e.dispatchNewListPager(req) - case "EndpointsClient.BeginUpdate": - res.resp, res.err = e.dispatchBeginUpdate(req) default: res.err = fmt.Errorf("unhandled API %s", method) } @@ -114,156 +85,6 @@ func (e *EndpointsServerTransport) dispatchToMethodFake(req *http.Request, metho } } -func (e *EndpointsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if e.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.Endpoint](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, endpointNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) - } - - resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { - e.beginCreateOrUpdate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} - } - if !server.PollerResponderMore(beginCreateOrUpdate) { - e.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if e.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Delete(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, endpointNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (e *EndpointsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if e.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, endpointNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Endpoint, req) - if err != nil { - return nil, err - } - return resp, nil -} - func (e *EndpointsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if e.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} @@ -273,7 +94,7 @@ func (e *EndpointsServerTransport) dispatchNewListPager(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/endpoints` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -313,66 +134,6 @@ func (e *EndpointsServerTransport) dispatchNewListPager(req *http.Request) (*htt return resp, nil } -func (e *EndpointsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if e.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := e.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/endpoints/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.Endpoint](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - endpointNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("endpointName")]) - if err != nil { - return nil, err - } - respr, errRespr := e.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, endpointNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - e.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) { - e.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) { - e.beginUpdate.remove(req) - } - - return resp, nil -} - // set this to conditionally intercept incoming requests to EndpointsServerTransport var endpointsServerTransportInterceptor interface { // Do returns true if the server transport should use the returned response/error diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neondatabases_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neondatabases_server.go index d8919dcffe8a..d2452f37ed1c 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neondatabases_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neondatabases_server.go @@ -5,14 +5,13 @@ package fake import ( - "context" "errors" "fmt" azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "regexp" @@ -20,25 +19,9 @@ import ( // NeonDatabasesServer is a fake server for instances of the armneonpostgres.NeonDatabasesClient type. type NeonDatabasesServer struct { - // BeginCreateOrUpdate is the fake for method NeonDatabasesClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, resource armneonpostgres.NeonDatabase, options *armneonpostgres.NeonDatabasesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.NeonDatabasesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method NeonDatabasesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, options *armneonpostgres.NeonDatabasesClientDeleteOptions) (resp azfake.Responder[armneonpostgres.NeonDatabasesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method NeonDatabasesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, options *armneonpostgres.NeonDatabasesClientGetOptions) (resp azfake.Responder[armneonpostgres.NeonDatabasesClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method NeonDatabasesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, organizationName string, projectName string, branchName string, options *armneonpostgres.NeonDatabasesClientListOptions) (resp azfake.PagerResponder[armneonpostgres.NeonDatabasesClientListResponse]) - - // BeginUpdate is the fake for method NeonDatabasesClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, properties armneonpostgres.NeonDatabase, options *armneonpostgres.NeonDatabasesClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.NeonDatabasesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewNeonDatabasesServerTransport creates a new instance of NeonDatabasesServerTransport with the provided implementation. @@ -46,20 +29,16 @@ type NeonDatabasesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewNeonDatabasesServerTransport(srv *NeonDatabasesServer) *NeonDatabasesServerTransport { return &NeonDatabasesServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.NeonDatabasesClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armneonpostgres.NeonDatabasesClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.NeonDatabasesClientUpdateResponse]](), + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armneonpostgres.NeonDatabasesClientListResponse]](), } } // NeonDatabasesServerTransport connects instances of armneonpostgres.NeonDatabasesClient to instances of NeonDatabasesServer. // Don't use this type directly, use NewNeonDatabasesServerTransport instead. type NeonDatabasesServerTransport struct { - srv *NeonDatabasesServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.NeonDatabasesClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armneonpostgres.NeonDatabasesClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.NeonDatabasesClientUpdateResponse]] + srv *NeonDatabasesServer + newListPager *tracker[azfake.PagerResponder[armneonpostgres.NeonDatabasesClientListResponse]] } // Do implements the policy.Transporter interface for NeonDatabasesServerTransport. @@ -85,16 +64,8 @@ func (n *NeonDatabasesServerTransport) dispatchToMethodFake(req *http.Request, m } if !intercepted { switch method { - case "NeonDatabasesClient.BeginCreateOrUpdate": - res.resp, res.err = n.dispatchBeginCreateOrUpdate(req) - case "NeonDatabasesClient.Delete": - res.resp, res.err = n.dispatchDelete(req) - case "NeonDatabasesClient.Get": - res.resp, res.err = n.dispatchGet(req) case "NeonDatabasesClient.NewListPager": res.resp, res.err = n.dispatchNewListPager(req) - case "NeonDatabasesClient.BeginUpdate": - res.resp, res.err = n.dispatchBeginUpdate(req) default: res.err = fmt.Errorf("unhandled API %s", method) } @@ -114,156 +85,6 @@ func (n *NeonDatabasesServerTransport) dispatchToMethodFake(req *http.Request, m } } -func (n *NeonDatabasesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if n.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := n.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.NeonDatabase](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonDatabaseName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonDatabaseNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - n.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) { - n.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) { - n.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (n *NeonDatabasesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if n.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/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonDatabaseName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.Delete(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonDatabaseNameParam, 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 (n *NeonDatabasesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if n.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonDatabaseName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.Get(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonDatabaseNameParam, 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).NeonDatabase, req) - if err != nil { - return nil, err - } - return resp, nil -} - func (n *NeonDatabasesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if n.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} @@ -273,7 +94,7 @@ func (n *NeonDatabasesServerTransport) dispatchNewListPager(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonDatabases` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -313,66 +134,6 @@ func (n *NeonDatabasesServerTransport) dispatchNewListPager(req *http.Request) ( return resp, nil } -func (n *NeonDatabasesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if n.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := n.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.NeonDatabase](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonDatabaseNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonDatabaseName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonDatabaseNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - n.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) { - n.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) { - n.beginUpdate.remove(req) - } - - return resp, nil -} - // set this to conditionally intercept incoming requests to NeonDatabasesServerTransport var neonDatabasesServerTransportInterceptor interface { // Do returns true if the server transport should use the returned response/error diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neonroles_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neonroles_server.go index f76f706577a4..6f003c9985f7 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neonroles_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/neonroles_server.go @@ -5,14 +5,13 @@ package fake import ( - "context" "errors" "fmt" azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "regexp" @@ -20,25 +19,9 @@ import ( // NeonRolesServer is a fake server for instances of the armneonpostgres.NeonRolesClient type. type NeonRolesServer struct { - // BeginCreateOrUpdate is the fake for method NeonRolesClient.BeginCreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, resource armneonpostgres.NeonRole, options *armneonpostgres.NeonRolesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.NeonRolesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method NeonRolesClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, options *armneonpostgres.NeonRolesClientDeleteOptions) (resp azfake.Responder[armneonpostgres.NeonRolesClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method NeonRolesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, options *armneonpostgres.NeonRolesClientGetOptions) (resp azfake.Responder[armneonpostgres.NeonRolesClientGetResponse], errResp azfake.ErrorResponder) - // NewListPager is the fake for method NeonRolesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, organizationName string, projectName string, branchName string, options *armneonpostgres.NeonRolesClientListOptions) (resp azfake.PagerResponder[armneonpostgres.NeonRolesClientListResponse]) - - // BeginUpdate is the fake for method NeonRolesClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, properties armneonpostgres.NeonRole, options *armneonpostgres.NeonRolesClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.NeonRolesClientUpdateResponse], errResp azfake.ErrorResponder) } // NewNeonRolesServerTransport creates a new instance of NeonRolesServerTransport with the provided implementation. @@ -46,20 +29,16 @@ type NeonRolesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewNeonRolesServerTransport(srv *NeonRolesServer) *NeonRolesServerTransport { return &NeonRolesServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.NeonRolesClientCreateOrUpdateResponse]](), - newListPager: newTracker[azfake.PagerResponder[armneonpostgres.NeonRolesClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.NeonRolesClientUpdateResponse]](), + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armneonpostgres.NeonRolesClientListResponse]](), } } // NeonRolesServerTransport connects instances of armneonpostgres.NeonRolesClient to instances of NeonRolesServer. // Don't use this type directly, use NewNeonRolesServerTransport instead. type NeonRolesServerTransport struct { - srv *NeonRolesServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.NeonRolesClientCreateOrUpdateResponse]] - newListPager *tracker[azfake.PagerResponder[armneonpostgres.NeonRolesClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.NeonRolesClientUpdateResponse]] + srv *NeonRolesServer + newListPager *tracker[azfake.PagerResponder[armneonpostgres.NeonRolesClientListResponse]] } // Do implements the policy.Transporter interface for NeonRolesServerTransport. @@ -85,16 +64,8 @@ func (n *NeonRolesServerTransport) dispatchToMethodFake(req *http.Request, metho } if !intercepted { switch method { - case "NeonRolesClient.BeginCreateOrUpdate": - res.resp, res.err = n.dispatchBeginCreateOrUpdate(req) - case "NeonRolesClient.Delete": - res.resp, res.err = n.dispatchDelete(req) - case "NeonRolesClient.Get": - res.resp, res.err = n.dispatchGet(req) case "NeonRolesClient.NewListPager": res.resp, res.err = n.dispatchNewListPager(req) - case "NeonRolesClient.BeginUpdate": - res.resp, res.err = n.dispatchBeginUpdate(req) default: res.err = fmt.Errorf("unhandled API %s", method) } @@ -114,156 +85,6 @@ func (n *NeonRolesServerTransport) dispatchToMethodFake(req *http.Request, metho } } -func (n *NeonRolesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { - if n.srv.BeginCreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} - } - beginCreateOrUpdate := n.beginCreateOrUpdate.get(req) - if beginCreateOrUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonRoles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.NeonRole](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonRoleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonRoleName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonRoleNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginCreateOrUpdate = &respr - n.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) { - n.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) { - n.beginCreateOrUpdate.remove(req) - } - - return resp, nil -} - -func (n *NeonRolesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if n.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/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonRoles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonRoleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonRoleName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.Delete(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonRoleNameParam, 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 (n *NeonRolesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if n.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonRoles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonRoleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonRoleName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.Get(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonRoleNameParam, 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).NeonRole, req) - if err != nil { - return nil, err - } - return resp, nil -} - func (n *NeonRolesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { if n.srv.NewListPager == nil { return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} @@ -273,7 +94,7 @@ func (n *NeonRolesServerTransport) dispatchNewListPager(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonRoles` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -313,66 +134,6 @@ func (n *NeonRolesServerTransport) dispatchNewListPager(req *http.Request) (*htt return resp, nil } -func (n *NeonRolesServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { - if n.srv.BeginUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} - } - beginUpdate := n.beginUpdate.get(req) - if beginUpdate == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/branches/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/neonRoles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armneonpostgres.NeonRole](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - branchNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("branchName")]) - if err != nil { - return nil, err - } - neonRoleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("neonRoleName")]) - if err != nil { - return nil, err - } - respr, errRespr := n.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, branchNameParam, neonRoleNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginUpdate = &respr - n.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) { - n.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) { - n.beginUpdate.remove(req) - } - - return resp, nil -} - // set this to conditionally intercept incoming requests to NeonRolesServerTransport var neonRolesServerTransportInterceptor interface { // Do returns true if the server transport should use the returned response/error diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go index c30b0623a4d2..10e64ce0133c 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/operations_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/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/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" ) diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go index ee08557db4b2..3253c730b008 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/organizations_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/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "reflect" @@ -140,7 +140,7 @@ func (o *OrganizationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armneonpostgres.OrganizationResource](req) @@ -188,7 +188,7 @@ func (o *OrganizationsServerTransport) dispatchBeginDelete(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -230,7 +230,7 @@ func (o *OrganizationsServerTransport) dispatchGet(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -263,7 +263,7 @@ func (o *OrganizationsServerTransport) dispatchGetPostgresVersions(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/getPostgresVersions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armneonpostgres.PgVersion](req) @@ -304,7 +304,7 @@ func (o *OrganizationsServerTransport) dispatchNewListByResourceGroupPager(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -341,7 +341,7 @@ func (o *OrganizationsServerTransport) dispatchNewListBySubscriptionPager(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := o.srv.NewListBySubscriptionPager(nil) @@ -374,7 +374,7 @@ func (o *OrganizationsServerTransport) dispatchBeginUpdate(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armneonpostgres.OrganizationResource](req) diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/projects_server.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/projects_server.go index 4b2096504e8b..d6a03c7d9131 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/projects_server.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/projects_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/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "net/http" "net/url" "regexp" @@ -39,10 +39,6 @@ type ProjectsServer struct { // NewListPager is the fake for method ProjectsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK NewListPager func(resourceGroupName string, organizationName string, options *armneonpostgres.ProjectsClientListOptions) (resp azfake.PagerResponder[armneonpostgres.ProjectsClientListResponse]) - - // BeginUpdate is the fake for method ProjectsClient.BeginUpdate - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, organizationName string, projectName string, properties armneonpostgres.Project, options *armneonpostgres.ProjectsClientBeginUpdateOptions) (resp azfake.PollerResponder[armneonpostgres.ProjectsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewProjectsServerTransport creates a new instance of ProjectsServerTransport with the provided implementation. @@ -53,7 +49,6 @@ func NewProjectsServerTransport(srv *ProjectsServer) *ProjectsServerTransport { srv: srv, beginCreateOrUpdate: newTracker[azfake.PollerResponder[armneonpostgres.ProjectsClientCreateOrUpdateResponse]](), newListPager: newTracker[azfake.PagerResponder[armneonpostgres.ProjectsClientListResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armneonpostgres.ProjectsClientUpdateResponse]](), } } @@ -63,7 +58,6 @@ type ProjectsServerTransport struct { srv *ProjectsServer beginCreateOrUpdate *tracker[azfake.PollerResponder[armneonpostgres.ProjectsClientCreateOrUpdateResponse]] newListPager *tracker[azfake.PagerResponder[armneonpostgres.ProjectsClientListResponse]] - beginUpdate *tracker[azfake.PollerResponder[armneonpostgres.ProjectsClientUpdateResponse]] } // Do implements the policy.Transporter interface for ProjectsServerTransport. @@ -99,8 +93,6 @@ func (p *ProjectsServerTransport) dispatchToMethodFake(req *http.Request, method res.resp, res.err = p.dispatchGetConnectionURI(req) case "ProjectsClient.NewListPager": res.resp, res.err = p.dispatchNewListPager(req) - case "ProjectsClient.BeginUpdate": - res.resp, res.err = p.dispatchBeginUpdate(req) default: res.err = fmt.Errorf("unhandled API %s", method) } @@ -129,7 +121,7 @@ func (p *ProjectsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armneonpostgres.Project](req) @@ -179,7 +171,7 @@ func (p *ProjectsServerTransport) dispatchDelete(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -216,7 +208,7 @@ func (p *ProjectsServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -253,7 +245,7 @@ func (p *ProjectsServerTransport) dispatchGetConnectionURI(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/getConnectionUri` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armneonpostgres.ConnectionURIProperties](req) @@ -296,7 +288,7 @@ func (p *ProjectsServerTransport) dispatchNewListPager(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -328,58 +320,6 @@ func (p *ProjectsServerTransport) dispatchNewListPager(req *http.Request) (*http return resp, nil } -func (p *ProjectsServerTransport) 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/Neon\.Postgres/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?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[armneonpostgres.Project](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - organizationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("organizationName")]) - if err != nil { - return nil, err - } - projectNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("projectName")]) - if err != nil { - return nil, err - } - respr, errRespr := p.srv.BeginUpdate(req.Context(), resourceGroupNameParam, organizationNameParam, projectNameParam, 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 ProjectsServerTransport var projectsServerTransportInterceptor interface { // Do returns true if the server transport should use the returned response/error diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) - -const ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - if len(data) == 0 { - return nil - } - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/go.mod b/sdk/resourcemanager/neonpostgres/armneonpostgres/go.mod index 54bd1fda7f73..0a72882497fb 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/go.mod +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2 go 1.23.0 diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go index f5d951dafd42..bcfb72ba8570 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/models.go @@ -384,7 +384,9 @@ type OfferDetails struct { TermUnit *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client.go index eb299b5af83d..a744a8ee42fb 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client.go @@ -39,250 +39,6 @@ func NewNeonDatabasesClient(subscriptionID string, credential azcore.TokenCreden return client, nil } -// BeginCreateOrUpdate - Create a NeonDatabase -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonDatabaseName - The name of the NeonDatabase -// - resource - Resource create parameters. -// - options - NeonDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the NeonDatabasesClient.BeginCreateOrUpdate -// method. -func (client *NeonDatabasesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, resource NeonDatabase, options *NeonDatabasesClientBeginCreateOrUpdateOptions) (*runtime.Poller[NeonDatabasesClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, organizationName, projectName, branchName, neonDatabaseName, resource, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NeonDatabasesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NeonDatabasesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Create a NeonDatabase -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *NeonDatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, resource NeonDatabase, options *NeonDatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "NeonDatabasesClient.BeginCreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, neonDatabaseName, 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 *NeonDatabasesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, resource NeonDatabase, _ *NeonDatabasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonDatabases/{neonDatabaseName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonDatabaseName == "" { - return nil, errors.New("parameter neonDatabaseName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonDatabaseName}", url.PathEscape(neonDatabaseName)) - 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-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, resource); err != nil { - return nil, err - } - return req, nil -} - -// Delete - Delete a NeonDatabase -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonDatabaseName - The name of the NeonDatabase -// - options - NeonDatabasesClientDeleteOptions contains the optional parameters for the NeonDatabasesClient.Delete method. -func (client *NeonDatabasesClient) Delete(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, options *NeonDatabasesClientDeleteOptions) (NeonDatabasesClientDeleteResponse, error) { - var err error - const operationName = "NeonDatabasesClient.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, organizationName, projectName, branchName, neonDatabaseName, options) - if err != nil { - return NeonDatabasesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NeonDatabasesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return NeonDatabasesClientDeleteResponse{}, err - } - return NeonDatabasesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *NeonDatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, _ *NeonDatabasesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonDatabases/{neonDatabaseName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonDatabaseName == "" { - return nil, errors.New("parameter neonDatabaseName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonDatabaseName}", url.PathEscape(neonDatabaseName)) - 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-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get a NeonDatabase -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonDatabaseName - The name of the NeonDatabase -// - options - NeonDatabasesClientGetOptions contains the optional parameters for the NeonDatabasesClient.Get method. -func (client *NeonDatabasesClient) Get(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, options *NeonDatabasesClientGetOptions) (NeonDatabasesClientGetResponse, error) { - var err error - const operationName = "NeonDatabasesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, neonDatabaseName, options) - if err != nil { - return NeonDatabasesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NeonDatabasesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return NeonDatabasesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *NeonDatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, _ *NeonDatabasesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonDatabases/{neonDatabaseName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonDatabaseName == "" { - return nil, errors.New("parameter neonDatabaseName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonDatabaseName}", url.PathEscape(neonDatabaseName)) - 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-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *NeonDatabasesClient) getHandleResponse(resp *http.Response) (NeonDatabasesClientGetResponse, error) { - result := NeonDatabasesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.NeonDatabase); err != nil { - return NeonDatabasesClientGetResponse{}, err - } - return result, nil -} - // NewListPager - List NeonDatabase resources by Branch // // Generated from API version 2025-03-01 @@ -356,99 +112,3 @@ func (client *NeonDatabasesClient) listHandleResponse(resp *http.Response) (Neon } return result, nil } - -// BeginUpdate - Update a NeonDatabase -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonDatabaseName - The name of the NeonDatabase -// - properties - The resource properties to be updated. -// - options - NeonDatabasesClientBeginUpdateOptions contains the optional parameters for the NeonDatabasesClient.BeginUpdate -// method. -func (client *NeonDatabasesClient) BeginUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, properties NeonDatabase, options *NeonDatabasesClientBeginUpdateOptions) (*runtime.Poller[NeonDatabasesClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, organizationName, projectName, branchName, neonDatabaseName, properties, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NeonDatabasesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NeonDatabasesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Update a NeonDatabase -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *NeonDatabasesClient) update(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, properties NeonDatabase, options *NeonDatabasesClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "NeonDatabasesClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, neonDatabaseName, 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 *NeonDatabasesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonDatabaseName string, properties NeonDatabase, _ *NeonDatabasesClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonDatabases/{neonDatabaseName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonDatabaseName == "" { - return nil, errors.New("parameter neonDatabaseName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonDatabaseName}", url.PathEscape(neonDatabaseName)) - 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-03-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/neonpostgres/armneonpostgres/neondatabases_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client_example_test.go index b50201a22b47..84272e6b1893 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/neondatabases_client_example_test.go @@ -6,148 +6,11 @@ package armneonpostgres_test import ( "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) -// Generated from example definition: 2025-03-01/NeonDatabases_CreateOrUpdate_MaximumSet_Gen.json -func ExampleNeonDatabasesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNeonDatabasesClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.NeonDatabase{ - Properties: &armneonpostgres.NeonDatabaseProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - OwnerName: to.Ptr("odmbeg"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonDatabasesClientCreateOrUpdateResponse{ - // NeonDatabase: &armneonpostgres.NeonDatabase{ - // Properties: &armneonpostgres.NeonDatabaseProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - // OwnerName: to.Ptr("odmbeg"), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/neonDatabases/entity-name"), - // Name: to.Ptr("awzpsbzkfarwnmi"), - // Type: to.Ptr("eltqxh"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: 2025-03-01/NeonDatabases_Delete_MaximumSet_Gen.json -func ExampleNeonDatabasesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNeonDatabasesClient().Delete(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonDatabasesClientDeleteResponse{ - // } -} - -// Generated from example definition: 2025-03-01/NeonDatabases_Get_MaximumSet_Gen.json -func ExampleNeonDatabasesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNeonDatabasesClient().Get(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonDatabasesClientGetResponse{ - // NeonDatabase: &armneonpostgres.NeonDatabase{ - // Properties: &armneonpostgres.NeonDatabaseProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - // OwnerName: to.Ptr("odmbeg"), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/neonDatabases/entity-name"), - // Name: to.Ptr("awzpsbzkfarwnmi"), - // Type: to.Ptr("eltqxh"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - // Generated from example definition: 2025-03-01/NeonDatabases_List_MaximumSet_Gen.json func ExampleNeonDatabasesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -159,7 +22,7 @@ func ExampleNeonDatabasesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewNeonDatabasesClient().NewListPager("rgneon", "test-org", "entity-name", "entity-name", nil) + pager := clientFactory.NewNeonDatabasesClient().NewListPager("rgneon", "contoso-org", "sample-resource", "sample-resource", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -206,68 +69,3 @@ func ExampleNeonDatabasesClient_NewListPager() { // } } } - -// Generated from example definition: 2025-03-01/NeonDatabases_Update_MaximumSet_Gen.json -func ExampleNeonDatabasesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNeonDatabasesClient().BeginUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.NeonDatabase{ - Properties: &armneonpostgres.NeonDatabaseProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - OwnerName: to.Ptr("odmbeg"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonDatabasesClientUpdateResponse{ - // NeonDatabase: &armneonpostgres.NeonDatabase{ - // Properties: &armneonpostgres.NeonDatabaseProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - // OwnerName: to.Ptr("odmbeg"), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/neonDatabases/entity-name"), - // Name: to.Ptr("awzpsbzkfarwnmi"), - // Type: to.Ptr("eltqxh"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/neonpostgres_live_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/neonpostgres_live_test.go index 292b645b5a96..6cf0b3db88ce 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/neonpostgres_live_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/neonpostgres_live_test.go @@ -17,7 +17,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/internal/recording" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/internal/v3/testutil" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" "github.com/stretchr/testify/suite" ) diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client.go index 9dff5352591a..75ef59a1dd9e 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client.go @@ -39,250 +39,6 @@ func NewNeonRolesClient(subscriptionID string, credential azcore.TokenCredential return client, nil } -// BeginCreateOrUpdate - Create a NeonRole -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonRoleName - The name of the NeonRole -// - resource - Resource create parameters. -// - options - NeonRolesClientBeginCreateOrUpdateOptions contains the optional parameters for the NeonRolesClient.BeginCreateOrUpdate -// method. -func (client *NeonRolesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, resource NeonRole, options *NeonRolesClientBeginCreateOrUpdateOptions) (*runtime.Poller[NeonRolesClientCreateOrUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.createOrUpdate(ctx, resourceGroupName, organizationName, projectName, branchName, neonRoleName, resource, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NeonRolesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NeonRolesClientCreateOrUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// CreateOrUpdate - Create a NeonRole -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *NeonRolesClient) createOrUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, resource NeonRole, options *NeonRolesClientBeginCreateOrUpdateOptions) (*http.Response, error) { - var err error - const operationName = "NeonRolesClient.BeginCreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, neonRoleName, 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 *NeonRolesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, resource NeonRole, _ *NeonRolesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonRoles/{neonRoleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonRoleName == "" { - return nil, errors.New("parameter neonRoleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonRoleName}", url.PathEscape(neonRoleName)) - 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-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - req.Raw().Header["Content-Type"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, resource); err != nil { - return nil, err - } - return req, nil -} - -// Delete - Delete a NeonRole -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonRoleName - The name of the NeonRole -// - options - NeonRolesClientDeleteOptions contains the optional parameters for the NeonRolesClient.Delete method. -func (client *NeonRolesClient) Delete(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, options *NeonRolesClientDeleteOptions) (NeonRolesClientDeleteResponse, error) { - var err error - const operationName = "NeonRolesClient.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, organizationName, projectName, branchName, neonRoleName, options) - if err != nil { - return NeonRolesClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NeonRolesClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return NeonRolesClientDeleteResponse{}, err - } - return NeonRolesClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *NeonRolesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, _ *NeonRolesClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonRoles/{neonRoleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonRoleName == "" { - return nil, errors.New("parameter neonRoleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonRoleName}", url.PathEscape(neonRoleName)) - 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-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Get a NeonRole -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonRoleName - The name of the NeonRole -// - options - NeonRolesClientGetOptions contains the optional parameters for the NeonRolesClient.Get method. -func (client *NeonRolesClient) Get(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, options *NeonRolesClientGetOptions) (NeonRolesClientGetResponse, error) { - var err error - const operationName = "NeonRolesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, neonRoleName, options) - if err != nil { - return NeonRolesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return NeonRolesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return NeonRolesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *NeonRolesClient) getCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, _ *NeonRolesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonRoles/{neonRoleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonRoleName == "" { - return nil, errors.New("parameter neonRoleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonRoleName}", url.PathEscape(neonRoleName)) - 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-03-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *NeonRolesClient) getHandleResponse(resp *http.Response) (NeonRolesClientGetResponse, error) { - result := NeonRolesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.NeonRole); err != nil { - return NeonRolesClientGetResponse{}, err - } - return result, nil -} - // NewListPager - List NeonRole resources by Branch // // Generated from API version 2025-03-01 @@ -356,98 +112,3 @@ func (client *NeonRolesClient) listHandleResponse(resp *http.Response) (NeonRole } return result, nil } - -// BeginUpdate - Update a NeonRole -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - branchName - The name of the Branch -// - neonRoleName - The name of the NeonRole -// - properties - The resource properties to be updated. -// - options - NeonRolesClientBeginUpdateOptions contains the optional parameters for the NeonRolesClient.BeginUpdate method. -func (client *NeonRolesClient) BeginUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, properties NeonRole, options *NeonRolesClientBeginUpdateOptions) (*runtime.Poller[NeonRolesClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, organizationName, projectName, branchName, neonRoleName, properties, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[NeonRolesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[NeonRolesClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Update a NeonRole -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *NeonRolesClient) update(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, properties NeonRole, options *NeonRolesClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "NeonRolesClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, organizationName, projectName, branchName, neonRoleName, 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 *NeonRolesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, branchName string, neonRoleName string, properties NeonRole, _ *NeonRolesClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}/branches/{branchName}/neonRoles/{neonRoleName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - if branchName == "" { - return nil, errors.New("parameter branchName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{branchName}", url.PathEscape(branchName)) - if neonRoleName == "" { - return nil, errors.New("parameter neonRoleName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{neonRoleName}", url.PathEscape(neonRoleName)) - 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-03-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/neonpostgres/armneonpostgres/neonroles_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client_example_test.go index 1fe5f120fee2..8a5f299c490e 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/neonroles_client_example_test.go @@ -6,157 +6,11 @@ package armneonpostgres_test import ( "context" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) -// Generated from example definition: 2025-03-01/NeonRoles_CreateOrUpdate_MaximumSet_Gen.json -func ExampleNeonRolesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNeonRolesClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.NeonRole{ - Properties: &armneonpostgres.NeonRoleProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - Permissions: []*string{ - to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - }, - IsSuperUser: 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 = armneonpostgres.NeonRolesClientCreateOrUpdateResponse{ - // NeonRole: &armneonpostgres.NeonRole{ - // Properties: &armneonpostgres.NeonRoleProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - // Permissions: []*string{ - // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - // }, - // IsSuperUser: to.Ptr(true), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/neonRoles/entity-name"), - // Name: to.Ptr("tpbnco"), - // Type: to.Ptr("vqfmoiwt"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: 2025-03-01/NeonRoles_Delete_MaximumSet_Gen.json -func ExampleNeonRolesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNeonRolesClient().Delete(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonRolesClientDeleteResponse{ - // } -} - -// Generated from example definition: 2025-03-01/NeonRoles_Get_MaximumSet_Gen.json -func ExampleNeonRolesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewNeonRolesClient().Get(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.NeonRolesClientGetResponse{ - // NeonRole: &armneonpostgres.NeonRole{ - // Properties: &armneonpostgres.NeonRoleProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - // Permissions: []*string{ - // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - // }, - // IsSuperUser: to.Ptr(true), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/neonRoles/entity-name"), - // Name: to.Ptr("tpbnco"), - // Type: to.Ptr("vqfmoiwt"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} - // Generated from example definition: 2025-03-01/NeonRoles_List_MaximumSet_Gen.json func ExampleNeonRolesClient_NewListPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -168,7 +22,7 @@ func ExampleNeonRolesClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewNeonRolesClient().NewListPager("rgneon", "test-org", "entity-name", "entity-name", nil) + pager := clientFactory.NewNeonRolesClient().NewListPager("rgneon", "contoso-org", "sample-resource", "sample-resource", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -218,74 +72,3 @@ func ExampleNeonRolesClient_NewListPager() { // } } } - -// Generated from example definition: 2025-03-01/NeonRoles_Update_MaximumSet_Gen.json -func ExampleNeonRolesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewNeonRolesClient().BeginUpdate(ctx, "rgneon", "test-org", "entity-name", "entity-name", "entity-name", armneonpostgres.NeonRole{ - Properties: &armneonpostgres.NeonRoleProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - Permissions: []*string{ - to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - }, - IsSuperUser: 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 = armneonpostgres.NeonRolesClientUpdateResponse{ - // NeonRole: &armneonpostgres.NeonRole{ - // Properties: &armneonpostgres.NeonRoleProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - // Permissions: []*string{ - // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - // }, - // IsSuperUser: to.Ptr(true), - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name/branches/entity-name/neonRoles/entity-name"), - // Name: to.Ptr("tpbnco"), - // Type: to.Ptr("vqfmoiwt"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go index c4e36be86624..bf1ee864237d 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/operations_client_example_test.go @@ -7,12 +7,12 @@ package armneonpostgres_test import ( "context" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) // Generated from example definition: 2025-03-01/Operations_List_MaximumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMaximumSet() { +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -43,7 +43,7 @@ func ExampleOperationsClient_NewListPager_operationsListMaximumSet() { // Provider: to.Ptr("lottcde"), // Resource: to.Ptr("lchjffakidtthnuaa"), // Operation: to.Ptr("ipqvheuesyujwjqhnmg"), - // Description: to.Ptr("gicugbypsgqayjlfyrxvnietwzx"), + // Description: to.Ptr("xjijlfawuqufbocpw"), // }, // Origin: to.Ptr(armneonpostgres.OriginUser), // ActionType: to.Ptr(armneonpostgres.ActionTypeInternal), @@ -56,7 +56,7 @@ func ExampleOperationsClient_NewListPager_operationsListMaximumSet() { } // Generated from example definition: 2025-03-01/Operations_List_MinimumSet_Gen.json -func ExampleOperationsClient_NewListPager_operationsListMinimumSet() { +func ExampleOperationsClient_NewListPager_operationsListMaximumSetGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go index c912af7e4d4b..02071058a7ab 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/options.go @@ -10,12 +10,6 @@ type BranchesClientBeginCreateOrUpdateOptions struct { ResumeToken string } -// BranchesClientBeginUpdateOptions contains the optional parameters for the BranchesClient.BeginUpdate method. -type BranchesClientBeginUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - // BranchesClientDeleteOptions contains the optional parameters for the BranchesClient.Delete method. type BranchesClientDeleteOptions struct { // placeholder for future optional parameters @@ -31,112 +25,21 @@ type BranchesClientListOptions struct { // placeholder for future optional parameters } -// ComputesClientBeginCreateOrUpdateOptions contains the optional parameters for the ComputesClient.BeginCreateOrUpdate method. -type ComputesClientBeginCreateOrUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// ComputesClientBeginUpdateOptions contains the optional parameters for the ComputesClient.BeginUpdate method. -type ComputesClientBeginUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// ComputesClientDeleteOptions contains the optional parameters for the ComputesClient.Delete method. -type ComputesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// ComputesClientGetOptions contains the optional parameters for the ComputesClient.Get method. -type ComputesClientGetOptions struct { - // placeholder for future optional parameters -} - // ComputesClientListOptions contains the optional parameters for the ComputesClient.NewListPager method. type ComputesClientListOptions struct { // placeholder for future optional parameters } -// EndpointsClientBeginCreateOrUpdateOptions contains the optional parameters for the EndpointsClient.BeginCreateOrUpdate -// method. -type EndpointsClientBeginCreateOrUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// EndpointsClientBeginUpdateOptions contains the optional parameters for the EndpointsClient.BeginUpdate method. -type EndpointsClientBeginUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// EndpointsClientDeleteOptions contains the optional parameters for the EndpointsClient.Delete method. -type EndpointsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// EndpointsClientGetOptions contains the optional parameters for the EndpointsClient.Get method. -type EndpointsClientGetOptions struct { - // placeholder for future optional parameters -} - // EndpointsClientListOptions contains the optional parameters for the EndpointsClient.NewListPager method. type EndpointsClientListOptions struct { // placeholder for future optional parameters } -// NeonDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the NeonDatabasesClient.BeginCreateOrUpdate -// method. -type NeonDatabasesClientBeginCreateOrUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// NeonDatabasesClientBeginUpdateOptions contains the optional parameters for the NeonDatabasesClient.BeginUpdate method. -type NeonDatabasesClientBeginUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// NeonDatabasesClientDeleteOptions contains the optional parameters for the NeonDatabasesClient.Delete method. -type NeonDatabasesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// NeonDatabasesClientGetOptions contains the optional parameters for the NeonDatabasesClient.Get method. -type NeonDatabasesClientGetOptions struct { - // placeholder for future optional parameters -} - // NeonDatabasesClientListOptions contains the optional parameters for the NeonDatabasesClient.NewListPager method. type NeonDatabasesClientListOptions struct { // placeholder for future optional parameters } -// NeonRolesClientBeginCreateOrUpdateOptions contains the optional parameters for the NeonRolesClient.BeginCreateOrUpdate -// method. -type NeonRolesClientBeginCreateOrUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// NeonRolesClientBeginUpdateOptions contains the optional parameters for the NeonRolesClient.BeginUpdate method. -type NeonRolesClientBeginUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - -// NeonRolesClientDeleteOptions contains the optional parameters for the NeonRolesClient.Delete method. -type NeonRolesClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// NeonRolesClientGetOptions contains the optional parameters for the NeonRolesClient.Get method. -type NeonRolesClientGetOptions struct { - // placeholder for future optional parameters -} - // NeonRolesClientListOptions contains the optional parameters for the NeonRolesClient.NewListPager method. type NeonRolesClientListOptions struct { // placeholder for future optional parameters @@ -196,12 +99,6 @@ type ProjectsClientBeginCreateOrUpdateOptions struct { ResumeToken string } -// ProjectsClientBeginUpdateOptions contains the optional parameters for the ProjectsClient.BeginUpdate method. -type ProjectsClientBeginUpdateOptions struct { - // Resumes the long-running operation from the provided token. - ResumeToken string -} - // ProjectsClientDeleteOptions contains the optional parameters for the ProjectsClient.Delete method. type ProjectsClientDeleteOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go index ddafbffd5bf3..b1bc36fc185a 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/organizations_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/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) @@ -23,7 +23,7 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewOrganizationsClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", armneonpostgres.OrganizationResource{ + poller, err := clientFactory.NewOrganizationsClient().BeginCreateOrUpdate(ctx, "rgneon", "contoso-org", armneonpostgres.OrganizationResource{ Properties: &armneonpostgres.OrganizationProperties{ MarketplaceDetails: &armneonpostgres.MarketplaceDetails{ SubscriptionID: to.Ptr("xfahbbbzwlcwhhjbxarnwfcy"), @@ -181,9 +181,7 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { }, }, }, - Tags: map[string]*string{ - "key8832": to.Ptr("rvukepuxkykdtqjtwk"), - }, + Tags: map[string]*string{}, Location: to.Ptr("kcdph"), }, nil) if err != nil { @@ -226,7 +224,6 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // Domain: to.Ptr("snoshqumfsthyofpnrsgyjhszvgtj"), // NumberOfEmployees: to.Ptr[int64](12), // }, - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ // OrganizationID: to.Ptr("hzejhmftwsruhwspvtwoy"), // OrganizationName: to.Ptr("entity-name"), @@ -240,10 +237,7 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // }, // }, // ProjectProperties: &armneonpostgres.ProjectProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -259,10 +253,7 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // AutoscalingLimitMaxCu: to.Ptr[float32](20), // }, // Branch: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -275,10 +266,7 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -290,14 +278,14 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -306,14 +294,14 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -323,15 +311,18 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -343,14 +334,14 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -359,14 +350,14 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -376,15 +367,21 @@ func ExampleOrganizationsClient_BeginCreateOrUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Tags: map[string]*string{ - // "key8832": to.Ptr("rvukepuxkykdtqjtwk"), // }, // Location: to.Ptr("kcdph"), - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org"), + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rg/providers/Microsoft.Neon/organizations/organizationId"), // Name: to.Ptr("aocvhndykwhgolfixbqhwtmhiriu"), // Type: to.Ptr("bvtwhithilvtizpde"), // SystemData: &armneonpostgres.SystemData{ @@ -410,7 +407,7 @@ func ExampleOrganizationsClient_BeginDelete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewOrganizationsClient().BeginDelete(ctx, "rgneon", "test-org", nil) + poller, err := clientFactory.NewOrganizationsClient().BeginDelete(ctx, "rgneon", "contoso-org", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -431,7 +428,7 @@ func ExampleOrganizationsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewOrganizationsClient().Get(ctx, "rgneon", "test-org", nil) + res, err := clientFactory.NewOrganizationsClient().Get(ctx, "rgneon", "contoso-org", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -468,7 +465,6 @@ func ExampleOrganizationsClient_Get() { // Domain: to.Ptr("snoshqumfsthyofpnrsgyjhszvgtj"), // NumberOfEmployees: to.Ptr[int64](12), // }, - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ // OrganizationID: to.Ptr("hzejhmftwsruhwspvtwoy"), // OrganizationName: to.Ptr("entity-name"), @@ -482,10 +478,7 @@ func ExampleOrganizationsClient_Get() { // }, // }, // ProjectProperties: &armneonpostgres.ProjectProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -501,10 +494,7 @@ func ExampleOrganizationsClient_Get() { // AutoscalingLimitMaxCu: to.Ptr[float32](20), // }, // Branch: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -517,10 +507,7 @@ func ExampleOrganizationsClient_Get() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -532,14 +519,14 @@ func ExampleOrganizationsClient_Get() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -548,14 +535,14 @@ func ExampleOrganizationsClient_Get() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -565,15 +552,18 @@ func ExampleOrganizationsClient_Get() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -585,14 +575,14 @@ func ExampleOrganizationsClient_Get() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -601,14 +591,14 @@ func ExampleOrganizationsClient_Get() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -618,15 +608,21 @@ func ExampleOrganizationsClient_Get() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Tags: map[string]*string{ - // "key8832": to.Ptr("rvukepuxkykdtqjtwk"), // }, // Location: to.Ptr("kcdph"), - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org"), + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rg/providers/Microsoft.Neon/organizations/organizationId"), // Name: to.Ptr("aocvhndykwhgolfixbqhwtmhiriu"), // Type: to.Ptr("bvtwhithilvtizpde"), // SystemData: &armneonpostgres.SystemData{ @@ -642,7 +638,7 @@ func ExampleOrganizationsClient_Get() { } // Generated from example definition: 2025-03-01/Organizations_GetPostgresVersions_MaximumSet_Gen.json -func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVersionsMaximumSet() { +func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVersionsMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -652,8 +648,8 @@ func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVers if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewOrganizationsClient().GetPostgresVersions(ctx, "rgneon", &armneonpostgres.OrganizationsClientGetPostgresVersionsOptions{ - Parameters: &armneonpostgres.PgVersion{ + res, err := clientFactory.NewOrganizationsClient().GetPostgresVersions(ctx, "rgneon", &OrganizationsClientGetPostgresVersionsOptions{ + parameters: &armneonpostgres.PgVersion{ Version: to.Ptr[int32](7), }}) if err != nil { @@ -674,7 +670,7 @@ func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVers } // Generated from example definition: 2025-03-01/Organizations_GetPostgresVersions_MinimumSet_Gen.json -func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVersionsMinimumSet() { +func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVersionsMaximumSetGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -702,7 +698,7 @@ func ExampleOrganizationsClient_GetPostgresVersions_organizationsGetPostgresVers } // Generated from example definition: 2025-03-01/Organizations_ListByResourceGroup_MaximumSet_Gen.json -func ExampleOrganizationsClient_NewListByResourceGroupPager() { +func ExampleOrganizationsClient_NewListByResourceGroupPager_organizationsListByResourceGroupMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -910,10 +906,9 @@ func ExampleOrganizationsClient_NewListByResourceGroupPager() { // }, // }, // Tags: map[string]*string{ - // "key8832": to.Ptr("rvukepuxkykdtqjtwk"), // }, // Location: to.Ptr("kcdph"), - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/organization-name"), + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rg/providers/Microsoft.Neon/organizations/organizationId"), // Name: to.Ptr("aocvhndykwhgolfixbqhwtmhiriu"), // Type: to.Ptr("bvtwhithilvtizpde"), // SystemData: &armneonpostgres.SystemData{ @@ -932,8 +927,43 @@ func ExampleOrganizationsClient_NewListByResourceGroupPager() { } } +// Generated from example definition: 2025-03-01/Organizations_ListByResourceGroup_MinimumSet_Gen.json +func ExampleOrganizationsClient_NewListByResourceGroupPager_organizationsListByResourceGroupMaximumSetGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOrganizationsClient().NewListByResourceGroupPager("rgneon", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armneonpostgres.OrganizationsClientListByResourceGroupResponse{ + // OrganizationResourceListResult: armneonpostgres.OrganizationResourceListResult{ + // Value: []*armneonpostgres.OrganizationResource{ + // { + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/contoso-org"), + // Location: to.Ptr("kcdph"), + // }, + // }, + // }, + // } + } +} + // Generated from example definition: 2025-03-01/Organizations_ListBySubscription_MaximumSet_Gen.json -func ExampleOrganizationsClient_NewListBySubscriptionPager() { +func ExampleOrganizationsClient_NewListBySubscriptionPager_organizationsListBySubscriptionMaximumSetGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) @@ -1141,7 +1171,6 @@ func ExampleOrganizationsClient_NewListBySubscriptionPager() { // }, // }, // Tags: map[string]*string{ - // "key8832": to.Ptr("rvukepuxkykdtqjtwk"), // }, // Location: to.Ptr("kcdph"), // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rg/providers/Microsoft.Neon/organizations/organizationId"), @@ -1163,6 +1192,41 @@ func ExampleOrganizationsClient_NewListBySubscriptionPager() { } } +// Generated from example definition: 2025-03-01/Organizations_ListBySubscription_MinimumSet_Gen.json +func ExampleOrganizationsClient_NewListBySubscriptionPager_organizationsListBySubscriptionMaximumSetGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewOrganizationsClient().NewListBySubscriptionPager(nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armneonpostgres.OrganizationsClientListBySubscriptionResponse{ + // OrganizationResourceListResult: armneonpostgres.OrganizationResourceListResult{ + // Value: []*armneonpostgres.OrganizationResource{ + // { + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/contoso-org"), + // Location: to.Ptr("kcdph"), + // }, + // }, + // }, + // } + } +} + // Generated from example definition: 2025-03-01/Organizations_Update_MaximumSet_Gen.json func ExampleOrganizationsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) @@ -1174,8 +1238,20 @@ func ExampleOrganizationsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewOrganizationsClient().BeginUpdate(ctx, "rgneon", "test-org", armneonpostgres.OrganizationResource{ + poller, err := clientFactory.NewOrganizationsClient().BeginUpdate(ctx, "rgneon", "contoso-org", armneonpostgres.OrganizationResource{ Properties: &armneonpostgres.OrganizationProperties{ + MarketplaceDetails: &armneonpostgres.MarketplaceDetails{ + SubscriptionID: to.Ptr("yxmkfivp"), + SubscriptionStatus: to.Ptr(armneonpostgres.MarketplaceSubscriptionStatusPendingFulfillmentStart), + OfferDetails: &armneonpostgres.OfferDetails{ + PublisherID: to.Ptr("hporaxnopmolttlnkbarw"), + OfferID: to.Ptr("bunyeeupoedueofwrzej"), + PlanID: to.Ptr("nlbfiwtslenfwek"), + PlanName: to.Ptr("ljbmgpkfqklaufacbpml"), + TermUnit: to.Ptr("qbcq"), + TermID: to.Ptr("aedlchikwqckuploswthvshe"), + }, + }, UserDetails: &armneonpostgres.UserDetails{ FirstName: to.Ptr("zhelh"), LastName: to.Ptr("zbdhouyeozylnerrc"), @@ -1320,9 +1396,7 @@ func ExampleOrganizationsClient_BeginUpdate() { }, }, }, - Tags: map[string]*string{ - "key609": to.Ptr("qyosjypklxtiamqebd"), - }, + Tags: map[string]*string{}, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -1338,15 +1412,15 @@ func ExampleOrganizationsClient_BeginUpdate() { // OrganizationResource: &armneonpostgres.OrganizationResource{ // Properties: &armneonpostgres.OrganizationProperties{ // MarketplaceDetails: &armneonpostgres.MarketplaceDetails{ - // SubscriptionID: to.Ptr("xfahbbbzwlcwhhjbxarnwfcy"), + // SubscriptionID: to.Ptr("yxmkfivp"), // SubscriptionStatus: to.Ptr(armneonpostgres.MarketplaceSubscriptionStatusPendingFulfillmentStart), // OfferDetails: &armneonpostgres.OfferDetails{ - // PublisherID: to.Ptr("eibghzuyqsksouwlgqphhmuxeqeigf"), - // OfferID: to.Ptr("qscggwfdnippiwrrnmuscg"), - // PlanID: to.Ptr("sveqoxtdwxutxmtniuufyrdu"), - // PlanName: to.Ptr("t"), - // TermUnit: to.Ptr("jnxhyql"), - // TermID: to.Ptr("uptombvymytfonj"), + // PublisherID: to.Ptr("hporaxnopmolttlnkbarw"), + // OfferID: to.Ptr("bunyeeupoedueofwrzej"), + // PlanID: to.Ptr("nlbfiwtslenfwek"), + // PlanName: to.Ptr("ljbmgpkfqklaufacbpml"), + // TermUnit: to.Ptr("qbcq"), + // TermID: to.Ptr("aedlchikwqckuploswthvshe"), // }, // }, // UserDetails: &armneonpostgres.UserDetails{ @@ -1364,7 +1438,6 @@ func ExampleOrganizationsClient_BeginUpdate() { // Domain: to.Ptr("snoshqumfsthyofpnrsgyjhszvgtj"), // NumberOfEmployees: to.Ptr[int64](12), // }, - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // PartnerOrganizationProperties: &armneonpostgres.PartnerOrganizationProperties{ // OrganizationID: to.Ptr("fynmpcbivqkwqdfhrmsyusjd"), // OrganizationName: to.Ptr("entity-name"), @@ -1378,10 +1451,7 @@ func ExampleOrganizationsClient_BeginUpdate() { // }, // }, // ProjectProperties: &armneonpostgres.ProjectProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1397,10 +1467,7 @@ func ExampleOrganizationsClient_BeginUpdate() { // AutoscalingLimitMaxCu: to.Ptr[float32](4), // }, // Branch: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1413,10 +1480,7 @@ func ExampleOrganizationsClient_BeginUpdate() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1428,14 +1492,14 @@ func ExampleOrganizationsClient_BeginUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1444,14 +1508,14 @@ func ExampleOrganizationsClient_BeginUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1461,15 +1525,18 @@ func ExampleOrganizationsClient_BeginUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1481,14 +1548,14 @@ func ExampleOrganizationsClient_BeginUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1497,14 +1564,14 @@ func ExampleOrganizationsClient_BeginUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -1514,15 +1581,21 @@ func ExampleOrganizationsClient_BeginUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Tags: map[string]*string{ - // "key8832": to.Ptr("rvukepuxkykdtqjtwk"), // }, // Location: to.Ptr("kcdph"), - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org"), + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rg/providers/Microsoft.Neon/organizations/organizationId"), // Name: to.Ptr("aocvhndykwhgolfixbqhwtmhiriu"), // Type: to.Ptr("bvtwhithilvtizpde"), // SystemData: &armneonpostgres.SystemData{ diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client.go index 6a5e5e0cd8df..b2113f2fefea 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client.go @@ -391,88 +391,3 @@ func (client *ProjectsClient) listHandleResponse(resp *http.Response) (ProjectsC } return result, nil } - -// BeginUpdate - Update a Project -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -// - resourceGroupName - The name of the resource group. The name is case insensitive. -// - organizationName - Name of the Neon Organizations resource -// - projectName - The name of the Project -// - properties - The resource properties to be updated. -// - options - ProjectsClientBeginUpdateOptions contains the optional parameters for the ProjectsClient.BeginUpdate method. -func (client *ProjectsClient) BeginUpdate(ctx context.Context, resourceGroupName string, organizationName string, projectName string, properties Project, options *ProjectsClientBeginUpdateOptions) (*runtime.Poller[ProjectsClientUpdateResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.update(ctx, resourceGroupName, organizationName, projectName, properties, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ProjectsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ProjectsClientUpdateResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Update - Update a Project -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2025-03-01 -func (client *ProjectsClient) update(ctx context.Context, resourceGroupName string, organizationName string, projectName string, properties Project, options *ProjectsClientBeginUpdateOptions) (*http.Response, error) { - var err error - const operationName = "ProjectsClient.BeginUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.updateCreateRequest(ctx, resourceGroupName, organizationName, projectName, 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 *ProjectsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, organizationName string, projectName string, properties Project, _ *ProjectsClientBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Neon.Postgres/organizations/{organizationName}/projects/{projectName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if organizationName == "" { - return nil, errors.New("parameter organizationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{organizationName}", url.PathEscape(organizationName)) - if projectName == "" { - return nil, errors.New("parameter projectName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{projectName}", url.PathEscape(projectName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2025-03-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/neonpostgres/armneonpostgres/projects_client_example_test.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client_example_test.go index 7ce43b7d046c..08190f3cdd98 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_client_example_test.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/projects_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/neonpostgres/armneonpostgres" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/neonpostgres/armneonpostgres/v2" "log" ) @@ -23,7 +23,7 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewProjectsClient().BeginCreateOrUpdate(ctx, "rgneon", "test-org", "entity-name", armneonpostgres.Project{ + poller, err := clientFactory.NewProjectsClient().BeginCreateOrUpdate(ctx, "rgneon", "contoso-org", "sample-resource", armneonpostgres.Project{ Properties: &armneonpostgres.ProjectProperties{ EntityName: to.Ptr("entity-name"), Attributes: []*armneonpostgres.Attributes{ @@ -154,10 +154,7 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // res = armneonpostgres.ProjectsClientCreateOrUpdateResponse{ // Project: &armneonpostgres.Project{ // Properties: &armneonpostgres.ProjectProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -173,10 +170,7 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // AutoscalingLimitMaxCu: to.Ptr[float32](20), // }, // Branch: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -189,10 +183,7 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -204,14 +195,14 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -220,14 +211,14 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -237,15 +228,18 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -257,14 +251,14 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -273,14 +267,14 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -290,10 +284,16 @@ func ExampleProjectsClient_BeginCreateOrUpdate() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name"), + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/cajluydhtylhjatsexnmxmxhwfs"), // Name: to.Ptr("cajluydhtylhjatsexnmxmxhwfs"), // Type: to.Ptr("voaddrcrqtyqae"), // SystemData: &armneonpostgres.SystemData{ @@ -319,7 +319,7 @@ func ExampleProjectsClient_Delete() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewProjectsClient().Delete(ctx, "rgneon", "test-org", "entity-name", nil) + res, err := clientFactory.NewProjectsClient().Delete(ctx, "rgneon", "contoso-org", "sample-resource", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -341,7 +341,7 @@ func ExampleProjectsClient_Get() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewProjectsClient().Get(ctx, "rgneon", "test-org", "entity-name", nil) + res, err := clientFactory.NewProjectsClient().Get(ctx, "rgneon", "contoso-org", "sample-resource", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -351,10 +351,7 @@ func ExampleProjectsClient_Get() { // res = armneonpostgres.ProjectsClientGetResponse{ // Project: &armneonpostgres.Project{ // Properties: &armneonpostgres.ProjectProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -370,10 +367,7 @@ func ExampleProjectsClient_Get() { // AutoscalingLimitMaxCu: to.Ptr[float32](20), // }, // Branch: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -386,10 +380,7 @@ func ExampleProjectsClient_Get() { // DatabaseName: to.Ptr("duhxebzhd"), // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -401,14 +392,14 @@ func ExampleProjectsClient_Get() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -417,14 +408,14 @@ func ExampleProjectsClient_Get() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -434,15 +425,18 @@ func ExampleProjectsClient_Get() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("dzbqaiixq"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // Roles: []*armneonpostgres.NeonRoleProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -454,14 +448,14 @@ func ExampleProjectsClient_Get() { // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), // }, // IsSuperUser: to.Ptr(true), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Databases: []*armneonpostgres.NeonDatabaseProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -470,14 +464,14 @@ func ExampleProjectsClient_Get() { // }, // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), // OwnerName: to.Ptr("odmbeg"), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("wgdmylla"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, // Endpoints: []*armneonpostgres.EndpointProperties{ // { - // EntityID: to.Ptr("entity-id"), // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // Attributes: []*armneonpostgres.Attributes{ // { // Name: to.Ptr("trhvzyvaqy"), @@ -487,10 +481,16 @@ func ExampleProjectsClient_Get() { // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("vhcilurdd"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, // }, + // EntityID: to.Ptr("entity-id"), + // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), + // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/entity-name"), + // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/cajluydhtylhjatsexnmxmxhwfs"), // Name: to.Ptr("cajluydhtylhjatsexnmxmxhwfs"), // Type: to.Ptr("voaddrcrqtyqae"), // SystemData: &armneonpostgres.SystemData{ @@ -516,7 +516,7 @@ func ExampleProjectsClient_GetConnectionURI() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewProjectsClient().GetConnectionURI(ctx, "rgneon", "test-org", "entity-name", armneonpostgres.ConnectionURIProperties{ + res, err := clientFactory.NewProjectsClient().GetConnectionURI(ctx, "rgneon", "contoso-org", "sample-resource", armneonpostgres.ConnectionURIProperties{ ProjectID: to.Ptr("riuifmoqtorrcffgksvfcobia"), BranchID: to.Ptr("iimmlbqv"), DatabaseName: to.Ptr("xc"), @@ -553,7 +553,7 @@ func ExampleProjectsClient_NewListPager() { if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewProjectsClient().NewListPager("rgneon", "test-org", nil) + pager := clientFactory.NewProjectsClient().NewListPager("rgneon", "contoso-org", nil) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -726,299 +726,3 @@ func ExampleProjectsClient_NewListPager() { // } } } - -// Generated from example definition: 2025-03-01/Projects_Update_MaximumSet_Gen.json -func ExampleProjectsClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armneonpostgres.NewClientFactory("9B8E3300-C5FA-442B-A259-3F6F614D5BD4", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewProjectsClient().BeginUpdate(ctx, "rgneon", "test-org", "test-project", armneonpostgres.Project{ - Properties: &armneonpostgres.ProjectProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - RegionID: to.Ptr("vxvmjwuttpiakirzdf"), - Storage: to.Ptr[int64](23), - PgVersion: to.Ptr[int32](16), - HistoryRetention: to.Ptr[int32](16), - DefaultEndpointSettings: &armneonpostgres.DefaultEndpointSettings{ - AutoscalingLimitMinCu: to.Ptr[float32](8), - AutoscalingLimitMaxCu: to.Ptr[float32](4), - }, - Branch: &armneonpostgres.BranchProperties{ - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("oik"), - ParentID: to.Ptr("entity-id"), - RoleName: to.Ptr("qrrairsupyosxnqotdwhbpc"), - DatabaseName: to.Ptr("duhxebzhd"), - Roles: []*armneonpostgres.NeonRoleProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - Permissions: []*string{ - to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - }, - IsSuperUser: to.Ptr(true), - }, - }, - Databases: []*armneonpostgres.NeonDatabaseProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - OwnerName: to.Ptr("odmbeg"), - }, - }, - Endpoints: []*armneonpostgres.EndpointProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - }, - }, - }, - Roles: []*armneonpostgres.NeonRoleProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - Permissions: []*string{ - to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - }, - IsSuperUser: to.Ptr(true), - }, - }, - Databases: []*armneonpostgres.NeonDatabaseProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - OwnerName: to.Ptr("odmbeg"), - }, - }, - Endpoints: []*armneonpostgres.EndpointProperties{ - { - EntityName: to.Ptr("entity-name"), - Attributes: []*armneonpostgres.Attributes{ - { - Name: to.Ptr("trhvzyvaqy"), - Value: to.Ptr("evpkgsskyavybxwwssm"), - }, - }, - ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - }, - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - res, err := poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armneonpostgres.ProjectsClientUpdateResponse{ - // Project: &armneonpostgres.Project{ - // Properties: &armneonpostgres.ProjectProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("eazudrgcnzbydedhwcmgwoauc"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // RegionID: to.Ptr("tlcltldfrnxh"), - // Storage: to.Ptr[int64](7), - // PgVersion: to.Ptr[int32](10), - // HistoryRetention: to.Ptr[int32](7), - // DefaultEndpointSettings: &armneonpostgres.DefaultEndpointSettings{ - // AutoscalingLimitMinCu: to.Ptr[float32](8), - // AutoscalingLimitMaxCu: to.Ptr[float32](4), - // }, - // Branch: &armneonpostgres.BranchProperties{ - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("dzbqaiixq"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("oik"), - // ParentID: to.Ptr("entity-id"), - // RoleName: to.Ptr("qrrairsupyosxnqotdwhbpc"), - // DatabaseName: to.Ptr("duhxebzhd"), - // Roles: []*armneonpostgres.NeonRoleProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - // Permissions: []*string{ - // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - // }, - // IsSuperUser: to.Ptr(true), - // }, - // }, - // Databases: []*armneonpostgres.NeonDatabaseProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - // OwnerName: to.Ptr("odmbeg"), - // }, - // }, - // Endpoints: []*armneonpostgres.EndpointProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - // }, - // }, - // }, - // Roles: []*armneonpostgres.NeonRoleProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("sqpvswctybrhimiwidhnnlxclfry"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("wxbojkmdgaggkfiwqfakdkbyztm"), - // Permissions: []*string{ - // to.Ptr("myucqecpjriewzohxvadgkhiudnyx"), - // }, - // IsSuperUser: to.Ptr(true), - // }, - // }, - // Databases: []*armneonpostgres.NeonDatabaseProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("wgdmylla"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // BranchID: to.Ptr("orfdwdmzvfvlnrgussvcvoek"), - // OwnerName: to.Ptr("odmbeg"), - // }, - // }, - // Endpoints: []*armneonpostgres.EndpointProperties{ - // { - // EntityID: to.Ptr("entity-id"), - // EntityName: to.Ptr("entity-name"), - // CreatedAt: to.Ptr("vhcilurdd"), - // ProvisioningState: to.Ptr(armneonpostgres.ResourceProvisioningStateSucceeded), - // Attributes: []*armneonpostgres.Attributes{ - // { - // Name: to.Ptr("trhvzyvaqy"), - // Value: to.Ptr("evpkgsskyavybxwwssm"), - // }, - // }, - // ProjectID: to.Ptr("rtvdeeflqzlrpfzhjqhcsfbldw"), - // BranchID: to.Ptr("rzsyrhpfbydxtfkpaa"), - // EndpointType: to.Ptr(armneonpostgres.EndpointTypeReadOnly), - // }, - // }, - // }, - // ID: to.Ptr("/subscriptions/9B8E3300-C5FA-442B-A259-3F6F614D5BD4/resourceGroups/rgneon/providers/Microsoft.Neon/organizations/test-org/projects/cajluydhtylhjatsexnmxmxhwfs"), - // Name: to.Ptr("cajluydhtylhjatsexnmxmxhwfs"), - // Type: to.Ptr("voaddrcrqtyqae"), - // SystemData: &armneonpostgres.SystemData{ - // CreatedBy: to.Ptr("hnyidmqyvvtsddrwkmrqlwtlew"), - // CreatedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // LastModifiedBy: to.Ptr("szuncyyauzxhpzlbcvjkeamp"), - // LastModifiedByType: to.Ptr(armneonpostgres.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-03-24T04:03:54.769Z"); return t}()), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go b/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go index bf74ca89e06a..7da3a304b2f3 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/responses.go @@ -27,128 +27,30 @@ type BranchesClientListResponse struct { BranchListResult } -// BranchesClientUpdateResponse contains the response from method BranchesClient.BeginUpdate. -type BranchesClientUpdateResponse struct { - // The Branch resource type. - Branch -} - -// ComputesClientCreateOrUpdateResponse contains the response from method ComputesClient.BeginCreateOrUpdate. -type ComputesClientCreateOrUpdateResponse struct { - // The Compute resource type. - Compute -} - -// ComputesClientDeleteResponse contains the response from method ComputesClient.Delete. -type ComputesClientDeleteResponse struct { - // placeholder for future response values -} - -// ComputesClientGetResponse contains the response from method ComputesClient.Get. -type ComputesClientGetResponse struct { - // The Compute resource type. - Compute -} - // ComputesClientListResponse contains the response from method ComputesClient.NewListPager. type ComputesClientListResponse struct { // The response of a Compute list operation. ComputeListResult } -// ComputesClientUpdateResponse contains the response from method ComputesClient.BeginUpdate. -type ComputesClientUpdateResponse struct { - // The Compute resource type. - Compute -} - -// EndpointsClientCreateOrUpdateResponse contains the response from method EndpointsClient.BeginCreateOrUpdate. -type EndpointsClientCreateOrUpdateResponse struct { - // The Neon compute endpoint resource type. - Endpoint -} - -// EndpointsClientDeleteResponse contains the response from method EndpointsClient.Delete. -type EndpointsClientDeleteResponse struct { - // placeholder for future response values -} - -// EndpointsClientGetResponse contains the response from method EndpointsClient.Get. -type EndpointsClientGetResponse struct { - // The Neon compute endpoint resource type. - Endpoint -} - // EndpointsClientListResponse contains the response from method EndpointsClient.NewListPager. type EndpointsClientListResponse struct { // The response of a Endpoint list operation. EndpointListResult } -// EndpointsClientUpdateResponse contains the response from method EndpointsClient.BeginUpdate. -type EndpointsClientUpdateResponse struct { - // The Neon compute endpoint resource type. - Endpoint -} - -// NeonDatabasesClientCreateOrUpdateResponse contains the response from method NeonDatabasesClient.BeginCreateOrUpdate. -type NeonDatabasesClientCreateOrUpdateResponse struct { - // The Neon Database resource type. - NeonDatabase -} - -// NeonDatabasesClientDeleteResponse contains the response from method NeonDatabasesClient.Delete. -type NeonDatabasesClientDeleteResponse struct { - // placeholder for future response values -} - -// NeonDatabasesClientGetResponse contains the response from method NeonDatabasesClient.Get. -type NeonDatabasesClientGetResponse struct { - // The Neon Database resource type. - NeonDatabase -} - // NeonDatabasesClientListResponse contains the response from method NeonDatabasesClient.NewListPager. type NeonDatabasesClientListResponse struct { // The response of a NeonDatabase list operation. NeonDatabaseListResult } -// NeonDatabasesClientUpdateResponse contains the response from method NeonDatabasesClient.BeginUpdate. -type NeonDatabasesClientUpdateResponse struct { - // The Neon Database resource type. - NeonDatabase -} - -// NeonRolesClientCreateOrUpdateResponse contains the response from method NeonRolesClient.BeginCreateOrUpdate. -type NeonRolesClientCreateOrUpdateResponse struct { - // The Neon Role resource type. - NeonRole -} - -// NeonRolesClientDeleteResponse contains the response from method NeonRolesClient.Delete. -type NeonRolesClientDeleteResponse struct { - // placeholder for future response values -} - -// NeonRolesClientGetResponse contains the response from method NeonRolesClient.Get. -type NeonRolesClientGetResponse struct { - // The Neon Role resource type. - NeonRole -} - // NeonRolesClientListResponse contains the response from method NeonRolesClient.NewListPager. type NeonRolesClientListResponse struct { // The response of a NeonRole list operation. NeonRoleListResult } -// NeonRolesClientUpdateResponse contains the response from method NeonRolesClient.BeginUpdate. -type NeonRolesClientUpdateResponse struct { - // The Neon Role resource type. - NeonRole -} - // 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. @@ -224,9 +126,3 @@ type ProjectsClientListResponse struct { // The response of a Project list operation. ProjectListResult } - -// ProjectsClientUpdateResponse contains the response from method ProjectsClient.BeginUpdate. -type ProjectsClientUpdateResponse struct { - // The Project resource type. - Project -} diff --git a/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml b/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml index 73c9b12920db..b7191e4eb2a6 100644 --- a/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml +++ b/sdk/resourcemanager/neonpostgres/armneonpostgres/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/liftrneon/Neon.Postgres.Management -commit: 3db6867b8e524ea6d1bc7a3bbb989fe50dd2f184 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/CHANGELOG.md b/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/CHANGELOG.md index 33fe67945fb9..e09933fb17cb 100644 --- a/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/CHANGELOG.md +++ b/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 0.1.0 (2025-05-06) +## 0.1.0 (2025-05-13) ### Other Changes The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html). diff --git a/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/README.md b/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/README.md index 02dc9af90dee..8e64ebbe42fe 100644 --- a/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/README.md +++ b/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/README.md @@ -1,6 +1,6 @@ -# Azure Online Experimentation Module for Go +# Azure Onlineexperimentation Module for Go -The `armonlineexperimentation` module provides operations for working with Azure Online Experimentation. +The `armonlineexperimentation` module provides operations for working with Azure Onlineexperimentation. [Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation) @@ -15,7 +15,7 @@ The `armonlineexperimentation` module provides operations for working with Azure This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for versioning and dependency management. -Install the Azure Online Experimentation module: +Install the Azure Onlineexperimentation module: ```sh go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation @@ -23,7 +23,7 @@ go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/onlineexperimentati ## Authorization -When creating a client, you will need to provide a credential for authenticating with Azure Online Experimentation. The `azidentity` module provides facilities for various ways of authenticating with Azure including client/secret, certificate, managed identity, and more. +When creating a client, you will need to provide a credential for authenticating with Azure Onlineexperimentation. 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) @@ -33,7 +33,7 @@ For more information on authentication, please see the documentation for `aziden ## Client Factory -Azure Online Experimentation module consists of one or more clients. We provide a client factory which could be used to create any client in this module. +Azure Onlineexperimentation 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 := armonlineexperimentation.NewClientFactory(, cred, nil) diff --git a/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/models.go b/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/models.go index 8730ce0a8cde..8b4fd831061f 100644 --- a/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/models.go +++ b/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/models.go @@ -140,7 +140,9 @@ type OnlineExperimentWorkspaceProperties struct { WorkspaceID *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 diff --git a/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/tsp-location.yaml b/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/tsp-location.yaml index bd445b371197..3d9438867903 100644 --- a/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/tsp-location.yaml +++ b/sdk/resourcemanager/onlineexperimentation/armonlineexperimentation/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/onlineexperimentation/OnlineExperimentation.Management -commit: ccfd0797af2cc1dee2decfaae46add2f76e108d8 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/CHANGELOG.md b/sdk/resourcemanager/oracledatabase/armoracledatabase/CHANGELOG.md index 075358ad45d9..d6892f5c5f62 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/CHANGELOG.md +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/CHANGELOG.md @@ -1,5 +1,118 @@ # Release History +## 2.0.0 (2025-05-13) +### Breaking Changes + +- Function `*AutonomousDatabaseBackupsClient.BeginUpdate` parameter(s) have been changed from `(context.Context, string, string, string, AutonomousDatabaseBackupUpdate, *AutonomousDatabaseBackupsClientBeginUpdateOptions)` to `(context.Context, string, string, string, AutonomousDatabaseBackup, *AutonomousDatabaseBackupsClientBeginUpdateOptions)` +- Type of `AutonomousDatabaseUpdateProperties.ScheduledOperations` has been changed from `*ScheduledOperationsTypeUpdate` to `*ScheduledOperationsType` +- Function `*AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager` has been removed +- Function `*DbNodesClient.NewListByCloudVMClusterPager` has been removed +- Function `*DbServersClient.NewListByCloudExadataInfrastructurePager` has been removed +- Function `*VirtualNetworkAddressesClient.NewListByCloudVMClusterPager` has been removed +- Struct `ActivationLinks` has been removed +- Struct `AutonomousDatabaseBackupUpdate` has been removed +- Struct `AutonomousDatabaseBackupUpdateProperties` has been removed +- Struct `CloudAccountDetails` has been removed +- Struct `DayOfWeekUpdate` has been removed +- Struct `SaasSubscriptionDetails` has been removed +- Struct `ScheduledOperationsTypeUpdate` has been removed +- Field `PrivateIPAddressPropertiesArray` of struct `CloudVMClustersClientListPrivateIPAddressesResponse` has been removed +- Field `ActivationLinks` of struct `OracleSubscriptionsClientListActivationLinksResponse` has been removed +- Field `CloudAccountDetails` of struct `OracleSubscriptionsClientListCloudAccountDetailsResponse` has been removed +- Field `SaasSubscriptionDetails` of struct `OracleSubscriptionsClientListSaasSubscriptionDetailsResponse` has been removed + +### Features Added + +- New value `DataBaseTypeCloneFromBackupTimestamp`, `DataBaseTypeCrossRegionDisasterRecovery` added to enum type `DataBaseType` +- New enum type `AddSubscriptionOperationState` with values `AddSubscriptionOperationStateFailed`, `AddSubscriptionOperationStateSucceeded`, `AddSubscriptionOperationStateUpdating` +- New enum type `ExadbVMClusterLifecycleState` with values `ExadbVMClusterLifecycleStateAvailable`, `ExadbVMClusterLifecycleStateFailed`, `ExadbVMClusterLifecycleStateMaintenanceInProgress`, `ExadbVMClusterLifecycleStateProvisioning`, `ExadbVMClusterLifecycleStateTerminated`, `ExadbVMClusterLifecycleStateTerminating`, `ExadbVMClusterLifecycleStateUpdating` +- New enum type `ExascaleDbStorageVaultLifecycleState` with values `ExascaleDbStorageVaultLifecycleStateAvailable`, `ExascaleDbStorageVaultLifecycleStateFailed`, `ExascaleDbStorageVaultLifecycleStateProvisioning`, `ExascaleDbStorageVaultLifecycleStateTerminated`, `ExascaleDbStorageVaultLifecycleStateTerminating`, `ExascaleDbStorageVaultLifecycleStateUpdating` +- New enum type `GridImageType` with values `GridImageTypeCustomImage`, `GridImageTypeReleaseUpdate` +- New enum type `HardwareType` with values `HardwareTypeCELL`, `HardwareTypeCOMPUTE` +- New enum type `ShapeFamily` with values `ShapeFamilyExadata`, `ShapeFamilyExadbXs` +- New enum type `SystemShapes` with values `SystemShapesExaDbXs`, `SystemShapesExadataX11M`, `SystemShapesExadataX9M` +- New function `*AutonomousDatabaseBackupsClient.NewListByParentPager(string, string, *AutonomousDatabaseBackupsClientListByParentOptions) *runtime.Pager[AutonomousDatabaseBackupsClientListByParentResponse]` +- New function `*AutonomousDatabaseCrossRegionDisasterRecoveryProperties.GetAutonomousDatabaseBaseProperties() *AutonomousDatabaseBaseProperties` +- New function `*AutonomousDatabaseFromBackupTimestampProperties.GetAutonomousDatabaseBaseProperties() *AutonomousDatabaseBaseProperties` +- New function `*AutonomousDatabasesClient.BeginChangeDisasterRecoveryConfiguration(context.Context, string, string, DisasterRecoveryConfigurationDetails, *AutonomousDatabasesClientBeginChangeDisasterRecoveryConfigurationOptions) (*runtime.Poller[AutonomousDatabasesClientChangeDisasterRecoveryConfigurationResponse], error)` +- New function `*ClientFactory.NewExadbVMClustersClient() *ExadbVMClustersClient` +- New function `*ClientFactory.NewExascaleDbNodesClient() *ExascaleDbNodesClient` +- New function `*ClientFactory.NewExascaleDbStorageVaultsClient() *ExascaleDbStorageVaultsClient` +- New function `*ClientFactory.NewFlexComponentsClient() *FlexComponentsClient` +- New function `*ClientFactory.NewGiMinorVersionsClient() *GiMinorVersionsClient` +- New function `*DbNodesClient.NewListByParentPager(string, string, *DbNodesClientListByParentOptions) *runtime.Pager[DbNodesClientListByParentResponse]` +- New function `*DbServersClient.NewListByParentPager(string, string, *DbServersClientListByParentOptions) *runtime.Pager[DbServersClientListByParentResponse]` +- New function `NewExadbVMClustersClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ExadbVMClustersClient, error)` +- New function `*ExadbVMClustersClient.BeginCreateOrUpdate(context.Context, string, string, ExadbVMCluster, *ExadbVMClustersClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExadbVMClustersClientCreateOrUpdateResponse], error)` +- New function `*ExadbVMClustersClient.BeginDelete(context.Context, string, string, *ExadbVMClustersClientBeginDeleteOptions) (*runtime.Poller[ExadbVMClustersClientDeleteResponse], error)` +- New function `*ExadbVMClustersClient.Get(context.Context, string, string, *ExadbVMClustersClientGetOptions) (ExadbVMClustersClientGetResponse, error)` +- New function `*ExadbVMClustersClient.NewListByResourceGroupPager(string, *ExadbVMClustersClientListByResourceGroupOptions) *runtime.Pager[ExadbVMClustersClientListByResourceGroupResponse]` +- New function `*ExadbVMClustersClient.NewListBySubscriptionPager(*ExadbVMClustersClientListBySubscriptionOptions) *runtime.Pager[ExadbVMClustersClientListBySubscriptionResponse]` +- New function `*ExadbVMClustersClient.BeginRemoveVMs(context.Context, string, string, RemoveVirtualMachineFromExadbVMClusterDetails, *ExadbVMClustersClientBeginRemoveVMsOptions) (*runtime.Poller[ExadbVMClustersClientRemoveVMsResponse], error)` +- New function `*ExadbVMClustersClient.BeginUpdate(context.Context, string, string, ExadbVMClusterUpdate, *ExadbVMClustersClientBeginUpdateOptions) (*runtime.Poller[ExadbVMClustersClientUpdateResponse], error)` +- New function `NewExascaleDbNodesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ExascaleDbNodesClient, error)` +- New function `*ExascaleDbNodesClient.BeginAction(context.Context, string, string, string, DbNodeAction, *ExascaleDbNodesClientBeginActionOptions) (*runtime.Poller[ExascaleDbNodesClientActionResponse], error)` +- New function `*ExascaleDbNodesClient.Get(context.Context, string, string, string, *ExascaleDbNodesClientGetOptions) (ExascaleDbNodesClientGetResponse, error)` +- New function `*ExascaleDbNodesClient.NewListByParentPager(string, string, *ExascaleDbNodesClientListByParentOptions) *runtime.Pager[ExascaleDbNodesClientListByParentResponse]` +- New function `NewExascaleDbStorageVaultsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ExascaleDbStorageVaultsClient, error)` +- New function `*ExascaleDbStorageVaultsClient.BeginCreate(context.Context, string, string, ExascaleDbStorageVault, *ExascaleDbStorageVaultsClientBeginCreateOptions) (*runtime.Poller[ExascaleDbStorageVaultsClientCreateResponse], error)` +- New function `*ExascaleDbStorageVaultsClient.BeginDelete(context.Context, string, string, *ExascaleDbStorageVaultsClientBeginDeleteOptions) (*runtime.Poller[ExascaleDbStorageVaultsClientDeleteResponse], error)` +- New function `*ExascaleDbStorageVaultsClient.Get(context.Context, string, string, *ExascaleDbStorageVaultsClientGetOptions) (ExascaleDbStorageVaultsClientGetResponse, error)` +- New function `*ExascaleDbStorageVaultsClient.NewListByResourceGroupPager(string, *ExascaleDbStorageVaultsClientListByResourceGroupOptions) *runtime.Pager[ExascaleDbStorageVaultsClientListByResourceGroupResponse]` +- New function `*ExascaleDbStorageVaultsClient.NewListBySubscriptionPager(*ExascaleDbStorageVaultsClientListBySubscriptionOptions) *runtime.Pager[ExascaleDbStorageVaultsClientListBySubscriptionResponse]` +- New function `*ExascaleDbStorageVaultsClient.BeginUpdate(context.Context, string, string, ExascaleDbStorageVaultTagsUpdate, *ExascaleDbStorageVaultsClientBeginUpdateOptions) (*runtime.Poller[ExascaleDbStorageVaultsClientUpdateResponse], error)` +- New function `NewFlexComponentsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*FlexComponentsClient, error)` +- New function `*FlexComponentsClient.Get(context.Context, string, string, *FlexComponentsClientGetOptions) (FlexComponentsClientGetResponse, error)` +- New function `*FlexComponentsClient.NewListByParentPager(string, *FlexComponentsClientListByParentOptions) *runtime.Pager[FlexComponentsClientListByParentResponse]` +- New function `NewGiMinorVersionsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GiMinorVersionsClient, error)` +- New function `*GiMinorVersionsClient.Get(context.Context, string, string, string, *GiMinorVersionsClientGetOptions) (GiMinorVersionsClientGetResponse, error)` +- New function `*GiMinorVersionsClient.NewListByParentPager(string, string, *GiMinorVersionsClientListByParentOptions) *runtime.Pager[GiMinorVersionsClientListByParentResponse]` +- New function `*OracleSubscriptionsClient.BeginAddAzureSubscriptions(context.Context, AzureSubscriptions, *OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions) (*runtime.Poller[OracleSubscriptionsClientAddAzureSubscriptionsResponse], error)` +- New function `*VirtualNetworkAddressesClient.NewListByParentPager(string, string, *VirtualNetworkAddressesClientListByParentOptions) *runtime.Pager[VirtualNetworkAddressesClientListByParentResponse]` +- New struct `AutonomousDatabaseCrossRegionDisasterRecoveryProperties` +- New struct `AutonomousDatabaseFromBackupTimestampProperties` +- New struct `AzureSubscriptions` +- New struct `DbActionResponse` +- New struct `DbNodeDetails` +- New struct `DefinedFileSystemConfiguration` +- New struct `DisasterRecoveryConfigurationDetails` +- New struct `ExadbVMCluster` +- New struct `ExadbVMClusterListResult` +- New struct `ExadbVMClusterProperties` +- New struct `ExadbVMClusterStorageDetails` +- New struct `ExadbVMClusterUpdate` +- New struct `ExadbVMClusterUpdateProperties` +- New struct `ExascaleDbNode` +- New struct `ExascaleDbNodeListResult` +- New struct `ExascaleDbNodeProperties` +- New struct `ExascaleDbStorageDetails` +- New struct `ExascaleDbStorageInputDetails` +- New struct `ExascaleDbStorageVault` +- New struct `ExascaleDbStorageVaultListResult` +- New struct `ExascaleDbStorageVaultProperties` +- New struct `ExascaleDbStorageVaultTagsUpdate` +- New struct `FileSystemConfigurationDetails` +- New struct `FlexComponent` +- New struct `FlexComponentListResult` +- New struct `FlexComponentProperties` +- New struct `GiMinorVersion` +- New struct `GiMinorVersionListResult` +- New struct `GiMinorVersionProperties` +- New struct `RemoveVirtualMachineFromExadbVMClusterDetails` +- New field `RemoteDisasterRecoveryConfiguration`, `TimeDisasterRecoveryRoleChanged` in struct `AutonomousDatabaseCloneProperties` +- New field `RemoteDisasterRecoveryConfiguration`, `TimeDisasterRecoveryRoleChanged` in struct `AutonomousDatabaseProperties` +- New field `ComputeModel`, `DatabaseServerType`, `DefinedFileSystemConfiguration`, `StorageServerType` in struct `CloudExadataInfrastructureProperties` +- New field `ComputeModel`, `FileSystemConfigurationDetails` in struct `CloudVMClusterProperties` +- New field `FileSystemConfigurationDetails` in struct `CloudVMClusterUpdateProperties` +- New field `PrivateIpAddressPropertiesArray` in struct `CloudVMClustersClientListPrivateIPAddressesResponse` +- New field `ComputeModel` in struct `DbServerProperties` +- New field `AreServerTypesSupported`, `ComputeModel`, `DisplayName`, `ShapeName` in struct `DbSystemShapeProperties` +- New field `Zone` in struct `DbSystemShapesClientListByLocationOptions` +- New field `Shape`, `Zone` in struct `GiVersionsClientListByLocationOptions` +- New field `AddSubscriptionOperationState`, `AzureSubscriptionIDs`, `LastOperationStatusDetail` in struct `OracleSubscriptionProperties` +- New field `PeerDbLocation`, `PeerDbOcid` in struct `PeerDbDetails` + + ## 1.0.0 (2024-06-28) ### Other Changes diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/README.md b/sdk/resourcemanager/oracledatabase/armoracledatabase/README.md index 98d27c777970..f0ee4ce2399f 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/README.md +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/README.md @@ -18,7 +18,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Oracle Database module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2 ``` ## Authorization diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client.go index d58cf43d6ebc..5bf18b64a83b 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_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 armoracledatabase @@ -46,7 +42,7 @@ func NewAutonomousDatabaseBackupsClient(subscriptionID string, credential azcore // BeginCreateOrUpdate - Create a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - adbbackupid - AutonomousDatabaseBackup id @@ -60,8 +56,7 @@ func (client *AutonomousDatabaseBackupsClient) BeginCreateOrUpdate(ctx context.C return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabaseBackupsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -74,7 +69,7 @@ func (client *AutonomousDatabaseBackupsClient) BeginCreateOrUpdate(ctx context.C // CreateOrUpdate - Create a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *AutonomousDatabaseBackupsClient) createOrUpdate(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, resource AutonomousDatabaseBackup, options *AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabaseBackupsClient.BeginCreateOrUpdate" @@ -97,7 +92,7 @@ func (client *AutonomousDatabaseBackupsClient) createOrUpdate(ctx context.Contex } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AutonomousDatabaseBackupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, resource AutonomousDatabaseBackup, options *AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AutonomousDatabaseBackupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, resource AutonomousDatabaseBackup, _ *AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -120,9 +115,10 @@ func (client *AutonomousDatabaseBackupsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -132,7 +128,7 @@ func (client *AutonomousDatabaseBackupsClient) createOrUpdateCreateRequest(ctx c // BeginDelete - Delete a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - adbbackupid - AutonomousDatabaseBackup id @@ -145,8 +141,7 @@ func (client *AutonomousDatabaseBackupsClient) BeginDelete(ctx context.Context, return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabaseBackupsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -159,7 +154,7 @@ func (client *AutonomousDatabaseBackupsClient) BeginDelete(ctx context.Context, // Delete - Delete a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *AutonomousDatabaseBackupsClient) deleteOperation(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, options *AutonomousDatabaseBackupsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabaseBackupsClient.BeginDelete" @@ -182,7 +177,7 @@ func (client *AutonomousDatabaseBackupsClient) deleteOperation(ctx context.Conte } // deleteCreateRequest creates the Delete request. -func (client *AutonomousDatabaseBackupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, options *AutonomousDatabaseBackupsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *AutonomousDatabaseBackupsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, _ *AutonomousDatabaseBackupsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -205,7 +200,7 @@ func (client *AutonomousDatabaseBackupsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +209,7 @@ func (client *AutonomousDatabaseBackupsClient) deleteCreateRequest(ctx context.C // Get - Get a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - adbbackupid - AutonomousDatabaseBackup id @@ -243,7 +238,7 @@ func (client *AutonomousDatabaseBackupsClient) Get(ctx context.Context, resource } // getCreateRequest creates the Get request. -func (client *AutonomousDatabaseBackupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, options *AutonomousDatabaseBackupsClientGetOptions) (*policy.Request, error) { +func (client *AutonomousDatabaseBackupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, _ *AutonomousDatabaseBackupsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -266,7 +261,7 @@ func (client *AutonomousDatabaseBackupsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,38 +276,38 @@ func (client *AutonomousDatabaseBackupsClient) getHandleResponse(resp *http.Resp return result, nil } -// NewListByAutonomousDatabasePager - List AutonomousDatabaseBackup resources by AutonomousDatabase +// NewListByParentPager - List AutonomousDatabaseBackup resources by AutonomousDatabase // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. -// - options - AutonomousDatabaseBackupsClientListByAutonomousDatabaseOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager +// - options - AutonomousDatabaseBackupsClientListByParentOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.NewListByParentPager // method. -func (client *AutonomousDatabaseBackupsClient) NewListByAutonomousDatabasePager(resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabaseBackupsClientListByAutonomousDatabaseOptions) *runtime.Pager[AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse] { - return runtime.NewPager(runtime.PagingHandler[AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse]{ - More: func(page AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse) bool { +func (client *AutonomousDatabaseBackupsClient) NewListByParentPager(resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabaseBackupsClientListByParentOptions) *runtime.Pager[AutonomousDatabaseBackupsClientListByParentResponse] { + return runtime.NewPager(runtime.PagingHandler[AutonomousDatabaseBackupsClientListByParentResponse]{ + More: func(page AutonomousDatabaseBackupsClientListByParentResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse) (AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager") + Fetcher: func(ctx context.Context, page *AutonomousDatabaseBackupsClientListByParentResponse) (AutonomousDatabaseBackupsClientListByParentResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AutonomousDatabaseBackupsClient.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.listByAutonomousDatabaseCreateRequest(ctx, resourceGroupName, autonomousdatabasename, options) + return client.listByParentCreateRequest(ctx, resourceGroupName, autonomousdatabasename, options) }, nil) if err != nil { - return AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse{}, err + return AutonomousDatabaseBackupsClientListByParentResponse{}, err } - return client.listByAutonomousDatabaseHandleResponse(resp) + return client.listByParentHandleResponse(resp) }, Tracer: client.internal.Tracer(), }) } -// listByAutonomousDatabaseCreateRequest creates the ListByAutonomousDatabase request. -func (client *AutonomousDatabaseBackupsClient) listByAutonomousDatabaseCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabaseBackupsClientListByAutonomousDatabaseOptions) (*policy.Request, error) { +// listByParentCreateRequest creates the ListByParent request. +func (client *AutonomousDatabaseBackupsClient) listByParentCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, _ *AutonomousDatabaseBackupsClientListByParentOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -331,17 +326,17 @@ func (client *AutonomousDatabaseBackupsClient) listByAutonomousDatabaseCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByAutonomousDatabaseHandleResponse handles the ListByAutonomousDatabase response. -func (client *AutonomousDatabaseBackupsClient) listByAutonomousDatabaseHandleResponse(resp *http.Response) (AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse, error) { - result := AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse{} +// listByParentHandleResponse handles the ListByParent response. +func (client *AutonomousDatabaseBackupsClient) listByParentHandleResponse(resp *http.Response) (AutonomousDatabaseBackupsClientListByParentResponse, error) { + result := AutonomousDatabaseBackupsClientListByParentResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.AutonomousDatabaseBackupListResult); err != nil { - return AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse{}, err + return AutonomousDatabaseBackupsClientListByParentResponse{}, err } return result, nil } @@ -349,22 +344,21 @@ func (client *AutonomousDatabaseBackupsClient) listByAutonomousDatabaseHandleRes // BeginUpdate - Update a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - adbbackupid - AutonomousDatabaseBackup id // - properties - The resource properties to be updated. // - options - AutonomousDatabaseBackupsClientBeginUpdateOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.BeginUpdate // method. -func (client *AutonomousDatabaseBackupsClient) BeginUpdate(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, properties AutonomousDatabaseBackupUpdate, options *AutonomousDatabaseBackupsClientBeginUpdateOptions) (*runtime.Poller[AutonomousDatabaseBackupsClientUpdateResponse], error) { +func (client *AutonomousDatabaseBackupsClient) BeginUpdate(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, properties AutonomousDatabaseBackup, options *AutonomousDatabaseBackupsClientBeginUpdateOptions) (*runtime.Poller[AutonomousDatabaseBackupsClientUpdateResponse], error) { if options == nil || options.ResumeToken == "" { resp, err := client.update(ctx, resourceGroupName, autonomousdatabasename, adbbackupid, properties, options) if err != nil { return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabaseBackupsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -377,8 +371,8 @@ func (client *AutonomousDatabaseBackupsClient) BeginUpdate(ctx context.Context, // Update - Update a AutonomousDatabaseBackup // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 -func (client *AutonomousDatabaseBackupsClient) update(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, properties AutonomousDatabaseBackupUpdate, options *AutonomousDatabaseBackupsClientBeginUpdateOptions) (*http.Response, error) { +// Generated from API version 2025-03-01 +func (client *AutonomousDatabaseBackupsClient) update(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, properties AutonomousDatabaseBackup, options *AutonomousDatabaseBackupsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabaseBackupsClient.BeginUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) @@ -400,7 +394,7 @@ func (client *AutonomousDatabaseBackupsClient) update(ctx context.Context, resou } // updateCreateRequest creates the Update request. -func (client *AutonomousDatabaseBackupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, properties AutonomousDatabaseBackupUpdate, options *AutonomousDatabaseBackupsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *AutonomousDatabaseBackupsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, properties AutonomousDatabaseBackup, _ *AutonomousDatabaseBackupsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/autonomousDatabaseBackups/{adbbackupid}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -423,9 +417,10 @@ func (client *AutonomousDatabaseBackupsClient) updateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client_example_test.go index 75398af87322..63ae9856a082 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client_example_test.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasebackups_client_example_test.go @@ -1,132 +1,28 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armoracledatabase_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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseBackup_listByParent.json -func ExampleAutonomousDatabaseBackupsClient_NewListByAutonomousDatabasePager_autonomousDatabaseBackupsListByAutonomousDatabase() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutonomousDatabaseBackupsClient().NewListByAutonomousDatabasePager("rg000", "databasedb1", 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.AutonomousDatabaseBackupListResult = armoracledatabase.AutonomousDatabaseBackupListResult{ - // Value: []*armoracledatabase.AutonomousDatabaseBackup{ - // { - // Type: to.Ptr("Oracle.Database/autonomousDatabases/autonomousDatabaseBackups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1/autonomousDatabaseBackups/1711644130"), - // Properties: &armoracledatabase.AutonomousDatabaseBackupProperties{ - // AutonomousDatabaseOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), - // BackupType: to.Ptr(armoracledatabase.AutonomousDatabaseBackupTypeFull), - // DatabaseSizeInTbs: to.Ptr[float64](2), - // DbVersion: to.Ptr("19.6.0.0"), - // DisplayName: to.Ptr("Nightly Backup"), - // IsAutomatic: to.Ptr(true), - // IsRestorable: to.Ptr(true), - // LifecycleDetails: to.Ptr("Backup completed successfully"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseBackupLifecycleStateActive), - // Ocid: to.Ptr("ocid1.autonomousdatabasebackup.oc1..aaaaaaaavwpj"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // RetentionPeriodInDays: to.Ptr[int32](365), - // SizeInTbs: to.Ptr[float64](2), - // TimeAvailableTil: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-09T20:44:09.466Z"); return t}()), - // TimeEnded: to.Ptr("2024-01-09T20:44:09.466Z"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseBackup_get.json -func ExampleAutonomousDatabaseBackupsClient_Get_autonomousDatabaseBackupsGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutonomousDatabaseBackupsClient().Get(ctx, "rg000", "databasedb1", "1711644130", 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.AutonomousDatabaseBackup = armoracledatabase.AutonomousDatabaseBackup{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases/autonomousDatabaseBackups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1/autonomousDatabaseBackups/1711644130"), - // Properties: &armoracledatabase.AutonomousDatabaseBackupProperties{ - // AutonomousDatabaseOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), - // BackupType: to.Ptr(armoracledatabase.AutonomousDatabaseBackupTypeFull), - // DatabaseSizeInTbs: to.Ptr[float64](2), - // DbVersion: to.Ptr("19.6.0.0"), - // DisplayName: to.Ptr("Nightly Backup"), - // IsAutomatic: to.Ptr(true), - // IsRestorable: to.Ptr(true), - // LifecycleDetails: to.Ptr("Backup completed successfully"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseBackupLifecycleStateActive), - // Ocid: to.Ptr("ocid1.autonomousdatabasebackup.oc1..aaaaaaaavwpj"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // RetentionPeriodInDays: to.Ptr[int32](365), - // SizeInTbs: to.Ptr[float64](2), - // TimeAvailableTil: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-09T20:44:09.466Z"); return t}()), - // TimeEnded: to.Ptr("2024-01-09T20:44:09.466Z"), - // TimeStarted: to.Ptr("2024-01-09T19:44:09.466Z"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseBackup_create.json -func ExampleAutonomousDatabaseBackupsClient_BeginCreateOrUpdate_autonomousDatabaseBackupsCreateOrUpdate() { +// Generated from example definition: 2025-03-01/autonomousDatabaseBackup_patch.json +func ExampleAutonomousDatabaseBackupsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewAutonomousDatabaseBackupsClient().BeginCreateOrUpdate(ctx, "rg000", "databasedb1", "1711644130", armoracledatabase.AutonomousDatabaseBackup{ - Properties: &armoracledatabase.AutonomousDatabaseBackupProperties{ - AutonomousDatabaseOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), - DisplayName: to.Ptr("Nightly Backup"), - RetentionPeriodInDays: to.Ptr[int32](365), - }, - }, nil) + poller, err := clientFactory.NewAutonomousDatabaseBackupsClient().BeginUpdate(ctx, "rg000", "databasedb1", "1711644130", armoracledatabase.AutonomousDatabaseBackup{}, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -137,90 +33,25 @@ func ExampleAutonomousDatabaseBackupsClient_BeginCreateOrUpdate_autonomousDataba // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutonomousDatabaseBackup = armoracledatabase.AutonomousDatabaseBackup{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases/autonomousDatabaseBackups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1/autonomousDatabaseBackups/1711644130"), - // Properties: &armoracledatabase.AutonomousDatabaseBackupProperties{ - // AutonomousDatabaseOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), - // BackupType: to.Ptr(armoracledatabase.AutonomousDatabaseBackupTypeFull), - // DatabaseSizeInTbs: to.Ptr[float64](2), - // DbVersion: to.Ptr("19.6.0.0"), - // DisplayName: to.Ptr("Nightly Backup"), - // IsAutomatic: to.Ptr(true), - // IsRestorable: to.Ptr(true), - // LifecycleDetails: to.Ptr("Backup completed successfully"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseBackupLifecycleStateActive), - // Ocid: to.Ptr("ocid1.autonomousdatabasebackup.oc1..aaaaaaaavwpj"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // RetentionPeriodInDays: to.Ptr[int32](365), - // SizeInTbs: to.Ptr[float64](2), - // TimeAvailableTil: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2025-01-09T20:44:09.466Z"); return t}()), - // TimeEnded: to.Ptr("2024-01-09T20:44:09.466Z"), - // TimeStarted: to.Ptr("2024-01-09T19:44:09.466Z"), + // res = armoracledatabase.AutonomousDatabaseBackupsClientUpdateResponse{ + // AutonomousDatabaseBackup: &armoracledatabase.AutonomousDatabaseBackup{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1/autonomousDatabaseBackups/1711644130"), + // Type: to.Ptr("Oracle.Database/autonomousDatabases/autonomousDatabaseBackups"), + // Properties: &armoracledatabase.AutonomousDatabaseBackupProperties{ + // AutonomousDatabaseOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), + // DatabaseSizeInTbs: to.Ptr[float64](2), + // DbVersion: to.Ptr("19.6.0.0"), + // DisplayName: to.Ptr("Nightly Backup"), + // Ocid: to.Ptr("ocid1.autonomousdatabasebackup.oc1..aaaaaaaavwpj"), + // IsAutomatic: to.Ptr(true), + // IsRestorable: to.Ptr(true), + // LifecycleDetails: to.Ptr("Backup updated successfully"), + // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseBackupLifecycleStateActive), + // RetentionPeriodInDays: to.Ptr[int32](400), + // SizeInTbs: to.Ptr[float64](2), + // BackupType: to.Ptr(armoracledatabase.AutonomousDatabaseBackupTypeFull), + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), + // }, // }, // } } - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseBackup_patch.json -func ExampleAutonomousDatabaseBackupsClient_BeginUpdate_autonomousDatabaseBackupsUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabaseBackupsClient().BeginUpdate(ctx, "rg000", "databasedb1", "1711644130", armoracledatabase.AutonomousDatabaseBackupUpdate{}, 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.AutonomousDatabaseBackup = armoracledatabase.AutonomousDatabaseBackup{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases/autonomousDatabaseBackups"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1/autonomousDatabaseBackups/1711644130"), - // Properties: &armoracledatabase.AutonomousDatabaseBackupProperties{ - // AutonomousDatabaseOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), - // BackupType: to.Ptr(armoracledatabase.AutonomousDatabaseBackupTypeFull), - // DatabaseSizeInTbs: to.Ptr[float64](2), - // DbVersion: to.Ptr("19.6.0.0"), - // DisplayName: to.Ptr("Nightly Backup"), - // IsAutomatic: to.Ptr(true), - // IsRestorable: to.Ptr(true), - // LifecycleDetails: to.Ptr("Backup updated successfully"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseBackupLifecycleStateActive), - // Ocid: to.Ptr("ocid1.autonomousdatabasebackup.oc1..aaaaaaaavwpj"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // RetentionPeriodInDays: to.Ptr[int32](400), - // SizeInTbs: to.Ptr[float64](2), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseBackup_delete.json -func ExampleAutonomousDatabaseBackupsClient_BeginDelete_autonomousDatabaseBackupsDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabaseBackupsClient().BeginDelete(ctx, "rg000", "databasedb1", "1711644130", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client.go index 702e11648ed2..27037067514c 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_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 armoracledatabase @@ -46,7 +42,7 @@ func NewAutonomousDatabaseCharacterSetsClient(subscriptionID string, credential // Get - Get a AutonomousDatabaseCharacterSet // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - adbscharsetname - AutonomousDatabaseCharacterSet name // - options - AutonomousDatabaseCharacterSetsClientGetOptions contains the optional parameters for the AutonomousDatabaseCharacterSetsClient.Get @@ -74,7 +70,7 @@ func (client *AutonomousDatabaseCharacterSetsClient) Get(ctx context.Context, lo } // getCreateRequest creates the Get request. -func (client *AutonomousDatabaseCharacterSetsClient) getCreateRequest(ctx context.Context, location string, adbscharsetname string, options *AutonomousDatabaseCharacterSetsClientGetOptions) (*policy.Request, error) { +func (client *AutonomousDatabaseCharacterSetsClient) getCreateRequest(ctx context.Context, location string, adbscharsetname string, _ *AutonomousDatabaseCharacterSetsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseCharacterSets/{adbscharsetname}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -93,7 +89,7 @@ func (client *AutonomousDatabaseCharacterSetsClient) getCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,9 +104,9 @@ func (client *AutonomousDatabaseCharacterSetsClient) getHandleResponse(resp *htt return result, nil } -// NewListByLocationPager - List AutonomousDatabaseCharacterSet resources by Location +// NewListByLocationPager - List AutonomousDatabaseCharacterSet resources by SubscriptionLocationResource // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - options - AutonomousDatabaseCharacterSetsClientListByLocationOptions contains the optional parameters for the AutonomousDatabaseCharacterSetsClient.NewListByLocationPager // method. @@ -138,7 +134,7 @@ func (client *AutonomousDatabaseCharacterSetsClient) NewListByLocationPager(loca } // listByLocationCreateRequest creates the ListByLocation request. -func (client *AutonomousDatabaseCharacterSetsClient) listByLocationCreateRequest(ctx context.Context, location string, options *AutonomousDatabaseCharacterSetsClientListByLocationOptions) (*policy.Request, error) { +func (client *AutonomousDatabaseCharacterSetsClient) listByLocationCreateRequest(ctx context.Context, location string, _ *AutonomousDatabaseCharacterSetsClientListByLocationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseCharacterSets" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -153,7 +149,7 @@ func (client *AutonomousDatabaseCharacterSetsClient) listByLocationCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client_example_test.go deleted file mode 100644 index 585ac7c2378b..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasecharactersets_client_example_test.go +++ /dev/null @@ -1,87 +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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseCharacterSet_listByLocation.json -func ExampleAutonomousDatabaseCharacterSetsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutonomousDatabaseCharacterSetsClient().NewListByLocationPager("eastus", 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.AutonomousDatabaseCharacterSetListResult = armoracledatabase.AutonomousDatabaseCharacterSetListResult{ - // Value: []*armoracledatabase.AutonomousDatabaseCharacterSet{ - // { - // Type: to.Ptr("Oracle.Database/locations/autonomousDatabaseCharacterSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDatabaseCharacterSets/DATABASE"), - // Properties: &armoracledatabase.AutonomousDatabaseCharacterSetProperties{ - // CharacterSet: to.Ptr("AL32UTF8"), - // }, - // }, - // { - // Type: to.Ptr("Oracle.Database/locations/autonomousDatabaseCharacterSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDatabaseCharacterSets/DATABASE"), - // Properties: &armoracledatabase.AutonomousDatabaseCharacterSetProperties{ - // CharacterSet: to.Ptr("UTF8"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseCharacterSet_get.json -func ExampleAutonomousDatabaseCharacterSetsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutonomousDatabaseCharacterSetsClient().Get(ctx, "eastus", "DATABASE", 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.AutonomousDatabaseCharacterSet = armoracledatabase.AutonomousDatabaseCharacterSet{ - // Type: to.Ptr("Oracle.Database/locations/autonomousDatabaseCharacterSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDatabaseCharacterSets/DATABASE"), - // Properties: &armoracledatabase.AutonomousDatabaseCharacterSetProperties{ - // CharacterSet: to.Ptr("AL32UTF8"), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client.go index 9b5a8455510d..2a333c0e8086 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_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 armoracledatabase @@ -46,7 +42,7 @@ func NewAutonomousDatabaseNationalCharacterSetsClient(subscriptionID string, cre // Get - Get a AutonomousDatabaseNationalCharacterSet // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - adbsncharsetname - AutonomousDatabaseNationalCharacterSets name // - options - AutonomousDatabaseNationalCharacterSetsClientGetOptions contains the optional parameters for the AutonomousDatabaseNationalCharacterSetsClient.Get @@ -74,7 +70,7 @@ func (client *AutonomousDatabaseNationalCharacterSetsClient) Get(ctx context.Con } // getCreateRequest creates the Get request. -func (client *AutonomousDatabaseNationalCharacterSetsClient) getCreateRequest(ctx context.Context, location string, adbsncharsetname string, options *AutonomousDatabaseNationalCharacterSetsClientGetOptions) (*policy.Request, error) { +func (client *AutonomousDatabaseNationalCharacterSetsClient) getCreateRequest(ctx context.Context, location string, adbsncharsetname string, _ *AutonomousDatabaseNationalCharacterSetsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseNationalCharacterSets/{adbsncharsetname}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -93,7 +89,7 @@ func (client *AutonomousDatabaseNationalCharacterSetsClient) getCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,9 +104,9 @@ func (client *AutonomousDatabaseNationalCharacterSetsClient) getHandleResponse(r return result, nil } -// NewListByLocationPager - List AutonomousDatabaseNationalCharacterSet resources by Location +// NewListByLocationPager - List AutonomousDatabaseNationalCharacterSet resources by SubscriptionLocationResource // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - options - AutonomousDatabaseNationalCharacterSetsClientListByLocationOptions contains the optional parameters for the AutonomousDatabaseNationalCharacterSetsClient.NewListByLocationPager // method. @@ -138,7 +134,7 @@ func (client *AutonomousDatabaseNationalCharacterSetsClient) NewListByLocationPa } // listByLocationCreateRequest creates the ListByLocation request. -func (client *AutonomousDatabaseNationalCharacterSetsClient) listByLocationCreateRequest(ctx context.Context, location string, options *AutonomousDatabaseNationalCharacterSetsClientListByLocationOptions) (*policy.Request, error) { +func (client *AutonomousDatabaseNationalCharacterSetsClient) listByLocationCreateRequest(ctx context.Context, location string, _ *AutonomousDatabaseNationalCharacterSetsClientListByLocationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDatabaseNationalCharacterSets" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -153,7 +149,7 @@ func (client *AutonomousDatabaseNationalCharacterSetsClient) listByLocationCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client_example_test.go deleted file mode 100644 index 19a978249b59..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabasenationalcharactersets_client_example_test.go +++ /dev/null @@ -1,80 +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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseNationalCharacterSet_listByLocation.json -func ExampleAutonomousDatabaseNationalCharacterSetsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutonomousDatabaseNationalCharacterSetsClient().NewListByLocationPager("eastus", 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.AutonomousDatabaseNationalCharacterSetListResult = armoracledatabase.AutonomousDatabaseNationalCharacterSetListResult{ - // Value: []*armoracledatabase.AutonomousDatabaseNationalCharacterSet{ - // { - // Type: to.Ptr("Oracle.Database/locations/autonomousDatabaseNationalCharacterSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDatabaseNationalCharacterSets/NATIONAL"), - // Properties: &armoracledatabase.AutonomousDatabaseNationalCharacterSetProperties{ - // CharacterSet: to.Ptr("AL16UTF16"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseNationalCharacterSet_get.json -func ExampleAutonomousDatabaseNationalCharacterSetsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutonomousDatabaseNationalCharacterSetsClient().Get(ctx, "eastus", "NATIONAL", 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.AutonomousDatabaseNationalCharacterSet = armoracledatabase.AutonomousDatabaseNationalCharacterSet{ - // Type: to.Ptr("Oracle.Database/locations/autonomousDatabaseNationalCharacterSets"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDatabaseNationalCharacterSets/NATIONAL"), - // Properties: &armoracledatabase.AutonomousDatabaseNationalCharacterSetProperties{ - // CharacterSet: to.Ptr("AL16UTF16"), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client.go index 63903cb2797c..d1361bdc6686 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_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 armoracledatabase @@ -43,10 +39,91 @@ func NewAutonomousDatabasesClient(subscriptionID string, credential azcore.Token return client, nil } +// BeginChangeDisasterRecoveryConfiguration - Perform ChangeDisasterRecoveryConfiguration action on Autonomous Database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - autonomousdatabasename - The database name. +// - body - The content of the action request +// - options - AutonomousDatabasesClientBeginChangeDisasterRecoveryConfigurationOptions contains the optional parameters for +// the AutonomousDatabasesClient.BeginChangeDisasterRecoveryConfiguration method. +func (client *AutonomousDatabasesClient) BeginChangeDisasterRecoveryConfiguration(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body DisasterRecoveryConfigurationDetails, options *AutonomousDatabasesClientBeginChangeDisasterRecoveryConfigurationOptions) (*runtime.Poller[AutonomousDatabasesClientChangeDisasterRecoveryConfigurationResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.changeDisasterRecoveryConfiguration(ctx, resourceGroupName, autonomousdatabasename, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabasesClientChangeDisasterRecoveryConfigurationResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AutonomousDatabasesClientChangeDisasterRecoveryConfigurationResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// ChangeDisasterRecoveryConfiguration - Perform ChangeDisasterRecoveryConfiguration action on Autonomous Database +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +func (client *AutonomousDatabasesClient) changeDisasterRecoveryConfiguration(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body DisasterRecoveryConfigurationDetails, options *AutonomousDatabasesClientBeginChangeDisasterRecoveryConfigurationOptions) (*http.Response, error) { + var err error + const operationName = "AutonomousDatabasesClient.BeginChangeDisasterRecoveryConfiguration" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.changeDisasterRecoveryConfigurationCreateRequest(ctx, resourceGroupName, autonomousdatabasename, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// changeDisasterRecoveryConfigurationCreateRequest creates the ChangeDisasterRecoveryConfiguration request. +func (client *AutonomousDatabasesClient) changeDisasterRecoveryConfigurationCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body DisasterRecoveryConfigurationDetails, _ *AutonomousDatabasesClientBeginChangeDisasterRecoveryConfigurationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/changeDisasterRecoveryConfiguration" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if autonomousdatabasename == "" { + return nil, errors.New("parameter autonomousdatabasename cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{autonomousdatabasename}", url.PathEscape(autonomousdatabasename)) + 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-03-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 +} + // BeginCreateOrUpdate - Create a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - resource - Resource create parameters. @@ -59,8 +136,7 @@ func (client *AutonomousDatabasesClient) BeginCreateOrUpdate(ctx context.Context return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabasesClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -73,7 +149,7 @@ func (client *AutonomousDatabasesClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Create a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *AutonomousDatabasesClient) createOrUpdate(ctx context.Context, resourceGroupName string, autonomousdatabasename string, resource AutonomousDatabase, options *AutonomousDatabasesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginCreateOrUpdate" @@ -96,7 +172,7 @@ func (client *AutonomousDatabasesClient) createOrUpdate(ctx context.Context, res } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AutonomousDatabasesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, resource AutonomousDatabase, options *AutonomousDatabasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AutonomousDatabasesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, resource AutonomousDatabase, _ *AutonomousDatabasesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,9 +191,10 @@ func (client *AutonomousDatabasesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -127,7 +204,7 @@ func (client *AutonomousDatabasesClient) createOrUpdateCreateRequest(ctx context // BeginDelete - Delete a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - options - AutonomousDatabasesClientBeginDeleteOptions contains the optional parameters for the AutonomousDatabasesClient.BeginDelete @@ -139,8 +216,7 @@ func (client *AutonomousDatabasesClient) BeginDelete(ctx context.Context, resour return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabasesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -153,7 +229,7 @@ func (client *AutonomousDatabasesClient) BeginDelete(ctx context.Context, resour // Delete - Delete a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *AutonomousDatabasesClient) deleteOperation(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabasesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginDelete" @@ -176,7 +252,7 @@ func (client *AutonomousDatabasesClient) deleteOperation(ctx context.Context, re } // deleteCreateRequest creates the Delete request. -func (client *AutonomousDatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabasesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *AutonomousDatabasesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, _ *AutonomousDatabasesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -195,7 +271,7 @@ func (client *AutonomousDatabasesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -204,7 +280,7 @@ func (client *AutonomousDatabasesClient) deleteCreateRequest(ctx context.Context // BeginFailover - Perform failover action on Autonomous Database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - body - The content of the action request @@ -217,8 +293,7 @@ func (client *AutonomousDatabasesClient) BeginFailover(ctx context.Context, reso return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabasesClientFailoverResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -231,7 +306,7 @@ func (client *AutonomousDatabasesClient) BeginFailover(ctx context.Context, reso // Failover - Perform failover action on Autonomous Database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *AutonomousDatabasesClient) failover(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, options *AutonomousDatabasesClientBeginFailoverOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginFailover" @@ -254,7 +329,7 @@ func (client *AutonomousDatabasesClient) failover(ctx context.Context, resourceG } // failoverCreateRequest creates the Failover request. -func (client *AutonomousDatabasesClient) failoverCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, options *AutonomousDatabasesClientBeginFailoverOptions) (*policy.Request, error) { +func (client *AutonomousDatabasesClient) failoverCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, _ *AutonomousDatabasesClientBeginFailoverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/failover" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -273,9 +348,10 @@ func (client *AutonomousDatabasesClient) failoverCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -285,7 +361,7 @@ func (client *AutonomousDatabasesClient) failoverCreateRequest(ctx context.Conte // GenerateWallet - Generate wallet action on Autonomous Database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - body - The content of the action request @@ -314,7 +390,7 @@ func (client *AutonomousDatabasesClient) GenerateWallet(ctx context.Context, res } // generateWalletCreateRequest creates the GenerateWallet request. -func (client *AutonomousDatabasesClient) generateWalletCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body GenerateAutonomousDatabaseWalletDetails, options *AutonomousDatabasesClientGenerateWalletOptions) (*policy.Request, error) { +func (client *AutonomousDatabasesClient) generateWalletCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body GenerateAutonomousDatabaseWalletDetails, _ *AutonomousDatabasesClientGenerateWalletOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/generateWallet" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -333,9 +409,10 @@ func (client *AutonomousDatabasesClient) generateWalletCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -354,7 +431,7 @@ func (client *AutonomousDatabasesClient) generateWalletHandleResponse(resp *http // Get - Get a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - options - AutonomousDatabasesClientGetOptions contains the optional parameters for the AutonomousDatabasesClient.Get method. @@ -381,7 +458,7 @@ func (client *AutonomousDatabasesClient) Get(ctx context.Context, resourceGroupN } // getCreateRequest creates the Get request. -func (client *AutonomousDatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabasesClientGetOptions) (*policy.Request, error) { +func (client *AutonomousDatabasesClient) getCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, _ *AutonomousDatabasesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -400,7 +477,7 @@ func (client *AutonomousDatabasesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -417,7 +494,7 @@ func (client *AutonomousDatabasesClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - List AutonomousDatabase resources by resource group // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AutonomousDatabasesClientListByResourceGroupOptions contains the optional parameters for the AutonomousDatabasesClient.NewListByResourceGroupPager // method. @@ -445,7 +522,7 @@ func (client *AutonomousDatabasesClient) NewListByResourceGroupPager(resourceGro } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AutonomousDatabasesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AutonomousDatabasesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *AutonomousDatabasesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AutonomousDatabasesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -460,7 +537,7 @@ func (client *AutonomousDatabasesClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -477,7 +554,7 @@ func (client *AutonomousDatabasesClient) listByResourceGroupHandleResponse(resp // NewListBySubscriptionPager - List AutonomousDatabase resources by subscription ID // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - options - AutonomousDatabasesClientListBySubscriptionOptions contains the optional parameters for the AutonomousDatabasesClient.NewListBySubscriptionPager // method. func (client *AutonomousDatabasesClient) NewListBySubscriptionPager(options *AutonomousDatabasesClientListBySubscriptionOptions) *runtime.Pager[AutonomousDatabasesClientListBySubscriptionResponse] { @@ -504,7 +581,7 @@ func (client *AutonomousDatabasesClient) NewListBySubscriptionPager(options *Aut } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AutonomousDatabasesClient) listBySubscriptionCreateRequest(ctx context.Context, options *AutonomousDatabasesClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *AutonomousDatabasesClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AutonomousDatabasesClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/autonomousDatabases" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -515,7 +592,7 @@ func (client *AutonomousDatabasesClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -533,7 +610,7 @@ func (client *AutonomousDatabasesClient) listBySubscriptionHandleResponse(resp * // BeginRestore - Restores an Autonomous Database based on the provided request parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - body - The content of the action request @@ -546,8 +623,7 @@ func (client *AutonomousDatabasesClient) BeginRestore(ctx context.Context, resou return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabasesClientRestoreResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -560,7 +636,7 @@ func (client *AutonomousDatabasesClient) BeginRestore(ctx context.Context, resou // Restore - Restores an Autonomous Database based on the provided request parameters. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *AutonomousDatabasesClient) restore(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body RestoreAutonomousDatabaseDetails, options *AutonomousDatabasesClientBeginRestoreOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginRestore" @@ -583,7 +659,7 @@ func (client *AutonomousDatabasesClient) restore(ctx context.Context, resourceGr } // restoreCreateRequest creates the Restore request. -func (client *AutonomousDatabasesClient) restoreCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body RestoreAutonomousDatabaseDetails, options *AutonomousDatabasesClientBeginRestoreOptions) (*policy.Request, error) { +func (client *AutonomousDatabasesClient) restoreCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body RestoreAutonomousDatabaseDetails, _ *AutonomousDatabasesClientBeginRestoreOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/restore" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -602,9 +678,10 @@ func (client *AutonomousDatabasesClient) restoreCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -614,7 +691,7 @@ func (client *AutonomousDatabasesClient) restoreCreateRequest(ctx context.Contex // BeginShrink - This operation shrinks the current allocated storage down to the current actual used data storage. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - options - AutonomousDatabasesClientBeginShrinkOptions contains the optional parameters for the AutonomousDatabasesClient.BeginShrink @@ -626,8 +703,7 @@ func (client *AutonomousDatabasesClient) BeginShrink(ctx context.Context, resour return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabasesClientShrinkResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -640,7 +716,7 @@ func (client *AutonomousDatabasesClient) BeginShrink(ctx context.Context, resour // Shrink - This operation shrinks the current allocated storage down to the current actual used data storage. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *AutonomousDatabasesClient) shrink(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabasesClientBeginShrinkOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginShrink" @@ -663,7 +739,7 @@ func (client *AutonomousDatabasesClient) shrink(ctx context.Context, resourceGro } // shrinkCreateRequest creates the Shrink request. -func (client *AutonomousDatabasesClient) shrinkCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, options *AutonomousDatabasesClientBeginShrinkOptions) (*policy.Request, error) { +func (client *AutonomousDatabasesClient) shrinkCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, _ *AutonomousDatabasesClientBeginShrinkOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/shrink" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -682,7 +758,7 @@ func (client *AutonomousDatabasesClient) shrinkCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -691,7 +767,7 @@ func (client *AutonomousDatabasesClient) shrinkCreateRequest(ctx context.Context // BeginSwitchover - Perform switchover action on Autonomous Database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - body - The content of the action request @@ -704,8 +780,7 @@ func (client *AutonomousDatabasesClient) BeginSwitchover(ctx context.Context, re return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabasesClientSwitchoverResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -718,7 +793,7 @@ func (client *AutonomousDatabasesClient) BeginSwitchover(ctx context.Context, re // Switchover - Perform switchover action on Autonomous Database // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *AutonomousDatabasesClient) switchover(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, options *AutonomousDatabasesClientBeginSwitchoverOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginSwitchover" @@ -741,7 +816,7 @@ func (client *AutonomousDatabasesClient) switchover(ctx context.Context, resourc } // switchoverCreateRequest creates the Switchover request. -func (client *AutonomousDatabasesClient) switchoverCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, options *AutonomousDatabasesClientBeginSwitchoverOptions) (*policy.Request, error) { +func (client *AutonomousDatabasesClient) switchoverCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body PeerDbDetails, _ *AutonomousDatabasesClientBeginSwitchoverOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}/switchover" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -760,9 +835,10 @@ func (client *AutonomousDatabasesClient) switchoverCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -772,7 +848,7 @@ func (client *AutonomousDatabasesClient) switchoverCreateRequest(ctx context.Con // BeginUpdate - Update a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - autonomousdatabasename - The database name. // - properties - The resource properties to be updated. @@ -785,8 +861,7 @@ func (client *AutonomousDatabasesClient) BeginUpdate(ctx context.Context, resour return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AutonomousDatabasesClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -799,7 +874,7 @@ func (client *AutonomousDatabasesClient) BeginUpdate(ctx context.Context, resour // Update - Update a AutonomousDatabase // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *AutonomousDatabasesClient) update(ctx context.Context, resourceGroupName string, autonomousdatabasename string, properties AutonomousDatabaseUpdate, options *AutonomousDatabasesClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "AutonomousDatabasesClient.BeginUpdate" @@ -822,7 +897,7 @@ func (client *AutonomousDatabasesClient) update(ctx context.Context, resourceGro } // updateCreateRequest creates the Update request. -func (client *AutonomousDatabasesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, properties AutonomousDatabaseUpdate, options *AutonomousDatabasesClientBeginUpdateOptions) (*policy.Request, error) { +func (client *AutonomousDatabasesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, autonomousdatabasename string, properties AutonomousDatabaseUpdate, _ *AutonomousDatabasesClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/autonomousDatabases/{autonomousdatabasename}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -841,9 +916,10 @@ func (client *AutonomousDatabasesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client_example_test.go index 46bb0e233563..6869b4d4ebe9 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client_example_test.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabases_client_example_test.go @@ -1,250 +1,32 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights 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 armoracledatabase_test import ( "context" - "log" - - "time" - "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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" + "log" + "time" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_listBySubscription.json -func ExampleAutonomousDatabasesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutonomousDatabasesClient().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.AutonomousDatabaseListResult = armoracledatabase.AutonomousDatabaseListResult{ - // Value: []*armoracledatabase.AutonomousDatabase{ - // { - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleState("Succeeded")), - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_listByResourceGroup.json -func ExampleAutonomousDatabasesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutonomousDatabasesClient().NewListByResourceGroupPager("rg000", 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.AutonomousDatabaseListResult = armoracledatabase.AutonomousDatabaseListResult{ - // Value: []*armoracledatabase.AutonomousDatabase{ - // { - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleState("Succeeded")), - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_get.json -func ExampleAutonomousDatabasesClient_Get_autonomousDatabasesGet() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutonomousDatabasesClient().Get(ctx, "rg000", "databasedb1", 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.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleState("Succeeded")), - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_create.json -func ExampleAutonomousDatabasesClient_BeginCreateOrUpdate_autonomousDatabasesCreateOrUpdate() { +// Generated from example definition: 2025-03-01/autonomousDatabase_changeDisasterRecoveryConfiguration.json +func ExampleAutonomousDatabasesClient_BeginChangeDisasterRecoveryConfiguration() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewAutonomousDatabasesClient().BeginCreateOrUpdate(ctx, "rg000", "databasedb1", armoracledatabase.AutonomousDatabase{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "tagK1": to.Ptr("tagV1"), - }, - Properties: &armoracledatabase.AutonomousDatabaseProperties{ - AdminPassword: to.Ptr("********"), - CharacterSet: to.Ptr("AL32UTF8"), - ComputeCount: to.Ptr[float32](2), - ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - DataStorageSizeInTbs: to.Ptr[int32](1), - DbVersion: to.Ptr("18.4.0.0"), - DisplayName: to.Ptr("example_autonomous_databasedb1"), - NcharacterSet: to.Ptr("AL16UTF16"), - SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - }, + poller, err := clientFactory.NewAutonomousDatabasesClient().BeginChangeDisasterRecoveryConfiguration(ctx, "rg000", "databasedb1", armoracledatabase.DisasterRecoveryConfigurationDetails{ + DisasterRecoveryType: to.Ptr(armoracledatabase.DisasterRecoveryTypeAdg), + IsReplicateAutomaticBackups: to.Ptr(false), }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -256,226 +38,71 @@ func ExampleAutonomousDatabasesClient_BeginCreateOrUpdate_autonomousDatabasesCre // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleState("Succeeded")), - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, + // res = armoracledatabase.AutonomousDatabasesClientChangeDisasterRecoveryConfigurationResponse{ + // AutonomousDatabase: &armoracledatabase.AutonomousDatabase{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), + // Type: to.Ptr("Oracle.Database/autonomousDatabases"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagK1": to.Ptr("tagV1"), // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseClone_create.json -func ExampleAutonomousDatabasesClient_BeginCreateOrUpdate_autonomousDatabasesCreateOrUpdateClone() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabasesClient().BeginCreateOrUpdate(ctx, "rg000", "databasedb1", armoracledatabase.AutonomousDatabase{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "tagK1": to.Ptr("tagV1"), - }, - Properties: &armoracledatabase.AutonomousDatabaseCloneProperties{ - AdminPassword: to.Ptr("********"), - CharacterSet: to.Ptr("AL32UTF8"), - ComputeCount: to.Ptr[float32](2), - ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeClone), - DataStorageSizeInTbs: to.Ptr[int32](1), - DisplayName: to.Ptr("example_autonomous_databasedb1_clone"), - NcharacterSet: to.Ptr("AL16UTF16"), - SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - CloneType: to.Ptr(armoracledatabase.CloneTypeFull), - SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - }, - }, 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.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseCloneProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1Clone"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeClone), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleState("Succeeded")), - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // CloneType: to.Ptr(armoracledatabase.CloneTypeFull), - // SourceID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), + // Properties: &armoracledatabase.AutonomousDatabaseProperties{ + // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), + // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), + // CharacterSet: to.Ptr("AL32UTF8"), + // NcharacterSet: to.Ptr("AL16UTF16"), + // ComputeCount: to.Ptr[float32](2), + // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), + // CPUCoreCount: to.Ptr[int32](1), + // DataStorageSizeInGbs: to.Ptr[int32](1024), + // DataStorageSizeInTbs: to.Ptr[int32](1), + // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), + // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), + // DbVersion: to.Ptr("19c"), + // DisplayName: to.Ptr("example_autonomous_databasedb1"), + // IsAutoScalingEnabled: to.Ptr(false), + // IsAutoScalingForStorageEnabled: to.Ptr(false), + // IsLocalDataGuardEnabled: to.Ptr(false), + // IsRemoteDataGuardEnabled: to.Ptr(true), + // TimeDisasterRecoveryRoleChanged: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-07-30T18:22:10.970Z"); return t}()), + // TimeDataGuardRoleChanged: to.Ptr("2024-07-30T18:22:10.970Z"), + // TimeLocalDataGuardEnabled: to.Ptr("2024-07-04T01:02:36.782Z"), + // LocalDisasterRecoveryType: to.Ptr(armoracledatabase.DisasterRecoveryTypeBackupBased), + // RemoteDisasterRecoveryConfiguration: &armoracledatabase.DisasterRecoveryConfigurationDetails{ + // DisasterRecoveryType: to.Ptr(armoracledatabase.DisasterRecoveryTypeBackupBased), + // IsReplicateAutomaticBackups: to.Ptr(false), + // }, + // Role: to.Ptr(armoracledatabase.RoleTypeBackupCopy), + // PeerDbIDs: []*string{ + // to.Ptr("ocid1.bbbbb"), + // }, + // IsMtlsConnectionRequired: to.Ptr(true), + // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), + // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateUpdating), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateProvisioning), + // OciURL: to.Ptr("https://fake"), + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-20T21:20:08.070Z"); return t}()), + // Ocid: to.Ptr("ocid1..aaaaa"), + // WhitelistedIPs: []*string{ + // to.Ptr("1.1.1.1"), + // to.Ptr("1.1.1.0/24"), + // to.Ptr("1.1.2.25"), + // }, // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_patch.json -func ExampleAutonomousDatabasesClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabasesClient().BeginUpdate(ctx, "rg000", "databasedb1", armoracledatabase.AutonomousDatabaseUpdate{}, 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.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleState("Succeeded")), - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_delete.json -func ExampleAutonomousDatabasesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabasesClient().BeginDelete(ctx, "rg000", "databasedb1", 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/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_failover.json -func ExampleAutonomousDatabasesClient_BeginFailover_autonomousDatabasesFailover() { +// Generated from example definition: 2025-03-01/autonomousDatabase_failover.json +func ExampleAutonomousDatabasesClient_BeginFailover() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -492,62 +119,65 @@ func ExampleAutonomousDatabasesClient_BeginFailover_autonomousDatabasesFailover( // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(true), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateUpdating), - // LocalAdgAutoFailoverMaxDataLossLimit: to.Ptr[int32](300), - // LocalDisasterRecoveryType: to.Ptr(armoracledatabase.DisasterRecoveryTypeAdg), - // LocalStandbyDb: &armoracledatabase.AutonomousDatabaseStandbySummary{ - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateRoleChangeInProgress), + // res = armoracledatabase.AutonomousDatabasesClientFailoverResponse{ + // AutonomousDatabase: &armoracledatabase.AutonomousDatabase{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), + // Type: to.Ptr("Oracle.Database/autonomousDatabases"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagK1": to.Ptr("tagV1"), // }, - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Role: to.Ptr(armoracledatabase.RoleTypePrimary), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // TimeLocalDataGuardEnabled: to.Ptr("2024-02-28T19:03:43.714Z"), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, + // Properties: &armoracledatabase.AutonomousDatabaseProperties{ + // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), + // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), + // CharacterSet: to.Ptr("AL32UTF8"), + // NcharacterSet: to.Ptr("AL16UTF16"), + // ComputeCount: to.Ptr[float32](2), + // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), + // CPUCoreCount: to.Ptr[int32](1), + // DataStorageSizeInGbs: to.Ptr[int32](1024), + // DataStorageSizeInTbs: to.Ptr[int32](1), + // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), + // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), + // DbVersion: to.Ptr("18.4.0.0"), + // DisplayName: to.Ptr("example_autonomous_databasedb1"), + // IsAutoScalingEnabled: to.Ptr(false), + // IsAutoScalingForStorageEnabled: to.Ptr(false), + // IsLocalDataGuardEnabled: to.Ptr(true), + // TimeLocalDataGuardEnabled: to.Ptr("2024-02-28T19:03:43.714Z"), + // LocalDisasterRecoveryType: to.Ptr(armoracledatabase.DisasterRecoveryTypeAdg), + // LocalAdgAutoFailoverMaxDataLossLimit: to.Ptr[int32](300), + // Role: to.Ptr(armoracledatabase.RoleTypePrimary), + // LocalStandbyDb: &armoracledatabase.AutonomousDatabaseStandbySummary{ + // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateRoleChangeInProgress), + // }, + // IsMtlsConnectionRequired: to.Ptr(true), + // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), + // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateUpdating), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateProvisioning), + // OciURL: to.Ptr("https://fake"), + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), + // Ocid: to.Ptr("ocid1..aaaaa"), + // WhitelistedIPs: []*string{ + // to.Ptr("1.1.1.1"), + // to.Ptr("1.1.1.0/24"), + // to.Ptr("1.1.2.25"), + // }, // }, - // } + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_generateWallet.json +// Generated from example definition: 2025-03-01/autonomousDatabase_generateWallet.json func ExampleAutonomousDatabasesClient_GenerateWallet() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -562,19 +192,21 @@ func ExampleAutonomousDatabasesClient_GenerateWallet() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutonomousDatabaseWalletFile = armoracledatabase.AutonomousDatabaseWalletFile{ - // WalletFiles: to.Ptr("testEncodedFiles"), + // res = armoracledatabase.AutonomousDatabasesClientGenerateWalletResponse{ + // AutonomousDatabaseWalletFile: &armoracledatabase.AutonomousDatabaseWalletFile{ + // WalletFiles: to.Ptr("testEncodedFiles"), + // }, // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_restore.json -func ExampleAutonomousDatabasesClient_BeginRestore_autonomousDatabasesRestore() { +// Generated from example definition: 2025-03-01/autonomousDatabase_restore.json +func ExampleAutonomousDatabasesClient_BeginRestore() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -591,134 +223,66 @@ func ExampleAutonomousDatabasesClient_BeginRestore_autonomousDatabasesRestore() // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // BackupRetentionPeriodInDays: to.Ptr[int32](60), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr(""), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateRestoreInProgress), - // LongTermBackupSchedule: &armoracledatabase.LongTermBackUpScheduleDetails{ - // RepeatCadence: to.Ptr(armoracledatabase.RepeatCadenceTypeWeekly), - // RetentionPeriodInDays: to.Ptr[int32](365), - // TimeOfBackup: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-21T21:03:41.309Z"); return t}()), + // res = armoracledatabase.AutonomousDatabasesClientRestoreResponse{ + // AutonomousDatabase: &armoracledatabase.AutonomousDatabase{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), + // Type: to.Ptr("Oracle.Database/autonomousDatabases"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagK1": to.Ptr("tagV1"), // }, - // NcharacterSet: to.Ptr("AL16UTF16"), - // NextLongTermBackupTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-24T21:03:41.000Z"); return t}()), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, + // Properties: &armoracledatabase.AutonomousDatabaseProperties{ + // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), + // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), + // BackupRetentionPeriodInDays: to.Ptr[int32](60), + // CharacterSet: to.Ptr("AL32UTF8"), + // NcharacterSet: to.Ptr("AL16UTF16"), + // ComputeCount: to.Ptr[float32](2), + // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), + // CPUCoreCount: to.Ptr[int32](1), + // DataStorageSizeInGbs: to.Ptr[int32](1024), + // DataStorageSizeInTbs: to.Ptr[int32](1), + // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), + // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), + // DbVersion: to.Ptr("18.4.0.0"), + // DisplayName: to.Ptr("example_autonomous_databasedb1"), + // IsAutoScalingEnabled: to.Ptr(false), + // IsAutoScalingForStorageEnabled: to.Ptr(false), + // IsLocalDataGuardEnabled: to.Ptr(false), + // IsMtlsConnectionRequired: to.Ptr(true), + // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), + // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateRestoreInProgress), + // LifecycleDetails: to.Ptr(""), + // NextLongTermBackupTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-24T21:03:41.000Z"); return t}()), + // LongTermBackupSchedule: &armoracledatabase.LongTermBackUpScheduleDetails{ + // RepeatCadence: to.Ptr(armoracledatabase.RepeatCadenceTypeWeekly), + // RetentionPeriodInDays: to.Ptr[int32](365), + // TimeOfBackup: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-21T21:03:41.309Z"); return t}()), + // }, + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), + // OciURL: to.Ptr("https://fake"), + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), + // Ocid: to.Ptr("ocid1..aaaaa"), + // WhitelistedIPs: []*string{ + // to.Ptr("1.1.1.1"), + // to.Ptr("1.1.1.0/24"), + // to.Ptr("1.1.2.25"), + // }, // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_shrink.json -func ExampleAutonomousDatabasesClient_BeginShrink() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAutonomousDatabasesClient().BeginShrink(ctx, "rg000", "databasedb1", 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.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // BackupRetentionPeriodInDays: to.Ptr[int32](90), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleDetails: to.Ptr(""), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateScaleInProgress), - // LongTermBackupSchedule: &armoracledatabase.LongTermBackUpScheduleDetails{ - // RepeatCadence: to.Ptr(armoracledatabase.RepeatCadenceTypeWeekly), - // RetentionPeriodInDays: to.Ptr[int32](365), - // TimeOfBackup: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-21T21:03:41.309Z"); return t}()), - // }, - // NcharacterSet: to.Ptr("AL16UTF16"), - // NextLongTermBackupTimeStamp: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-04-24T21:03:41.000Z"); return t}()), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, - // }, - // } + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabase_switchover.json -func ExampleAutonomousDatabasesClient_BeginSwitchover_autonomousDatabasesSwitchover() { +// Generated from example definition: 2025-03-01/autonomousDatabase_switchover.json +func ExampleAutonomousDatabasesClient_BeginSwitchover() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -735,49 +299,52 @@ func ExampleAutonomousDatabasesClient_BeginSwitchover_autonomousDatabasesSwitcho // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutonomousDatabase = armoracledatabase.AutonomousDatabase{ - // Type: to.Ptr("Oracle.Database/autonomousDatabases"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.AutonomousDatabaseProperties{ - // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), - // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), - // CharacterSet: to.Ptr("AL32UTF8"), - // ComputeCount: to.Ptr[float32](2), - // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), - // CPUCoreCount: to.Ptr[int32](1), - // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), - // DataStorageSizeInGbs: to.Ptr[int32](1024), - // DataStorageSizeInTbs: to.Ptr[int32](1), - // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), - // DbVersion: to.Ptr("18.4.0.0"), - // DisplayName: to.Ptr("example_autonomous_databasedb1"), - // IsAutoScalingEnabled: to.Ptr(false), - // IsAutoScalingForStorageEnabled: to.Ptr(false), - // IsLocalDataGuardEnabled: to.Ptr(false), - // IsMtlsConnectionRequired: to.Ptr(true), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateUpdating), - // LocalDisasterRecoveryType: to.Ptr(armoracledatabase.DisasterRecoveryTypeBackupBased), - // LocalStandbyDb: &armoracledatabase.AutonomousDatabaseStandbySummary{ - // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateRoleChangeInProgress), + // res = armoracledatabase.AutonomousDatabasesClientSwitchoverResponse{ + // AutonomousDatabase: &armoracledatabase.AutonomousDatabase{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), + // Type: to.Ptr("Oracle.Database/autonomousDatabases"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagK1": to.Ptr("tagV1"), // }, - // NcharacterSet: to.Ptr("AL16UTF16"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Role: to.Ptr(armoracledatabase.RoleTypePrimary), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), - // TimeOfLastSwitchover: to.Ptr("2024-02-27T18:37:08.069Z"), - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // WhitelistedIPs: []*string{ - // to.Ptr("1.1.1.1"), - // to.Ptr("1.1.1.0/24"), - // to.Ptr("1.1.2.25")}, + // Properties: &armoracledatabase.AutonomousDatabaseProperties{ + // AutonomousDatabaseID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/autonomousDatabases/databasedb1"), + // AutonomousMaintenanceScheduleType: to.Ptr(armoracledatabase.AutonomousMaintenanceScheduleTypeRegular), + // CharacterSet: to.Ptr("AL32UTF8"), + // NcharacterSet: to.Ptr("AL16UTF16"), + // ComputeCount: to.Ptr[float32](2), + // ComputeModel: to.Ptr(armoracledatabase.ComputeModelECPU), + // CPUCoreCount: to.Ptr[int32](1), + // DataStorageSizeInGbs: to.Ptr[int32](1024), + // DataStorageSizeInTbs: to.Ptr[int32](1), + // DatabaseEdition: to.Ptr(armoracledatabase.DatabaseEditionTypeEnterpriseEdition), + // DataBaseType: to.Ptr(armoracledatabase.DataBaseTypeRegular), + // DbVersion: to.Ptr("18.4.0.0"), + // DisplayName: to.Ptr("example_autonomous_databasedb1"), + // IsAutoScalingEnabled: to.Ptr(false), + // IsAutoScalingForStorageEnabled: to.Ptr(false), + // IsLocalDataGuardEnabled: to.Ptr(false), + // LocalDisasterRecoveryType: to.Ptr(armoracledatabase.DisasterRecoveryTypeBackupBased), + // Role: to.Ptr(armoracledatabase.RoleTypePrimary), + // LocalStandbyDb: &armoracledatabase.AutonomousDatabaseStandbySummary{ + // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateRoleChangeInProgress), + // }, + // IsMtlsConnectionRequired: to.Ptr(true), + // LicenseModel: to.Ptr(armoracledatabase.LicenseModelBringYourOwnLicense), + // LifecycleState: to.Ptr(armoracledatabase.AutonomousDatabaseLifecycleStateUpdating), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateProvisioning), + // OciURL: to.Ptr("https://fake"), + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-01-09T20:44:09.466Z"); return t}()), + // TimeOfLastSwitchover: to.Ptr("2024-02-27T18:37:08.069Z"), + // Ocid: to.Ptr("ocid1..aaaaa"), + // WhitelistedIPs: []*string{ + // to.Ptr("1.1.1.1"), + // to.Ptr("1.1.1.0/24"), + // to.Ptr("1.1.2.25"), + // }, // }, - // } + // }, + // } } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client.go index f0a5ec4d4ac7..6b677bacae70 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_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 armoracledatabase @@ -46,7 +42,7 @@ func NewAutonomousDatabaseVersionsClient(subscriptionID string, credential azcor // Get - Get a AutonomousDbVersion // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - autonomousdbversionsname - AutonomousDbVersion name // - options - AutonomousDatabaseVersionsClientGetOptions contains the optional parameters for the AutonomousDatabaseVersionsClient.Get @@ -74,7 +70,7 @@ func (client *AutonomousDatabaseVersionsClient) Get(ctx context.Context, locatio } // getCreateRequest creates the Get request. -func (client *AutonomousDatabaseVersionsClient) getCreateRequest(ctx context.Context, location string, autonomousdbversionsname string, options *AutonomousDatabaseVersionsClientGetOptions) (*policy.Request, error) { +func (client *AutonomousDatabaseVersionsClient) getCreateRequest(ctx context.Context, location string, autonomousdbversionsname string, _ *AutonomousDatabaseVersionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDbVersions/{autonomousdbversionsname}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -93,7 +89,7 @@ func (client *AutonomousDatabaseVersionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -108,9 +104,9 @@ func (client *AutonomousDatabaseVersionsClient) getHandleResponse(resp *http.Res return result, nil } -// NewListByLocationPager - List AutonomousDbVersion resources by Location +// NewListByLocationPager - List AutonomousDbVersion resources by SubscriptionLocationResource // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - options - AutonomousDatabaseVersionsClientListByLocationOptions contains the optional parameters for the AutonomousDatabaseVersionsClient.NewListByLocationPager // method. @@ -138,7 +134,7 @@ func (client *AutonomousDatabaseVersionsClient) NewListByLocationPager(location } // listByLocationCreateRequest creates the ListByLocation request. -func (client *AutonomousDatabaseVersionsClient) listByLocationCreateRequest(ctx context.Context, location string, options *AutonomousDatabaseVersionsClientListByLocationOptions) (*policy.Request, error) { +func (client *AutonomousDatabaseVersionsClient) listByLocationCreateRequest(ctx context.Context, location string, _ *AutonomousDatabaseVersionsClientListByLocationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/autonomousDbVersions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -153,7 +149,7 @@ func (client *AutonomousDatabaseVersionsClient) listByLocationCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client_example_test.go deleted file mode 100644 index b1fecf02bc8f..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/autonomousdatabaseversions_client_example_test.go +++ /dev/null @@ -1,80 +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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseVersion_listByLocation.json -func ExampleAutonomousDatabaseVersionsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutonomousDatabaseVersionsClient().NewListByLocationPager("eastus", 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.AutonomousDbVersionListResult = armoracledatabase.AutonomousDbVersionListResult{ - // Value: []*armoracledatabase.AutonomousDbVersion{ - // { - // Type: to.Ptr("Oracle.Database/locations/autonomousDbVersions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDbVersions/18.4.0.0"), - // Properties: &armoracledatabase.AutonomousDbVersionProperties{ - // Version: to.Ptr("18.4.0.0"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/autonomousDatabaseVersion_get.json -func ExampleAutonomousDatabaseVersionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutonomousDatabaseVersionsClient().Get(ctx, "eastus", "18.4.0.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.AutonomousDbVersion = armoracledatabase.AutonomousDbVersion{ - // Type: to.Ptr("Oracle.Database/locations/autonomousDbVersions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/locations/eastus/autonomousDbVersions/18.4.0.0"), - // Properties: &armoracledatabase.AutonomousDbVersionProperties{ - // Version: to.Ptr("18.4.0.0"), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/autorest.md b/sdk/resourcemanager/oracledatabase/armoracledatabase/autorest.md deleted file mode 100644 index ed61e73ab132..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/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/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.0.0 -tag: package-2023-09-01 -``` \ No newline at end of file diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/build.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/build.go deleted file mode 100644 index 4aad56d9bf48..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/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/oracledatabase/armoracledatabase - -package armoracledatabase diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/client_factory.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/client_factory.go index 30688bbe83a5..57afa1a83210 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/client_factory.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/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 armoracledatabase @@ -132,6 +128,46 @@ func (c *ClientFactory) NewDbSystemShapesClient() *DbSystemShapesClient { } } +// NewExadbVMClustersClient creates a new instance of ExadbVMClustersClient. +func (c *ClientFactory) NewExadbVMClustersClient() *ExadbVMClustersClient { + return &ExadbVMClustersClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewExascaleDbNodesClient creates a new instance of ExascaleDbNodesClient. +func (c *ClientFactory) NewExascaleDbNodesClient() *ExascaleDbNodesClient { + return &ExascaleDbNodesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewExascaleDbStorageVaultsClient creates a new instance of ExascaleDbStorageVaultsClient. +func (c *ClientFactory) NewExascaleDbStorageVaultsClient() *ExascaleDbStorageVaultsClient { + return &ExascaleDbStorageVaultsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewFlexComponentsClient creates a new instance of FlexComponentsClient. +func (c *ClientFactory) NewFlexComponentsClient() *FlexComponentsClient { + return &FlexComponentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewGiMinorVersionsClient creates a new instance of GiMinorVersionsClient. +func (c *ClientFactory) NewGiMinorVersionsClient() *GiMinorVersionsClient { + return &GiMinorVersionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewGiVersionsClient creates a new instance of GiVersionsClient. func (c *ClientFactory) NewGiVersionsClient() *GiVersionsClient { return &GiVersionsClient{ diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client.go index 0360d1e588a8..912fdc0b1e4f 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_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 armoracledatabase @@ -46,7 +42,7 @@ func NewCloudExadataInfrastructuresClient(subscriptionID string, credential azco // BeginAddStorageCapacity - Perform add storage capacity on exadata infra // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name // - options - CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginAddStorageCapacity @@ -58,8 +54,7 @@ func (client *CloudExadataInfrastructuresClient) BeginAddStorageCapacity(ctx con return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudExadataInfrastructuresClientAddStorageCapacityResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -72,7 +67,7 @@ func (client *CloudExadataInfrastructuresClient) BeginAddStorageCapacity(ctx con // AddStorageCapacity - Perform add storage capacity on exadata infra // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *CloudExadataInfrastructuresClient) addStorageCapacity(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions) (*http.Response, error) { var err error const operationName = "CloudExadataInfrastructuresClient.BeginAddStorageCapacity" @@ -95,7 +90,7 @@ func (client *CloudExadataInfrastructuresClient) addStorageCapacity(ctx context. } // addStorageCapacityCreateRequest creates the AddStorageCapacity request. -func (client *CloudExadataInfrastructuresClient) addStorageCapacityCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions) (*policy.Request, error) { +func (client *CloudExadataInfrastructuresClient) addStorageCapacityCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, _ *CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}/addStorageCapacity" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -114,7 +109,7 @@ func (client *CloudExadataInfrastructuresClient) addStorageCapacityCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -123,7 +118,7 @@ func (client *CloudExadataInfrastructuresClient) addStorageCapacityCreateRequest // BeginCreateOrUpdate - Create a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name // - resource - Resource create parameters. @@ -136,8 +131,7 @@ func (client *CloudExadataInfrastructuresClient) BeginCreateOrUpdate(ctx context return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudExadataInfrastructuresClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -150,7 +144,7 @@ func (client *CloudExadataInfrastructuresClient) BeginCreateOrUpdate(ctx context // CreateOrUpdate - Create a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *CloudExadataInfrastructuresClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, resource CloudExadataInfrastructure, options *CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CloudExadataInfrastructuresClient.BeginCreateOrUpdate" @@ -173,7 +167,7 @@ func (client *CloudExadataInfrastructuresClient) createOrUpdate(ctx context.Cont } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *CloudExadataInfrastructuresClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, resource CloudExadataInfrastructure, options *CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *CloudExadataInfrastructuresClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, resource CloudExadataInfrastructure, _ *CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -192,9 +186,10 @@ func (client *CloudExadataInfrastructuresClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -204,7 +199,7 @@ func (client *CloudExadataInfrastructuresClient) createOrUpdateCreateRequest(ctx // BeginDelete - Delete a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name // - options - CloudExadataInfrastructuresClientBeginDeleteOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginDelete @@ -216,8 +211,7 @@ func (client *CloudExadataInfrastructuresClient) BeginDelete(ctx context.Context return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudExadataInfrastructuresClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -230,7 +224,7 @@ func (client *CloudExadataInfrastructuresClient) BeginDelete(ctx context.Context // Delete - Delete a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *CloudExadataInfrastructuresClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CloudExadataInfrastructuresClient.BeginDelete" @@ -253,7 +247,7 @@ func (client *CloudExadataInfrastructuresClient) deleteOperation(ctx context.Con } // deleteCreateRequest creates the Delete request. -func (client *CloudExadataInfrastructuresClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientBeginDeleteOptions) (*policy.Request, error) { +func (client *CloudExadataInfrastructuresClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, _ *CloudExadataInfrastructuresClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -272,7 +266,7 @@ func (client *CloudExadataInfrastructuresClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,7 +275,7 @@ func (client *CloudExadataInfrastructuresClient) deleteCreateRequest(ctx context // Get - Get a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name // - options - CloudExadataInfrastructuresClientGetOptions contains the optional parameters for the CloudExadataInfrastructuresClient.Get @@ -309,7 +303,7 @@ func (client *CloudExadataInfrastructuresClient) Get(ctx context.Context, resour } // getCreateRequest creates the Get request. -func (client *CloudExadataInfrastructuresClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *CloudExadataInfrastructuresClientGetOptions) (*policy.Request, error) { +func (client *CloudExadataInfrastructuresClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, _ *CloudExadataInfrastructuresClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -328,7 +322,7 @@ func (client *CloudExadataInfrastructuresClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -345,7 +339,7 @@ func (client *CloudExadataInfrastructuresClient) getHandleResponse(resp *http.Re // NewListByResourceGroupPager - List CloudExadataInfrastructure resources by resource group // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CloudExadataInfrastructuresClientListByResourceGroupOptions contains the optional parameters for the CloudExadataInfrastructuresClient.NewListByResourceGroupPager // method. @@ -373,7 +367,7 @@ func (client *CloudExadataInfrastructuresClient) NewListByResourceGroupPager(res } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *CloudExadataInfrastructuresClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CloudExadataInfrastructuresClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *CloudExadataInfrastructuresClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *CloudExadataInfrastructuresClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -388,7 +382,7 @@ func (client *CloudExadataInfrastructuresClient) listByResourceGroupCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -405,7 +399,7 @@ func (client *CloudExadataInfrastructuresClient) listByResourceGroupHandleRespon // NewListBySubscriptionPager - List CloudExadataInfrastructure resources by subscription ID // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - options - CloudExadataInfrastructuresClientListBySubscriptionOptions contains the optional parameters for the CloudExadataInfrastructuresClient.NewListBySubscriptionPager // method. func (client *CloudExadataInfrastructuresClient) NewListBySubscriptionPager(options *CloudExadataInfrastructuresClientListBySubscriptionOptions) *runtime.Pager[CloudExadataInfrastructuresClientListBySubscriptionResponse] { @@ -432,7 +426,7 @@ func (client *CloudExadataInfrastructuresClient) NewListBySubscriptionPager(opti } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *CloudExadataInfrastructuresClient) listBySubscriptionCreateRequest(ctx context.Context, options *CloudExadataInfrastructuresClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *CloudExadataInfrastructuresClient) listBySubscriptionCreateRequest(ctx context.Context, _ *CloudExadataInfrastructuresClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/cloudExadataInfrastructures" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -443,7 +437,7 @@ func (client *CloudExadataInfrastructuresClient) listBySubscriptionCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -461,7 +455,7 @@ func (client *CloudExadataInfrastructuresClient) listBySubscriptionHandleRespons // BeginUpdate - Update a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name // - properties - The resource properties to be updated. @@ -474,8 +468,7 @@ func (client *CloudExadataInfrastructuresClient) BeginUpdate(ctx context.Context return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudExadataInfrastructuresClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -488,7 +481,7 @@ func (client *CloudExadataInfrastructuresClient) BeginUpdate(ctx context.Context // Update - Update a CloudExadataInfrastructure // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *CloudExadataInfrastructuresClient) update(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, properties CloudExadataInfrastructureUpdate, options *CloudExadataInfrastructuresClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CloudExadataInfrastructuresClient.BeginUpdate" @@ -511,7 +504,7 @@ func (client *CloudExadataInfrastructuresClient) update(ctx context.Context, res } // updateCreateRequest creates the Update request. -func (client *CloudExadataInfrastructuresClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, properties CloudExadataInfrastructureUpdate, options *CloudExadataInfrastructuresClientBeginUpdateOptions) (*policy.Request, error) { +func (client *CloudExadataInfrastructuresClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, properties CloudExadataInfrastructureUpdate, _ *CloudExadataInfrastructuresClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -530,9 +523,10 @@ func (client *CloudExadataInfrastructuresClient) updateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client_example_test.go index 1e2370003e56..58039f68559e 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client_example_test.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudexadatainfrastructures_client_example_test.go @@ -1,331 +1,28 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armoracledatabase_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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_listBySubscription.json -func ExampleCloudExadataInfrastructuresClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudExadataInfrastructuresClient().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.CloudExadataInfrastructureListResult = armoracledatabase.CloudExadataInfrastructureListResult{ - // Value: []*armoracledatabase.CloudExadataInfrastructure{ - // { - // Type: to.Ptr("Oracle.Database/cloudExadataInfrastructures"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - // ActivatedStorageCount: to.Ptr[int32](1), - // AdditionalStorageCount: to.Ptr[int32](1), - // AvailableStorageSizeInGbs: to.Ptr[int32](1000), - // ComputeCount: to.Ptr[int32](100), - // CPUCount: to.Ptr[int32](10), - // CustomerContacts: []*armoracledatabase.CustomerContact{ - // { - // Email: to.Ptr("noreply@oracle.com"), - // }}, - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](10), - // DbServerVersion: to.Ptr("19.0.0.0"), - // DisplayName: to.Ptr("infra 1"), - // EstimatedPatchingTime: &armoracledatabase.EstimatedPatchingTime{ - // EstimatedDbServerPatchingTime: to.Ptr[int32](3000), - // EstimatedNetworkSwitchesPatchingTime: to.Ptr[int32](3000), - // EstimatedStorageServerPatchingTime: to.Ptr[int32](3000), - // TotalEstimatedPatchingTime: to.Ptr[int32](3000), - // }, - // LastMaintenanceRunID: to.Ptr("ocid1..aaaaa"), - // LifecycleDetails: to.Ptr("none"), - // MaintenanceWindow: &armoracledatabase.MaintenanceWindow{ - // CustomActionTimeoutInMins: to.Ptr[int32](120), - // DaysOfWeek: []*armoracledatabase.DayOfWeek{ - // { - // Name: to.Ptr(armoracledatabase.DayOfWeekNameMonday), - // }}, - // HoursOfDay: []*int32{ - // to.Ptr[int32](0)}, - // IsCustomActionTimeoutEnabled: to.Ptr(true), - // IsMonthlyPatchingEnabled: to.Ptr(true), - // LeadTimeInWeeks: to.Ptr[int32](0), - // Months: []*armoracledatabase.Month{ - // { - // Name: to.Ptr(armoracledatabase.MonthNameJanuary), - // }}, - // PatchingMode: to.Ptr(armoracledatabase.PatchingModeRolling), - // Preference: to.Ptr(armoracledatabase.PreferenceNoPreference), - // WeeksOfMonth: []*int32{ - // to.Ptr[int32](0)}, - // }, - // MaxCPUCount: to.Ptr[int32](100), - // MaxDataStorageInTbs: to.Ptr[float64](1000), - // MaxDbNodeStorageSizeInGbs: to.Ptr[int32](10), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // MemorySizeInGbs: to.Ptr[int32](100), - // MonthlyDbServerVersion: to.Ptr("aaaa"), - // MonthlyStorageServerVersion: to.Ptr("aaaa"), - // NextMaintenanceRunID: to.Ptr("ocid1..aaaaaa"), - // OciURL: to.Ptr("https://url"), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Shape: to.Ptr("EXADATA.X9M"), - // StorageCount: to.Ptr[int32](10), - // StorageServerVersion: to.Ptr("0.0"), - // TimeCreated: to.Ptr("2023-02-01T01:01:00"), - // TotalStorageSizeInGbs: to.Ptr[int32](1000), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_listByResourceGroup.json -func ExampleCloudExadataInfrastructuresClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudExadataInfrastructuresClient().NewListByResourceGroupPager("rg000", 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.CloudExadataInfrastructureListResult = armoracledatabase.CloudExadataInfrastructureListResult{ - // Value: []*armoracledatabase.CloudExadataInfrastructure{ - // { - // Type: to.Ptr("Oracle.Database/cloudExadataInfrastructures"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - // ActivatedStorageCount: to.Ptr[int32](1), - // AdditionalStorageCount: to.Ptr[int32](1), - // AvailableStorageSizeInGbs: to.Ptr[int32](1000), - // ComputeCount: to.Ptr[int32](100), - // CPUCount: to.Ptr[int32](10), - // CustomerContacts: []*armoracledatabase.CustomerContact{ - // { - // Email: to.Ptr("noreply@oracle.com"), - // }}, - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](10), - // DbServerVersion: to.Ptr("19.0.0.0"), - // DisplayName: to.Ptr("infra 1"), - // EstimatedPatchingTime: &armoracledatabase.EstimatedPatchingTime{ - // EstimatedDbServerPatchingTime: to.Ptr[int32](3000), - // EstimatedNetworkSwitchesPatchingTime: to.Ptr[int32](3000), - // EstimatedStorageServerPatchingTime: to.Ptr[int32](3000), - // TotalEstimatedPatchingTime: to.Ptr[int32](3000), - // }, - // LastMaintenanceRunID: to.Ptr("ocid1..aaaaa"), - // LifecycleDetails: to.Ptr("none"), - // MaintenanceWindow: &armoracledatabase.MaintenanceWindow{ - // CustomActionTimeoutInMins: to.Ptr[int32](120), - // DaysOfWeek: []*armoracledatabase.DayOfWeek{ - // { - // Name: to.Ptr(armoracledatabase.DayOfWeekNameMonday), - // }}, - // HoursOfDay: []*int32{ - // to.Ptr[int32](0)}, - // IsCustomActionTimeoutEnabled: to.Ptr(true), - // IsMonthlyPatchingEnabled: to.Ptr(true), - // LeadTimeInWeeks: to.Ptr[int32](0), - // Months: []*armoracledatabase.Month{ - // { - // Name: to.Ptr(armoracledatabase.MonthNameJanuary), - // }}, - // PatchingMode: to.Ptr(armoracledatabase.PatchingModeRolling), - // Preference: to.Ptr(armoracledatabase.PreferenceNoPreference), - // WeeksOfMonth: []*int32{ - // to.Ptr[int32](0)}, - // }, - // MaxCPUCount: to.Ptr[int32](100), - // MaxDataStorageInTbs: to.Ptr[float64](1000), - // MaxDbNodeStorageSizeInGbs: to.Ptr[int32](10), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // MemorySizeInGbs: to.Ptr[int32](100), - // MonthlyDbServerVersion: to.Ptr("aaaa"), - // MonthlyStorageServerVersion: to.Ptr("aaaa"), - // NextMaintenanceRunID: to.Ptr("ocid1..aaaaaa"), - // OciURL: to.Ptr("https://url"), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Shape: to.Ptr("EXADATA.X9M"), - // StorageCount: to.Ptr[int32](10), - // StorageServerVersion: to.Ptr("0.0"), - // TimeCreated: to.Ptr("2023-02-01T01:01:00"), - // TotalStorageSizeInGbs: to.Ptr[int32](1000), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_get.json -func ExampleCloudExadataInfrastructuresClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudExadataInfrastructuresClient().Get(ctx, "rg000", "infra1", 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.CloudExadataInfrastructure = armoracledatabase.CloudExadataInfrastructure{ - // Type: to.Ptr("Oracle.Database/cloudExadataInfrastructures"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - // ActivatedStorageCount: to.Ptr[int32](1), - // AdditionalStorageCount: to.Ptr[int32](1), - // AvailableStorageSizeInGbs: to.Ptr[int32](1000), - // ComputeCount: to.Ptr[int32](100), - // CPUCount: to.Ptr[int32](10), - // CustomerContacts: []*armoracledatabase.CustomerContact{ - // { - // Email: to.Ptr("noreply@oracle.com"), - // }}, - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](10), - // DbServerVersion: to.Ptr("19.0.0.0"), - // DisplayName: to.Ptr("infra 1"), - // EstimatedPatchingTime: &armoracledatabase.EstimatedPatchingTime{ - // EstimatedDbServerPatchingTime: to.Ptr[int32](3000), - // EstimatedNetworkSwitchesPatchingTime: to.Ptr[int32](3000), - // EstimatedStorageServerPatchingTime: to.Ptr[int32](3000), - // TotalEstimatedPatchingTime: to.Ptr[int32](3000), - // }, - // LastMaintenanceRunID: to.Ptr("ocid1..aaaaa"), - // LifecycleDetails: to.Ptr("none"), - // MaintenanceWindow: &armoracledatabase.MaintenanceWindow{ - // CustomActionTimeoutInMins: to.Ptr[int32](120), - // DaysOfWeek: []*armoracledatabase.DayOfWeek{ - // { - // Name: to.Ptr(armoracledatabase.DayOfWeekNameMonday), - // }}, - // HoursOfDay: []*int32{ - // to.Ptr[int32](0)}, - // IsCustomActionTimeoutEnabled: to.Ptr(true), - // IsMonthlyPatchingEnabled: to.Ptr(true), - // LeadTimeInWeeks: to.Ptr[int32](0), - // Months: []*armoracledatabase.Month{ - // { - // Name: to.Ptr(armoracledatabase.MonthNameJanuary), - // }}, - // PatchingMode: to.Ptr(armoracledatabase.PatchingModeRolling), - // Preference: to.Ptr(armoracledatabase.PreferenceNoPreference), - // WeeksOfMonth: []*int32{ - // to.Ptr[int32](0)}, - // }, - // MaxCPUCount: to.Ptr[int32](100), - // MaxDataStorageInTbs: to.Ptr[float64](1000), - // MaxDbNodeStorageSizeInGbs: to.Ptr[int32](10), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // MemorySizeInGbs: to.Ptr[int32](100), - // MonthlyDbServerVersion: to.Ptr("aaaa"), - // MonthlyStorageServerVersion: to.Ptr("aaaa"), - // NextMaintenanceRunID: to.Ptr("ocid1..aaaaaa"), - // OciURL: to.Ptr("https://url"), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Shape: to.Ptr("EXADATA.X9M"), - // StorageCount: to.Ptr[int32](10), - // StorageServerVersion: to.Ptr("0.0"), - // TimeCreated: to.Ptr("2023-02-01T01:01:00"), - // TotalStorageSizeInGbs: to.Ptr[int32](1000), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_create.json -func ExampleCloudExadataInfrastructuresClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-03-01/exaInfra_addStorageCapacity.json +func ExampleCloudExadataInfrastructuresClient_BeginAddStorageCapacity() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewCloudExadataInfrastructuresClient().BeginCreateOrUpdate(ctx, "rg000", "infra1", armoracledatabase.CloudExadataInfrastructure{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "tagK1": to.Ptr("tagV1"), - }, - Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - ComputeCount: to.Ptr[int32](100), - DisplayName: to.Ptr("infra 1"), - Shape: to.Ptr("EXADATA.X9M"), - StorageCount: to.Ptr[int32](10), - }, - Zones: []*string{ - to.Ptr("1")}, - }, nil) + poller, err := clientFactory.NewCloudExadataInfrastructuresClient().BeginAddStorageCapacity(ctx, "rg000", "infra1", nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -336,280 +33,81 @@ func ExampleCloudExadataInfrastructuresClient_BeginCreateOrUpdate() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudExadataInfrastructure = armoracledatabase.CloudExadataInfrastructure{ - // Type: to.Ptr("Oracle.Database/cloudExadataInfrastructures"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - // ActivatedStorageCount: to.Ptr[int32](1), - // AdditionalStorageCount: to.Ptr[int32](1), - // AvailableStorageSizeInGbs: to.Ptr[int32](1000), - // ComputeCount: to.Ptr[int32](100), - // CPUCount: to.Ptr[int32](10), - // CustomerContacts: []*armoracledatabase.CustomerContact{ - // { - // Email: to.Ptr("noreply@oracle.com"), - // }}, - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](10), - // DbServerVersion: to.Ptr("19.0.0.0"), - // DisplayName: to.Ptr("infra 1"), - // EstimatedPatchingTime: &armoracledatabase.EstimatedPatchingTime{ - // EstimatedDbServerPatchingTime: to.Ptr[int32](3000), - // EstimatedNetworkSwitchesPatchingTime: to.Ptr[int32](3000), - // EstimatedStorageServerPatchingTime: to.Ptr[int32](3000), - // TotalEstimatedPatchingTime: to.Ptr[int32](3000), + // res = armoracledatabase.CloudExadataInfrastructuresClientAddStorageCapacityResponse{ + // CloudExadataInfrastructure: &armoracledatabase.CloudExadataInfrastructure{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), + // Type: to.Ptr("Oracle.Database/cloudExadataInfrastructures"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagK1": to.Ptr("tagV1"), // }, - // LastMaintenanceRunID: to.Ptr("ocid1..aaaaa"), - // LifecycleDetails: to.Ptr("none"), - // MaintenanceWindow: &armoracledatabase.MaintenanceWindow{ - // CustomActionTimeoutInMins: to.Ptr[int32](120), - // DaysOfWeek: []*armoracledatabase.DayOfWeek{ - // { - // Name: to.Ptr(armoracledatabase.DayOfWeekNameMonday), - // }}, - // HoursOfDay: []*int32{ - // to.Ptr[int32](0)}, - // IsCustomActionTimeoutEnabled: to.Ptr(true), - // IsMonthlyPatchingEnabled: to.Ptr(true), - // LeadTimeInWeeks: to.Ptr[int32](0), + // Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ + // Ocid: to.Ptr("ocid1..aaaaaa"), + // ComputeCount: to.Ptr[int32](100), + // StorageCount: to.Ptr[int32](10), + // TotalStorageSizeInGbs: to.Ptr[int32](1000), + // AvailableStorageSizeInGbs: to.Ptr[int32](1000), + // TimeCreated: to.Ptr("2023-02-01T01:01:00"), + // LifecycleDetails: to.Ptr("none"), + // MaintenanceWindow: &armoracledatabase.MaintenanceWindow{ + // Preference: to.Ptr(armoracledatabase.PreferenceNoPreference), // Months: []*armoracledatabase.Month{ // { // Name: to.Ptr(armoracledatabase.MonthNameJanuary), - // }}, - // PatchingMode: to.Ptr(armoracledatabase.PatchingModeRolling), - // Preference: to.Ptr(armoracledatabase.PreferenceNoPreference), + // }, + // }, // WeeksOfMonth: []*int32{ - // to.Ptr[int32](0)}, + // to.Ptr[int32](0), // }, - // MaxCPUCount: to.Ptr[int32](100), - // MaxDataStorageInTbs: to.Ptr[float64](1000), - // MaxDbNodeStorageSizeInGbs: to.Ptr[int32](10), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // MemorySizeInGbs: to.Ptr[int32](100), - // MonthlyDbServerVersion: to.Ptr("aaaa"), - // MonthlyStorageServerVersion: to.Ptr("aaaa"), - // NextMaintenanceRunID: to.Ptr("ocid1..aaaaaa"), - // OciURL: to.Ptr("https://url"), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Shape: to.Ptr("EXADATA.X9M"), - // StorageCount: to.Ptr[int32](10), - // StorageServerVersion: to.Ptr("0.0"), - // TimeCreated: to.Ptr("2023-02-01T01:01:00"), - // TotalStorageSizeInGbs: to.Ptr[int32](1000), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_patch.json -func ExampleCloudExadataInfrastructuresClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudExadataInfrastructuresClient().BeginUpdate(ctx, "rg000", "infra1", armoracledatabase.CloudExadataInfrastructureUpdate{}, 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.CloudExadataInfrastructure = armoracledatabase.CloudExadataInfrastructure{ - // Type: to.Ptr("Oracle.Database/cloudExadataInfrastructures"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - // ActivatedStorageCount: to.Ptr[int32](1), - // AdditionalStorageCount: to.Ptr[int32](1), - // AvailableStorageSizeInGbs: to.Ptr[int32](1000), - // ComputeCount: to.Ptr[int32](100), - // CPUCount: to.Ptr[int32](10), - // CustomerContacts: []*armoracledatabase.CustomerContact{ - // { - // Email: to.Ptr("noreply@oracle.com"), - // }}, - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](10), - // DbServerVersion: to.Ptr("19.0.0.0"), - // DisplayName: to.Ptr("infra 1"), - // EstimatedPatchingTime: &armoracledatabase.EstimatedPatchingTime{ - // EstimatedDbServerPatchingTime: to.Ptr[int32](3000), - // EstimatedNetworkSwitchesPatchingTime: to.Ptr[int32](3000), - // EstimatedStorageServerPatchingTime: to.Ptr[int32](3000), - // TotalEstimatedPatchingTime: to.Ptr[int32](3000), - // }, - // LastMaintenanceRunID: to.Ptr("ocid1..aaaaa"), - // LifecycleDetails: to.Ptr("none"), - // MaintenanceWindow: &armoracledatabase.MaintenanceWindow{ - // CustomActionTimeoutInMins: to.Ptr[int32](120), - // DaysOfWeek: []*armoracledatabase.DayOfWeek{ - // { - // Name: to.Ptr(armoracledatabase.DayOfWeekNameMonday), - // }}, - // HoursOfDay: []*int32{ - // to.Ptr[int32](0)}, - // IsCustomActionTimeoutEnabled: to.Ptr(true), - // IsMonthlyPatchingEnabled: to.Ptr(true), - // LeadTimeInWeeks: to.Ptr[int32](0), - // Months: []*armoracledatabase.Month{ + // DaysOfWeek: []*armoracledatabase.DayOfWeek{ // { - // Name: to.Ptr(armoracledatabase.MonthNameJanuary), - // }}, - // PatchingMode: to.Ptr(armoracledatabase.PatchingModeRolling), - // Preference: to.Ptr(armoracledatabase.PreferenceNoPreference), - // WeeksOfMonth: []*int32{ - // to.Ptr[int32](0)}, + // Name: to.Ptr(armoracledatabase.DayOfWeekNameMonday), + // }, + // }, + // HoursOfDay: []*int32{ + // to.Ptr[int32](0), // }, - // MaxCPUCount: to.Ptr[int32](100), - // MaxDataStorageInTbs: to.Ptr[float64](1000), - // MaxDbNodeStorageSizeInGbs: to.Ptr[int32](10), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // MemorySizeInGbs: to.Ptr[int32](100), - // MonthlyDbServerVersion: to.Ptr("aaaa"), - // MonthlyStorageServerVersion: to.Ptr("aaaa"), - // NextMaintenanceRunID: to.Ptr("ocid1..aaaaaa"), - // OciURL: to.Ptr("https://url"), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Shape: to.Ptr("EXADATA.X9M"), - // StorageCount: to.Ptr[int32](10), - // StorageServerVersion: to.Ptr("0.0"), - // TimeCreated: to.Ptr("2023-02-01T01:01:00"), - // TotalStorageSizeInGbs: to.Ptr[int32](1000), - // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_delete.json -func ExampleCloudExadataInfrastructuresClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudExadataInfrastructuresClient().BeginDelete(ctx, "rg000", "infra1", 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/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/exaInfra_addStorageCapacity.json -func ExampleCloudExadataInfrastructuresClient_BeginAddStorageCapacity() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudExadataInfrastructuresClient().BeginAddStorageCapacity(ctx, "rg000", "infra1", 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.CloudExadataInfrastructure = armoracledatabase.CloudExadataInfrastructure{ - // Type: to.Ptr("Oracle.Database/cloudExadataInfrastructures"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudExadataInfrastructureProperties{ - // ActivatedStorageCount: to.Ptr[int32](1), - // AdditionalStorageCount: to.Ptr[int32](1), - // AvailableStorageSizeInGbs: to.Ptr[int32](1000), - // ComputeCount: to.Ptr[int32](100), - // CPUCount: to.Ptr[int32](10), - // CustomerContacts: []*armoracledatabase.CustomerContact{ - // { - // Email: to.Ptr("noreply@oracle.com"), - // }}, - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](10), - // DbServerVersion: to.Ptr("19.0.0.0"), - // DisplayName: to.Ptr("infra 1"), - // EstimatedPatchingTime: &armoracledatabase.EstimatedPatchingTime{ - // EstimatedDbServerPatchingTime: to.Ptr[int32](3000), - // EstimatedNetworkSwitchesPatchingTime: to.Ptr[int32](3000), - // EstimatedStorageServerPatchingTime: to.Ptr[int32](3000), - // TotalEstimatedPatchingTime: to.Ptr[int32](3000), - // }, - // LastMaintenanceRunID: to.Ptr("ocid1..aaaaa"), - // LifecycleDetails: to.Ptr("none"), - // MaintenanceWindow: &armoracledatabase.MaintenanceWindow{ - // CustomActionTimeoutInMins: to.Ptr[int32](120), - // DaysOfWeek: []*armoracledatabase.DayOfWeek{ - // { - // Name: to.Ptr(armoracledatabase.DayOfWeekNameMonday), - // }}, - // HoursOfDay: []*int32{ - // to.Ptr[int32](0)}, - // IsCustomActionTimeoutEnabled: to.Ptr(true), - // IsMonthlyPatchingEnabled: to.Ptr(true), // LeadTimeInWeeks: to.Ptr[int32](0), - // Months: []*armoracledatabase.Month{ - // { - // Name: to.Ptr(armoracledatabase.MonthNameJanuary), - // }}, // PatchingMode: to.Ptr(armoracledatabase.PatchingModeRolling), - // Preference: to.Ptr(armoracledatabase.PreferenceNoPreference), - // WeeksOfMonth: []*int32{ - // to.Ptr[int32](0)}, + // CustomActionTimeoutInMins: to.Ptr[int32](120), + // IsCustomActionTimeoutEnabled: to.Ptr(true), + // IsMonthlyPatchingEnabled: to.Ptr(true), + // }, + // EstimatedPatchingTime: &armoracledatabase.EstimatedPatchingTime{ + // EstimatedDbServerPatchingTime: to.Ptr[int32](3000), + // EstimatedNetworkSwitchesPatchingTime: to.Ptr[int32](3000), + // EstimatedStorageServerPatchingTime: to.Ptr[int32](3000), + // TotalEstimatedPatchingTime: to.Ptr[int32](3000), + // }, + // CustomerContacts: []*armoracledatabase.CustomerContact{ + // { + // Email: to.Ptr("noreply@oracle.com"), // }, - // MaxCPUCount: to.Ptr[int32](100), - // MaxDataStorageInTbs: to.Ptr[float64](1000), - // MaxDbNodeStorageSizeInGbs: to.Ptr[int32](10), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // MemorySizeInGbs: to.Ptr[int32](100), - // MonthlyDbServerVersion: to.Ptr("aaaa"), - // MonthlyStorageServerVersion: to.Ptr("aaaa"), - // NextMaintenanceRunID: to.Ptr("ocid1..aaaaaa"), - // OciURL: to.Ptr("https://url"), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // Shape: to.Ptr("EXADATA.X9M"), - // StorageCount: to.Ptr[int32](10), - // StorageServerVersion: to.Ptr("0.0"), - // TimeCreated: to.Ptr("2023-02-01T01:01:00"), - // TotalStorageSizeInGbs: to.Ptr[int32](1000), // }, - // Zones: []*string{ - // to.Ptr("1")}, - // } + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), + // Shape: to.Ptr("EXADATA.X9M"), + // OciURL: to.Ptr("https://url"), + // CPUCount: to.Ptr[int32](10), + // MaxCPUCount: to.Ptr[int32](100), + // MemorySizeInGbs: to.Ptr[int32](100), + // MaxMemoryInGbs: to.Ptr[int32](1000), + // DbNodeStorageSizeInGbs: to.Ptr[int32](10), + // MaxDbNodeStorageSizeInGbs: to.Ptr[int32](10), + // DataStorageSizeInTbs: to.Ptr[float64](10), + // MaxDataStorageInTbs: to.Ptr[float64](1000), + // DbServerVersion: to.Ptr("19.0.0.0"), + // StorageServerVersion: to.Ptr("0.0"), + // ActivatedStorageCount: to.Ptr[int32](1), + // AdditionalStorageCount: to.Ptr[int32](1), + // DisplayName: to.Ptr("infra 1"), + // LastMaintenanceRunID: to.Ptr("ocid1..aaaaa"), + // NextMaintenanceRunID: to.Ptr("ocid1..aaaaaa"), + // MonthlyDbServerVersion: to.Ptr("aaaa"), + // MonthlyStorageServerVersion: to.Ptr("aaaa"), + // }, + // Zones: []*string{ + // to.Ptr("1"), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client.go index cfa066618eca..93bce8a06c51 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_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 armoracledatabase @@ -46,7 +42,7 @@ func NewCloudVMClustersClient(subscriptionID string, credential azcore.TokenCred // BeginAddVMs - Add VMs to the VM Cluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - body - The content of the action request @@ -59,8 +55,7 @@ func (client *CloudVMClustersClient) BeginAddVMs(ctx context.Context, resourceGr return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudVMClustersClientAddVMsResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -73,7 +68,7 @@ func (client *CloudVMClustersClient) BeginAddVMs(ctx context.Context, resourceGr // AddVMs - Add VMs to the VM Cluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *CloudVMClustersClient) addVMs(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, options *CloudVMClustersClientBeginAddVMsOptions) (*http.Response, error) { var err error const operationName = "CloudVMClustersClient.BeginAddVMs" @@ -96,7 +91,7 @@ func (client *CloudVMClustersClient) addVMs(ctx context.Context, resourceGroupNa } // addVMsCreateRequest creates the AddVMs request. -func (client *CloudVMClustersClient) addVMsCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, options *CloudVMClustersClientBeginAddVMsOptions) (*policy.Request, error) { +func (client *CloudVMClustersClient) addVMsCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, _ *CloudVMClustersClientBeginAddVMsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/addVms" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,9 +110,10 @@ func (client *CloudVMClustersClient) addVMsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -127,7 +123,7 @@ func (client *CloudVMClustersClient) addVMsCreateRequest(ctx context.Context, re // BeginCreateOrUpdate - Create a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - resource - Resource create parameters. @@ -140,8 +136,7 @@ func (client *CloudVMClustersClient) BeginCreateOrUpdate(ctx context.Context, re return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudVMClustersClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -154,7 +149,7 @@ func (client *CloudVMClustersClient) BeginCreateOrUpdate(ctx context.Context, re // CreateOrUpdate - Create a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *CloudVMClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudvmclustername string, resource CloudVMCluster, options *CloudVMClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "CloudVMClustersClient.BeginCreateOrUpdate" @@ -177,7 +172,7 @@ func (client *CloudVMClustersClient) createOrUpdate(ctx context.Context, resourc } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *CloudVMClustersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, resource CloudVMCluster, options *CloudVMClustersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *CloudVMClustersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, resource CloudVMCluster, _ *CloudVMClustersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -196,9 +191,10 @@ func (client *CloudVMClustersClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -208,7 +204,7 @@ func (client *CloudVMClustersClient) createOrUpdateCreateRequest(ctx context.Con // BeginDelete - Delete a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - options - CloudVMClustersClientBeginDeleteOptions contains the optional parameters for the CloudVMClustersClient.BeginDelete @@ -220,8 +216,7 @@ func (client *CloudVMClustersClient) BeginDelete(ctx context.Context, resourceGr return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudVMClustersClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -234,7 +229,7 @@ func (client *CloudVMClustersClient) BeginDelete(ctx context.Context, resourceGr // Delete - Delete a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *CloudVMClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *CloudVMClustersClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "CloudVMClustersClient.BeginDelete" @@ -257,7 +252,7 @@ func (client *CloudVMClustersClient) deleteOperation(ctx context.Context, resour } // deleteCreateRequest creates the Delete request. -func (client *CloudVMClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *CloudVMClustersClientBeginDeleteOptions) (*policy.Request, error) { +func (client *CloudVMClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, _ *CloudVMClustersClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -276,7 +271,7 @@ func (client *CloudVMClustersClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -285,7 +280,7 @@ func (client *CloudVMClustersClient) deleteCreateRequest(ctx context.Context, re // Get - Get a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - options - CloudVMClustersClientGetOptions contains the optional parameters for the CloudVMClustersClient.Get method. @@ -312,7 +307,7 @@ func (client *CloudVMClustersClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *CloudVMClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *CloudVMClustersClientGetOptions) (*policy.Request, error) { +func (client *CloudVMClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, _ *CloudVMClustersClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -331,7 +326,7 @@ func (client *CloudVMClustersClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -348,7 +343,7 @@ func (client *CloudVMClustersClient) getHandleResponse(resp *http.Response) (Clo // NewListByResourceGroupPager - List CloudVmCluster resources by resource group // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - CloudVMClustersClientListByResourceGroupOptions contains the optional parameters for the CloudVMClustersClient.NewListByResourceGroupPager // method. @@ -376,7 +371,7 @@ func (client *CloudVMClustersClient) NewListByResourceGroupPager(resourceGroupNa } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *CloudVMClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CloudVMClustersClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *CloudVMClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *CloudVMClustersClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -391,7 +386,7 @@ func (client *CloudVMClustersClient) listByResourceGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -408,7 +403,7 @@ func (client *CloudVMClustersClient) listByResourceGroupHandleResponse(resp *htt // NewListBySubscriptionPager - List CloudVmCluster resources by subscription ID // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - options - CloudVMClustersClientListBySubscriptionOptions contains the optional parameters for the CloudVMClustersClient.NewListBySubscriptionPager // method. func (client *CloudVMClustersClient) NewListBySubscriptionPager(options *CloudVMClustersClientListBySubscriptionOptions) *runtime.Pager[CloudVMClustersClientListBySubscriptionResponse] { @@ -435,7 +430,7 @@ func (client *CloudVMClustersClient) NewListBySubscriptionPager(options *CloudVM } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *CloudVMClustersClient) listBySubscriptionCreateRequest(ctx context.Context, options *CloudVMClustersClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *CloudVMClustersClient) listBySubscriptionCreateRequest(ctx context.Context, _ *CloudVMClustersClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/cloudVmClusters" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -446,7 +441,7 @@ func (client *CloudVMClustersClient) listBySubscriptionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -464,7 +459,7 @@ func (client *CloudVMClustersClient) listBySubscriptionHandleResponse(resp *http // ListPrivateIPAddresses - List Private IP Addresses by the provided filter // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - body - The content of the action request @@ -493,7 +488,7 @@ func (client *CloudVMClustersClient) ListPrivateIPAddresses(ctx context.Context, } // listPrivateIPAddressesCreateRequest creates the ListPrivateIPAddresses request. -func (client *CloudVMClustersClient) listPrivateIPAddressesCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, body PrivateIPAddressesFilter, options *CloudVMClustersClientListPrivateIPAddressesOptions) (*policy.Request, error) { +func (client *CloudVMClustersClient) listPrivateIPAddressesCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, body PrivateIPAddressesFilter, _ *CloudVMClustersClientListPrivateIPAddressesOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/listPrivateIpAddresses" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -512,9 +507,10 @@ func (client *CloudVMClustersClient) listPrivateIPAddressesCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -524,7 +520,7 @@ func (client *CloudVMClustersClient) listPrivateIPAddressesCreateRequest(ctx con // listPrivateIPAddressesHandleResponse handles the ListPrivateIPAddresses response. func (client *CloudVMClustersClient) listPrivateIPAddressesHandleResponse(resp *http.Response) (CloudVMClustersClientListPrivateIPAddressesResponse, error) { result := CloudVMClustersClientListPrivateIPAddressesResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.PrivateIPAddressPropertiesArray); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateIpAddressPropertiesArray); err != nil { return CloudVMClustersClientListPrivateIPAddressesResponse{}, err } return result, nil @@ -533,7 +529,7 @@ func (client *CloudVMClustersClient) listPrivateIPAddressesHandleResponse(resp * // BeginRemoveVMs - Remove VMs from the VM Cluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - body - The content of the action request @@ -546,8 +542,7 @@ func (client *CloudVMClustersClient) BeginRemoveVMs(ctx context.Context, resourc return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudVMClustersClientRemoveVMsResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -560,7 +555,7 @@ func (client *CloudVMClustersClient) BeginRemoveVMs(ctx context.Context, resourc // RemoveVMs - Remove VMs from the VM Cluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *CloudVMClustersClient) removeVMs(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, options *CloudVMClustersClientBeginRemoveVMsOptions) (*http.Response, error) { var err error const operationName = "CloudVMClustersClient.BeginRemoveVMs" @@ -583,7 +578,7 @@ func (client *CloudVMClustersClient) removeVMs(ctx context.Context, resourceGrou } // removeVMsCreateRequest creates the RemoveVMs request. -func (client *CloudVMClustersClient) removeVMsCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, options *CloudVMClustersClientBeginRemoveVMsOptions) (*policy.Request, error) { +func (client *CloudVMClustersClient) removeVMsCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, body AddRemoveDbNode, _ *CloudVMClustersClientBeginRemoveVMsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/removeVms" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -602,9 +597,10 @@ func (client *CloudVMClustersClient) removeVMsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -614,7 +610,7 @@ func (client *CloudVMClustersClient) removeVMsCreateRequest(ctx context.Context, // BeginUpdate - Update a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - properties - The resource properties to be updated. @@ -627,8 +623,7 @@ func (client *CloudVMClustersClient) BeginUpdate(ctx context.Context, resourceGr return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[CloudVMClustersClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -641,7 +636,7 @@ func (client *CloudVMClustersClient) BeginUpdate(ctx context.Context, resourceGr // Update - Update a CloudVmCluster // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *CloudVMClustersClient) update(ctx context.Context, resourceGroupName string, cloudvmclustername string, properties CloudVMClusterUpdate, options *CloudVMClustersClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "CloudVMClustersClient.BeginUpdate" @@ -664,7 +659,7 @@ func (client *CloudVMClustersClient) update(ctx context.Context, resourceGroupNa } // updateCreateRequest creates the Update request. -func (client *CloudVMClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, properties CloudVMClusterUpdate, options *CloudVMClustersClientBeginUpdateOptions) (*policy.Request, error) { +func (client *CloudVMClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, properties CloudVMClusterUpdate, _ *CloudVMClustersClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -683,9 +678,10 @@ func (client *CloudVMClustersClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client_example_test.go index 14feee604fc9..41f4535b441f 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client_example_test.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/cloudvmclusters_client_example_test.go @@ -1,385 +1,32 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights 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 armoracledatabase_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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_listBySubscription.json -func ExampleCloudVMClustersClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudVMClustersClient().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.CloudVMClusterListResult = armoracledatabase.CloudVMClusterListResult{ - // Value: []*armoracledatabase.CloudVMCluster{ - // { - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), - // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), - // DisplayName: to.Ptr("cluster 1"), - // Domain: to.Ptr("domain1"), - // GiVersion: to.Ptr("19.0.0.0"), - // Hostname: to.Ptr("hostname1"), - // IormConfigCache: &armoracledatabase.ExadataIormConfig{ - // DbPlans: []*armoracledatabase.DbIormConfig{ - // { - // DbName: to.Ptr("db1"), - // FlashCacheLimit: to.Ptr("none"), - // Share: to.Ptr[int32](32), - // }}, - // LifecycleDetails: to.Ptr("Disabled"), - // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), - // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), - // }, - // IsLocalBackupEnabled: to.Ptr(false), - // IsSparseDiskgroupEnabled: to.Ptr(false), - // LastUpdateHistoryEntryID: to.Ptr("none"), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), - // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), - // NodeCount: to.Ptr[int32](100), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // ScanDNSName: to.Ptr("dbdns1"), - // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_listByResourceGroup.json -func ExampleCloudVMClustersClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCloudVMClustersClient().NewListByResourceGroupPager("rg000", 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.CloudVMClusterListResult = armoracledatabase.CloudVMClusterListResult{ - // Value: []*armoracledatabase.CloudVMCluster{ - // { - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), - // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), - // DisplayName: to.Ptr("cluster 1"), - // Domain: to.Ptr("domain1"), - // GiVersion: to.Ptr("19.0.0.0"), - // Hostname: to.Ptr("hostname1"), - // IormConfigCache: &armoracledatabase.ExadataIormConfig{ - // DbPlans: []*armoracledatabase.DbIormConfig{ - // { - // DbName: to.Ptr("db1"), - // FlashCacheLimit: to.Ptr("none"), - // Share: to.Ptr[int32](32), - // }}, - // LifecycleDetails: to.Ptr("Disabled"), - // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), - // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), - // }, - // IsLocalBackupEnabled: to.Ptr(false), - // IsSparseDiskgroupEnabled: to.Ptr(false), - // LastUpdateHistoryEntryID: to.Ptr("none"), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), - // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), - // NodeCount: to.Ptr[int32](100), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // ScanDNSName: to.Ptr("dbdns1"), - // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_get.json -func ExampleCloudVMClustersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCloudVMClustersClient().Get(ctx, "rg000", "cluster1", 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.CloudVMCluster = armoracledatabase.CloudVMCluster{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), - // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), - // DisplayName: to.Ptr("cluster 1"), - // Domain: to.Ptr("domain1"), - // GiVersion: to.Ptr("19.0.0.0"), - // Hostname: to.Ptr("hostname1"), - // IormConfigCache: &armoracledatabase.ExadataIormConfig{ - // DbPlans: []*armoracledatabase.DbIormConfig{ - // { - // DbName: to.Ptr("db1"), - // FlashCacheLimit: to.Ptr("none"), - // Share: to.Ptr[int32](32), - // }}, - // LifecycleDetails: to.Ptr("Disabled"), - // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), - // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), - // }, - // IsLocalBackupEnabled: to.Ptr(false), - // IsSparseDiskgroupEnabled: to.Ptr(false), - // LastUpdateHistoryEntryID: to.Ptr("none"), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), - // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), - // NodeCount: to.Ptr[int32](100), - // NsgCidrs: []*armoracledatabase.NsgCidr{ - // { - // DestinationPortRange: &armoracledatabase.PortRange{ - // Max: to.Ptr[int32](1522), - // Min: to.Ptr[int32](1520), - // }, - // Source: to.Ptr("10.0.0.0/16"), - // }, - // { - // Source: to.Ptr("10.10.0.0/24"), - // }}, - // NsgURL: to.Ptr("https://fake"), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // ScanDNSName: to.Ptr("dbdns1"), - // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_create.json -func ExampleCloudVMClustersClient_BeginCreateOrUpdate() { +// Generated from example definition: 2025-03-01/vmClusters_addVms.json +func ExampleCloudVMClustersClient_BeginAddVMs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewCloudVMClustersClient().BeginCreateOrUpdate(ctx, "rg000", "cluster1", armoracledatabase.CloudVMCluster{ - Location: to.Ptr("eastus"), - Tags: map[string]*string{ - "tagK1": to.Ptr("tagV1"), - }, - Properties: &armoracledatabase.CloudVMClusterProperties{ - BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - ClusterName: to.Ptr("cluster1"), - CPUCoreCount: to.Ptr[int32](2), - DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - IsDiagnosticsEventsEnabled: to.Ptr(false), - IsHealthMonitoringEnabled: to.Ptr(false), - IsIncidentLogsEnabled: to.Ptr(false), - }, - DataStoragePercentage: to.Ptr[int32](100), - DataStorageSizeInTbs: to.Ptr[float64](1000), - DbNodeStorageSizeInGbs: to.Ptr[int32](1000), - DbServers: []*string{ - to.Ptr("ocid1..aaaa")}, - DisplayName: to.Ptr("cluster 1"), - Domain: to.Ptr("domain1"), - GiVersion: to.Ptr("19.0.0.0"), - Hostname: to.Ptr("hostname1"), - IsLocalBackupEnabled: to.Ptr(false), - IsSparseDiskgroupEnabled: to.Ptr(false), - LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - MemorySizeInGbs: to.Ptr[int32](1000), - NsgCidrs: []*armoracledatabase.NsgCidr{ - { - DestinationPortRange: &armoracledatabase.PortRange{ - Max: to.Ptr[int32](1522), - Min: to.Ptr[int32](1520), - }, - Source: to.Ptr("10.0.0.0/16"), - }, - { - Source: to.Ptr("10.10.0.0/24"), - }}, - OcpuCount: to.Ptr[float32](3), - ScanListenerPortTCP: to.Ptr[int32](1050), - ScanListenerPortTCPSSL: to.Ptr[int32](1025), - SSHPublicKeys: []*string{ - to.Ptr("ssh-key 1")}, - SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - TimeZone: to.Ptr("UTC"), - VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), + poller, err := clientFactory.NewCloudVMClustersClient().BeginAddVMs(ctx, "rg000", "cluster1", armoracledatabase.AddRemoveDbNode{ + DbServers: []*string{ + to.Ptr("ocid1..aaaa"), + to.Ptr("ocid1..aaaaaa"), }, }, nil) if err != nil { @@ -392,304 +39,94 @@ func ExampleCloudVMClustersClient_BeginCreateOrUpdate() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudVMCluster = armoracledatabase.CloudVMCluster{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), + // res = armoracledatabase.CloudVMClustersClientAddVMsResponse{ + // CloudVMCluster: &armoracledatabase.CloudVMCluster{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), + // Type: to.Ptr("Oracle.Database/cloudVmClusters"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagK1": to.Ptr("tagV1"), // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), - // DisplayName: to.Ptr("cluster 1"), - // Domain: to.Ptr("domain1"), - // GiVersion: to.Ptr("19.0.0.0"), - // Hostname: to.Ptr("hostname1"), - // IormConfigCache: &armoracledatabase.ExadataIormConfig{ - // DbPlans: []*armoracledatabase.DbIormConfig{ - // { - // DbName: to.Ptr("db1"), - // FlashCacheLimit: to.Ptr("none"), - // Share: to.Ptr[int32](32), - // }}, - // LifecycleDetails: to.Ptr("Disabled"), - // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), - // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), - // }, - // IsLocalBackupEnabled: to.Ptr(false), - // IsSparseDiskgroupEnabled: to.Ptr(false), - // LastUpdateHistoryEntryID: to.Ptr("none"), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), + // Properties: &armoracledatabase.CloudVMClusterProperties{ + // Ocid: to.Ptr("ocid1..aaaa"), // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), // NodeCount: to.Ptr[int32](100), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // ScanDNSName: to.Ptr("dbdns1"), - // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_patch.json -func ExampleCloudVMClustersClient_BeginUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudVMClustersClient().BeginUpdate(ctx, "rg000", "cluster1", armoracledatabase.CloudVMClusterUpdate{}, 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.CloudVMCluster = armoracledatabase.CloudVMCluster{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), - // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), - // DisplayName: to.Ptr("cluster 1"), - // Domain: to.Ptr("domain1"), - // GiVersion: to.Ptr("19.0.0.0"), + // StorageSizeInGbs: to.Ptr[int32](1000), + // DataStorageSizeInTbs: to.Ptr[float64](10), + // DbNodeStorageSizeInGbs: to.Ptr[int32](100), + // MemorySizeInGbs: to.Ptr[int32](1000), + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), + // LifecycleDetails: to.Ptr("success"), + // TimeZone: to.Ptr("UTC"), + // ZoneID: to.Ptr("ocid1..aaaa"), // Hostname: to.Ptr("hostname1"), - // IormConfigCache: &armoracledatabase.ExadataIormConfig{ - // DbPlans: []*armoracledatabase.DbIormConfig{ - // { - // DbName: to.Ptr("db1"), - // FlashCacheLimit: to.Ptr("none"), - // Share: to.Ptr[int32](32), - // }}, - // LifecycleDetails: to.Ptr("Disabled"), - // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), - // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), - // }, + // Domain: to.Ptr("domain1"), + // CPUCoreCount: to.Ptr[int32](10), + // OcpuCount: to.Ptr[float32](100), + // ClusterName: to.Ptr("cluster1"), + // DataStoragePercentage: to.Ptr[int32](80), // IsLocalBackupEnabled: to.Ptr(false), + // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), // IsSparseDiskgroupEnabled: to.Ptr(false), - // LastUpdateHistoryEntryID: to.Ptr("none"), + // SSHPublicKeys: []*string{ + // to.Ptr("ssh-key 1"), + // }, // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), - // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), - // NodeCount: to.Ptr[int32](100), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), + // ScanListenerPortTCP: to.Ptr[int32](1050), + // ScanListenerPortTCPSSL: to.Ptr[int32](1025), + // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), + // GiVersion: to.Ptr("19.0.0.0"), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // SystemVersion: to.Ptr("v1"), + // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), + // ScanIPIDs: []*string{ + // to.Ptr("10.0.0.1"), + // }, + // VipIDs: []*string{ + // to.Ptr("10.0.1.3"), + // }, // ScanDNSName: to.Ptr("dbdns1"), // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_delete.json -func ExampleCloudVMClustersClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudVMClustersClient().BeginDelete(ctx, "rg000", "cluster1", 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/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_addVms.json -func ExampleCloudVMClustersClient_BeginAddVMs() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewCloudVMClustersClient().BeginAddVMs(ctx, "rg000", "cluster1", armoracledatabase.AddRemoveDbNode{ - DbServers: []*string{ - to.Ptr("ocid1..aaaa"), - to.Ptr("ocid1..aaaaaa")}, - }, 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.CloudVMCluster = armoracledatabase.CloudVMCluster{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), - // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), + // Shape: to.Ptr("EXADATA.X9M"), + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), + // OciURL: to.Ptr("https://fake"), + // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ + // IsDiagnosticsEventsEnabled: to.Ptr(false), + // IsHealthMonitoringEnabled: to.Ptr(false), + // IsIncidentLogsEnabled: to.Ptr(false), + // }, // DisplayName: to.Ptr("cluster 1"), - // Domain: to.Ptr("domain1"), - // GiVersion: to.Ptr("19.0.0.0"), - // Hostname: to.Ptr("hostname1"), // IormConfigCache: &armoracledatabase.ExadataIormConfig{ // DbPlans: []*armoracledatabase.DbIormConfig{ // { // DbName: to.Ptr("db1"), // FlashCacheLimit: to.Ptr("none"), // Share: to.Ptr[int32](32), - // }}, + // }, + // }, // LifecycleDetails: to.Ptr("Disabled"), // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), // }, - // IsLocalBackupEnabled: to.Ptr(false), - // IsSparseDiskgroupEnabled: to.Ptr(false), // LastUpdateHistoryEntryID: to.Ptr("none"), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), - // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), - // NodeCount: to.Ptr[int32](100), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // ScanDNSName: to.Ptr("dbdns1"), - // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // } + // DbServers: []*string{ + // to.Ptr("ocid1..aaaa"), + // }, + // CompartmentID: to.Ptr("ocid1..aaaaaa"), + // SubnetOcid: to.Ptr("ocid1..aaaaaa"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_listPrivateIpAddresses.json +// Generated from example definition: 2025-03-01/vmClusters_listPrivateIpAddresses.json func ExampleCloudVMClustersClient_ListPrivateIPAddresses() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -703,30 +140,34 @@ func ExampleCloudVMClustersClient_ListPrivateIPAddresses() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.PrivateIPAddressPropertiesArray = []*armoracledatabase.PrivateIPAddressProperties{ - // { - // DisplayName: to.Ptr("ip1"), - // HostnameLabel: to.Ptr("hostname1"), - // IPAddress: to.Ptr("192.168.0.1"), - // Ocid: to.Ptr("ocid1..aaaa"), - // SubnetID: to.Ptr("ocid1..aaaa"), - // }} + // res = armoracledatabase.CloudVMClustersClientListPrivateIPAddressesResponse{ + // undefined: &[]*armoracledatabase.PrivateIPAddressProperties{ + // { + // DisplayName: to.Ptr("ip1"), + // HostnameLabel: to.Ptr("hostname1"), + // Ocid: to.Ptr("ocid1..aaaa"), + // IPAddress: to.Ptr("192.168.0.1"), + // SubnetID: to.Ptr("ocid1..aaaa"), + // }, + // }, + // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/vmClusters_removeVms.json +// Generated from example definition: 2025-03-01/vmClusters_removeVms.json func ExampleCloudVMClustersClient_BeginRemoveVMs() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } poller, err := clientFactory.NewCloudVMClustersClient().BeginRemoveVMs(ctx, "rg000", "cluster1", armoracledatabase.AddRemoveDbNode{ DbServers: []*string{ - to.Ptr("ocid1..aaaa")}, + to.Ptr("ocid1..aaaa"), + }, }, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) @@ -738,76 +179,83 @@ func ExampleCloudVMClustersClient_BeginRemoveVMs() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudVMCluster = armoracledatabase.CloudVMCluster{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), - // Location: to.Ptr("eastus"), - // Tags: map[string]*string{ - // "tagK1": to.Ptr("tagV1"), - // }, - // Properties: &armoracledatabase.CloudVMClusterProperties{ - // BackupSubnetCidr: to.Ptr("172.17.5.0/24"), - // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // ClusterName: to.Ptr("cluster1"), - // CompartmentID: to.Ptr("ocid1..aaaaaa"), - // CPUCoreCount: to.Ptr[int32](10), - // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ - // IsDiagnosticsEventsEnabled: to.Ptr(false), - // IsHealthMonitoringEnabled: to.Ptr(false), - // IsIncidentLogsEnabled: to.Ptr(false), + // res = armoracledatabase.CloudVMClustersClientRemoveVMsResponse{ + // CloudVMCluster: &armoracledatabase.CloudVMCluster{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1"), + // Type: to.Ptr("Oracle.Database/cloudVmClusters"), + // Location: to.Ptr("eastus"), + // Tags: map[string]*string{ + // "tagK1": to.Ptr("tagV1"), // }, - // DataStoragePercentage: to.Ptr[int32](80), - // DataStorageSizeInTbs: to.Ptr[float64](10), - // DbNodeStorageSizeInGbs: to.Ptr[int32](100), - // DbServers: []*string{ - // to.Ptr("ocid1..aaaa")}, - // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), - // DisplayName: to.Ptr("cluster 1"), + // Properties: &armoracledatabase.CloudVMClusterProperties{ + // Ocid: to.Ptr("ocid1..aaaa"), + // ListenerPort: to.Ptr[int64](1050), + // NodeCount: to.Ptr[int32](100), + // StorageSizeInGbs: to.Ptr[int32](1000), + // DataStorageSizeInTbs: to.Ptr[float64](10), + // DbNodeStorageSizeInGbs: to.Ptr[int32](100), + // MemorySizeInGbs: to.Ptr[int32](1000), + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), + // LifecycleDetails: to.Ptr("success"), + // TimeZone: to.Ptr("UTC"), + // ZoneID: to.Ptr("ocid1..aaaa"), + // Hostname: to.Ptr("hostname1"), // Domain: to.Ptr("domain1"), + // CPUCoreCount: to.Ptr[int32](10), + // OcpuCount: to.Ptr[float32](100), + // ClusterName: to.Ptr("cluster1"), + // DataStoragePercentage: to.Ptr[int32](80), + // IsLocalBackupEnabled: to.Ptr(false), + // CloudExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), + // IsSparseDiskgroupEnabled: to.Ptr(false), + // SSHPublicKeys: []*string{ + // to.Ptr("ssh-key 1"), + // }, + // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), + // ScanListenerPortTCP: to.Ptr[int32](1050), + // ScanListenerPortTCPSSL: to.Ptr[int32](1025), + // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), // GiVersion: to.Ptr("19.0.0.0"), - // Hostname: to.Ptr("hostname1"), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // BackupSubnetCidr: to.Ptr("172.17.5.0/24"), + // SystemVersion: to.Ptr("v1"), + // DiskRedundancy: to.Ptr(armoracledatabase.DiskRedundancyHigh), + // ScanIPIDs: []*string{ + // to.Ptr("10.0.0.1"), + // }, + // VipIDs: []*string{ + // to.Ptr("10.0.1.3"), + // }, + // ScanDNSName: to.Ptr("dbdns1"), + // ScanDNSRecordID: to.Ptr("scandns1"), + // Shape: to.Ptr("EXADATA.X9M"), + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), + // OciURL: to.Ptr("https://fake"), + // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ + // IsDiagnosticsEventsEnabled: to.Ptr(false), + // IsHealthMonitoringEnabled: to.Ptr(false), + // IsIncidentLogsEnabled: to.Ptr(false), + // }, + // DisplayName: to.Ptr("cluster 1"), // IormConfigCache: &armoracledatabase.ExadataIormConfig{ // DbPlans: []*armoracledatabase.DbIormConfig{ // { // DbName: to.Ptr("db1"), // FlashCacheLimit: to.Ptr("none"), // Share: to.Ptr[int32](32), - // }}, + // }, + // }, // LifecycleDetails: to.Ptr("Disabled"), // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), // }, - // IsLocalBackupEnabled: to.Ptr(false), - // IsSparseDiskgroupEnabled: to.Ptr(false), // LastUpdateHistoryEntryID: to.Ptr("none"), - // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), - // LifecycleDetails: to.Ptr("success"), - // ListenerPort: to.Ptr[int64](1050), - // MemorySizeInGbs: to.Ptr[int32](1000), - // NodeCount: to.Ptr[int32](100), - // OciURL: to.Ptr("https://fake"), - // Ocid: to.Ptr("ocid1..aaaa"), - // OcpuCount: to.Ptr[float32](100), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // ScanDNSName: to.Ptr("dbdns1"), - // ScanDNSRecordID: to.Ptr("scandns1"), - // ScanIPIDs: []*string{ - // to.Ptr("10.0.0.1")}, - // ScanListenerPortTCP: to.Ptr[int32](1050), - // ScanListenerPortTCPSSL: to.Ptr[int32](1025), - // Shape: to.Ptr("EXADATA.X9M"), - // SSHPublicKeys: []*string{ - // to.Ptr("ssh-key 1")}, - // StorageSizeInGbs: to.Ptr[int32](1000), - // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), - // SubnetOcid: to.Ptr("ocid1..aaaaaa"), - // SystemVersion: to.Ptr("v1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T02:18:35.683Z"); return t}()), - // TimeZone: to.Ptr("UTC"), - // VipIDs: []*string{ - // to.Ptr("10.0.1.3")}, - // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), - // ZoneID: to.Ptr("ocid1..aaaa"), - // }, - // } + // DbServers: []*string{ + // to.Ptr("ocid1..aaaa"), + // }, + // CompartmentID: to.Ptr("ocid1..aaaaaa"), + // SubnetOcid: to.Ptr("ocid1..aaaaaa"), + // }, + // }, + // } } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/constants.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/constants.go index 8e9e5855b1b4..8a872c7b1144 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/constants.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/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 armoracledatabase const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" - moduleVersion = "v1.0.0" + moduleVersion = "v2.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,6 +24,27 @@ func PossibleActionTypeValues() []ActionType { } } +// AddSubscriptionOperationState - Add Subscription Operation state enum +type AddSubscriptionOperationState string + +const ( + // AddSubscriptionOperationStateFailed - Failed - State when Add Subscription operation failed + AddSubscriptionOperationStateFailed AddSubscriptionOperationState = "Failed" + // AddSubscriptionOperationStateSucceeded - Succeeded - State when Add Subscription operation succeeded + AddSubscriptionOperationStateSucceeded AddSubscriptionOperationState = "Succeeded" + // AddSubscriptionOperationStateUpdating - Updating - State when Add Subscription operation is being Updated + AddSubscriptionOperationStateUpdating AddSubscriptionOperationState = "Updating" +) + +// PossibleAddSubscriptionOperationStateValues returns the possible values for the AddSubscriptionOperationState const type. +func PossibleAddSubscriptionOperationStateValues() []AddSubscriptionOperationState { + return []AddSubscriptionOperationState{ + AddSubscriptionOperationStateFailed, + AddSubscriptionOperationStateSucceeded, + AddSubscriptionOperationStateUpdating, + } +} + // AutonomousDatabaseBackupLifecycleState - Autonomous database backup lifecycle state enum type AutonomousDatabaseBackupLifecycleState string @@ -343,14 +361,18 @@ func PossibleConsumerGroupValues() []ConsumerGroup { } } -// 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. @@ -420,6 +442,10 @@ type DataBaseType string const ( // DataBaseTypeClone - Clone DB DataBaseTypeClone DataBaseType = "Clone" + // DataBaseTypeCloneFromBackupTimestamp - Clone DB from backup timestamp + DataBaseTypeCloneFromBackupTimestamp DataBaseType = "CloneFromBackupTimestamp" + // DataBaseTypeCrossRegionDisasterRecovery - Cross Region Disaster Recovery + DataBaseTypeCrossRegionDisasterRecovery DataBaseType = "CrossRegionDisasterRecovery" // DataBaseTypeRegular - Regular DB DataBaseTypeRegular DataBaseType = "Regular" ) @@ -428,6 +454,8 @@ const ( func PossibleDataBaseTypeValues() []DataBaseType { return []DataBaseType{ DataBaseTypeClone, + DataBaseTypeCloneFromBackupTimestamp, + DataBaseTypeCrossRegionDisasterRecovery, DataBaseTypeRegular, } } @@ -678,6 +706,69 @@ func PossibleDiskRedundancyValues() []DiskRedundancy { } } +// ExadbVMClusterLifecycleState - Exadata VM cluster on Exascale Infrastructure lifecycle state enum +type ExadbVMClusterLifecycleState string + +const ( + // ExadbVMClusterLifecycleStateAvailable - Indicates that resource in Available state + ExadbVMClusterLifecycleStateAvailable ExadbVMClusterLifecycleState = "Available" + // ExadbVMClusterLifecycleStateFailed - Indicates that resource in Failed state + ExadbVMClusterLifecycleStateFailed ExadbVMClusterLifecycleState = "Failed" + // ExadbVMClusterLifecycleStateMaintenanceInProgress - Indicates that resource Maintenance in progress state + ExadbVMClusterLifecycleStateMaintenanceInProgress ExadbVMClusterLifecycleState = "MaintenanceInProgress" + // ExadbVMClusterLifecycleStateProvisioning - Indicates that resource in Provisioning state + ExadbVMClusterLifecycleStateProvisioning ExadbVMClusterLifecycleState = "Provisioning" + // ExadbVMClusterLifecycleStateTerminated - Indicates that resource in Terminated state + ExadbVMClusterLifecycleStateTerminated ExadbVMClusterLifecycleState = "Terminated" + // ExadbVMClusterLifecycleStateTerminating - Indicates that resource in Terminating state + ExadbVMClusterLifecycleStateTerminating ExadbVMClusterLifecycleState = "Terminating" + // ExadbVMClusterLifecycleStateUpdating - Indicates that resource in Updating state + ExadbVMClusterLifecycleStateUpdating ExadbVMClusterLifecycleState = "Updating" +) + +// PossibleExadbVMClusterLifecycleStateValues returns the possible values for the ExadbVMClusterLifecycleState const type. +func PossibleExadbVMClusterLifecycleStateValues() []ExadbVMClusterLifecycleState { + return []ExadbVMClusterLifecycleState{ + ExadbVMClusterLifecycleStateAvailable, + ExadbVMClusterLifecycleStateFailed, + ExadbVMClusterLifecycleStateMaintenanceInProgress, + ExadbVMClusterLifecycleStateProvisioning, + ExadbVMClusterLifecycleStateTerminated, + ExadbVMClusterLifecycleStateTerminating, + ExadbVMClusterLifecycleStateUpdating, + } +} + +// ExascaleDbStorageVaultLifecycleState - Exadata Database Storage Vault lifecycle state enum +type ExascaleDbStorageVaultLifecycleState string + +const ( + // ExascaleDbStorageVaultLifecycleStateAvailable - Indicates that resource in Available state + ExascaleDbStorageVaultLifecycleStateAvailable ExascaleDbStorageVaultLifecycleState = "Available" + // ExascaleDbStorageVaultLifecycleStateFailed - Indicates that resource in Failed state + ExascaleDbStorageVaultLifecycleStateFailed ExascaleDbStorageVaultLifecycleState = "Failed" + // ExascaleDbStorageVaultLifecycleStateProvisioning - Indicates that resource in Provisioning state + ExascaleDbStorageVaultLifecycleStateProvisioning ExascaleDbStorageVaultLifecycleState = "Provisioning" + // ExascaleDbStorageVaultLifecycleStateTerminated - Indicates that resource in Terminated state + ExascaleDbStorageVaultLifecycleStateTerminated ExascaleDbStorageVaultLifecycleState = "Terminated" + // ExascaleDbStorageVaultLifecycleStateTerminating - Indicates that resource in Terminating state + ExascaleDbStorageVaultLifecycleStateTerminating ExascaleDbStorageVaultLifecycleState = "Terminating" + // ExascaleDbStorageVaultLifecycleStateUpdating - Indicates that resource in Updating state + ExascaleDbStorageVaultLifecycleStateUpdating ExascaleDbStorageVaultLifecycleState = "Updating" +) + +// PossibleExascaleDbStorageVaultLifecycleStateValues returns the possible values for the ExascaleDbStorageVaultLifecycleState const type. +func PossibleExascaleDbStorageVaultLifecycleStateValues() []ExascaleDbStorageVaultLifecycleState { + return []ExascaleDbStorageVaultLifecycleState{ + ExascaleDbStorageVaultLifecycleStateAvailable, + ExascaleDbStorageVaultLifecycleStateFailed, + ExascaleDbStorageVaultLifecycleStateProvisioning, + ExascaleDbStorageVaultLifecycleStateTerminated, + ExascaleDbStorageVaultLifecycleStateTerminating, + ExascaleDbStorageVaultLifecycleStateUpdating, + } +} + // GenerateType - Generate type enum type GenerateType string @@ -696,6 +787,42 @@ func PossibleGenerateTypeValues() []GenerateType { } } +// GridImageType - GridImageType enum +type GridImageType string + +const ( + // GridImageTypeCustomImage - Custom image + GridImageTypeCustomImage GridImageType = "CustomImage" + // GridImageTypeReleaseUpdate - Release update + GridImageTypeReleaseUpdate GridImageType = "ReleaseUpdate" +) + +// PossibleGridImageTypeValues returns the possible values for the GridImageType const type. +func PossibleGridImageTypeValues() []GridImageType { + return []GridImageType{ + GridImageTypeCustomImage, + GridImageTypeReleaseUpdate, + } +} + +// HardwareType - Hardware Type enum +type HardwareType string + +const ( + // HardwareTypeCELL - Hardware type is Storage Server + HardwareTypeCELL HardwareType = "CELL" + // HardwareTypeCOMPUTE - Hardware type is Database Server + HardwareTypeCOMPUTE HardwareType = "COMPUTE" +) + +// PossibleHardwareTypeValues returns the possible values for the HardwareType const type. +func PossibleHardwareTypeValues() []HardwareType { + return []HardwareType{ + HardwareTypeCELL, + HardwareTypeCOMPUTE, + } +} + // HostFormatType - Host format type enum. type HostFormatType string @@ -926,8 +1053,11 @@ func PossibleOracleSubscriptionProvisioningStateValues() []OracleSubscriptionPro 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" ) @@ -1138,6 +1268,24 @@ func PossibleSessionModeTypeValues() []SessionModeType { } } +// ShapeFamily - Allowed values for GI Minor Versions shapeFamily filter +type ShapeFamily string + +const ( + // ShapeFamilyExadata - Family value for Exadata Shape + ShapeFamilyExadata ShapeFamily = "EXADATA" + // ShapeFamilyExadbXs - Family value for Exadb XS Shape + ShapeFamilyExadbXs ShapeFamily = "EXADB_XS" +) + +// PossibleShapeFamilyValues returns the possible values for the ShapeFamily const type. +func PossibleShapeFamilyValues() []ShapeFamily { + return []ShapeFamily{ + ShapeFamilyExadata, + ShapeFamilyExadbXs, + } +} + // SourceType - Source type enum. type SourceType string @@ -1192,6 +1340,27 @@ func PossibleSyntaxFormatTypeValues() []SyntaxFormatType { } } +// SystemShapes - Allowed values for System Shapes +type SystemShapes string + +const ( + // SystemShapesExaDbXs - Exadata DB on Exascale Infrastructure shape + SystemShapesExaDbXs SystemShapes = "ExaDbXS" + // SystemShapesExadataX11M - Exadata X11M shape + SystemShapesExadataX11M SystemShapes = "Exadata.X11M" + // SystemShapesExadataX9M - Exadata X9M shape + SystemShapesExadataX9M SystemShapes = "Exadata.X9M" +) + +// PossibleSystemShapesValues returns the possible values for the SystemShapes const type. +func PossibleSystemShapesValues() []SystemShapes { + return []SystemShapes{ + SystemShapesExaDbXs, + SystemShapesExadataX11M, + SystemShapesExadataX9M, + } +} + // TLSAuthenticationType - TLS authentication type enum. type TLSAuthenticationType string diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client.go index 02bca6f50b8b..917763d07818 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_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 armoracledatabase @@ -46,7 +42,7 @@ func NewDbNodesClient(subscriptionID string, credential azcore.TokenCredential, // BeginAction - VM actions on DbNode of VM Cluster by the provided filter // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - dbnodeocid - DbNode OCID. @@ -59,8 +55,7 @@ func (client *DbNodesClient) BeginAction(ctx context.Context, resourceGroupName return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DbNodesClientActionResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -73,7 +68,7 @@ func (client *DbNodesClient) BeginAction(ctx context.Context, resourceGroupName // Action - VM actions on DbNode of VM Cluster by the provided filter // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *DbNodesClient) action(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, body DbNodeAction, options *DbNodesClientBeginActionOptions) (*http.Response, error) { var err error const operationName = "DbNodesClient.BeginAction" @@ -96,7 +91,7 @@ func (client *DbNodesClient) action(ctx context.Context, resourceGroupName strin } // actionCreateRequest creates the Action request. -func (client *DbNodesClient) actionCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, body DbNodeAction, options *DbNodesClientBeginActionOptions) (*policy.Request, error) { +func (client *DbNodesClient) actionCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, body DbNodeAction, _ *DbNodesClientBeginActionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/dbNodes/{dbnodeocid}/action" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -119,9 +114,10 @@ func (client *DbNodesClient) actionCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -131,7 +127,7 @@ func (client *DbNodesClient) actionCreateRequest(ctx context.Context, resourceGr // Get - Get a DbNode // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - dbnodeocid - DbNode OCID. @@ -159,7 +155,7 @@ func (client *DbNodesClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *DbNodesClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, options *DbNodesClientGetOptions) (*policy.Request, error) { +func (client *DbNodesClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, _ *DbNodesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/dbNodes/{dbnodeocid}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -182,7 +178,7 @@ func (client *DbNodesClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -197,38 +193,38 @@ func (client *DbNodesClient) getHandleResponse(resp *http.Response) (DbNodesClie return result, nil } -// NewListByCloudVMClusterPager - List DbNode resources by CloudVmCluster +// NewListByParentPager - List DbNode resources by CloudVmCluster // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name -// - options - DbNodesClientListByCloudVMClusterOptions contains the optional parameters for the DbNodesClient.NewListByCloudVMClusterPager +// - options - DbNodesClientListByParentOptions contains the optional parameters for the DbNodesClient.NewListByParentPager // method. -func (client *DbNodesClient) NewListByCloudVMClusterPager(resourceGroupName string, cloudvmclustername string, options *DbNodesClientListByCloudVMClusterOptions) *runtime.Pager[DbNodesClientListByCloudVMClusterResponse] { - return runtime.NewPager(runtime.PagingHandler[DbNodesClientListByCloudVMClusterResponse]{ - More: func(page DbNodesClientListByCloudVMClusterResponse) bool { +func (client *DbNodesClient) NewListByParentPager(resourceGroupName string, cloudvmclustername string, options *DbNodesClientListByParentOptions) *runtime.Pager[DbNodesClientListByParentResponse] { + return runtime.NewPager(runtime.PagingHandler[DbNodesClientListByParentResponse]{ + More: func(page DbNodesClientListByParentResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *DbNodesClientListByCloudVMClusterResponse) (DbNodesClientListByCloudVMClusterResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DbNodesClient.NewListByCloudVMClusterPager") + Fetcher: func(ctx context.Context, page *DbNodesClientListByParentResponse) (DbNodesClientListByParentResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DbNodesClient.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.listByCloudVMClusterCreateRequest(ctx, resourceGroupName, cloudvmclustername, options) + return client.listByParentCreateRequest(ctx, resourceGroupName, cloudvmclustername, options) }, nil) if err != nil { - return DbNodesClientListByCloudVMClusterResponse{}, err + return DbNodesClientListByParentResponse{}, err } - return client.listByCloudVMClusterHandleResponse(resp) + return client.listByParentHandleResponse(resp) }, Tracer: client.internal.Tracer(), }) } -// listByCloudVMClusterCreateRequest creates the ListByCloudVMCluster request. -func (client *DbNodesClient) listByCloudVMClusterCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *DbNodesClientListByCloudVMClusterOptions) (*policy.Request, error) { +// listByParentCreateRequest creates the ListByParent request. +func (client *DbNodesClient) listByParentCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, _ *DbNodesClientListByParentOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/dbNodes" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -247,17 +243,17 @@ func (client *DbNodesClient) listByCloudVMClusterCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByCloudVMClusterHandleResponse handles the ListByCloudVMCluster response. -func (client *DbNodesClient) listByCloudVMClusterHandleResponse(resp *http.Response) (DbNodesClientListByCloudVMClusterResponse, error) { - result := DbNodesClientListByCloudVMClusterResponse{} +// listByParentHandleResponse handles the ListByParent response. +func (client *DbNodesClient) listByParentHandleResponse(resp *http.Response) (DbNodesClientListByParentResponse, error) { + result := DbNodesClientListByParentResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DbNodeListResult); err != nil { - return DbNodesClientListByCloudVMClusterResponse{}, err + return DbNodesClientListByParentResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client_example_test.go index 13651e994932..58754f60928b 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client_example_test.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbnodes_client_example_test.go @@ -1,131 +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 armoracledatabase_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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbNodes_listByParent.json -func ExampleDbNodesClient_NewListByCloudVMClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDbNodesClient().NewListByCloudVMClusterPager("rg000", "cluster1", 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.DbNodeListResult = armoracledatabase.DbNodeListResult{ - // Value: []*armoracledatabase.DbNode{ - // { - // Type: to.Ptr("Oracle.Database/cloudVmClusters/dbNodes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1/dbNodes/ocid1"), - // Properties: &armoracledatabase.DbNodeProperties{ - // BackupIPID: to.Ptr("id1"), - // BackupVnic2ID: to.Ptr("id1"), - // BackupVnicID: to.Ptr("id1"), - // CPUCoreCount: to.Ptr[int32](1000), - // DbNodeStorageSizeInGbs: to.Ptr[int32](500), - // DbServerID: to.Ptr("dbserver1"), - // DbSystemID: to.Ptr("db1"), - // FaultDomain: to.Ptr("domain1"), - // HostIPID: to.Ptr("10.0.0.0"), - // Hostname: to.Ptr("host1"), - // LifecycleState: to.Ptr(armoracledatabase.DbNodeProvisioningStateAvailable), - // MaintenanceType: to.Ptr(armoracledatabase.DbNodeMaintenanceTypeVmdbRebootMigration), - // MemorySizeInGbs: to.Ptr[int32](100), - // Ocid: to.Ptr("ocid.dbNodes.1"), - // SoftwareStorageSizeInGb: to.Ptr[int32](1000), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // TimeMaintenanceWindowEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // TimeMaintenanceWindowStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // Vnic2ID: to.Ptr("ocid.vnic.id2"), - // VnicID: to.Ptr("ocid.vnic.id1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbNodes_get.json -func ExampleDbNodesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDbNodesClient().Get(ctx, "rg000", "cluster1", "ocid1....aaaaaa", 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.DbNode = armoracledatabase.DbNode{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters/dbNodes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1/dbNodes/ocid1"), - // Properties: &armoracledatabase.DbNodeProperties{ - // BackupIPID: to.Ptr("id1"), - // BackupVnic2ID: to.Ptr("id1"), - // BackupVnicID: to.Ptr("id1"), - // CPUCoreCount: to.Ptr[int32](1000), - // DbNodeStorageSizeInGbs: to.Ptr[int32](500), - // DbServerID: to.Ptr("dbserver1"), - // DbSystemID: to.Ptr("db1"), - // FaultDomain: to.Ptr("domain1"), - // HostIPID: to.Ptr("10.0.0.0"), - // Hostname: to.Ptr("host1"), - // LifecycleState: to.Ptr(armoracledatabase.DbNodeProvisioningStateAvailable), - // MaintenanceType: to.Ptr(armoracledatabase.DbNodeMaintenanceTypeVmdbRebootMigration), - // MemorySizeInGbs: to.Ptr[int32](100), - // Ocid: to.Ptr("ocid.dbNodes.1"), - // SoftwareStorageSizeInGb: to.Ptr[int32](1000), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // TimeMaintenanceWindowEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // TimeMaintenanceWindowStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // Vnic2ID: to.Ptr("ocid.vnic.id2"), - // VnicID: to.Ptr("ocid.vnic.id1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbNodes_action.json -func ExampleDbNodesClient_BeginAction_dbNodesAction() { +// Generated from example definition: 2025-03-01/dbNodes_action.json +func ExampleDbNodesClient_BeginAction() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -142,30 +36,35 @@ func ExampleDbNodesClient_BeginAction_dbNodesAction() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.DbNode = armoracledatabase.DbNode{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters/dbNodes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1/dbNodes/ocid1"), - // Properties: &armoracledatabase.DbNodeProperties{ - // BackupIPID: to.Ptr("id1"), - // BackupVnic2ID: to.Ptr("id1"), - // BackupVnicID: to.Ptr("id1"), - // CPUCoreCount: to.Ptr[int32](1000), - // DbNodeStorageSizeInGbs: to.Ptr[int32](500), - // DbServerID: to.Ptr("dbserver1"), - // DbSystemID: to.Ptr("db1"), - // FaultDomain: to.Ptr("domain1"), - // HostIPID: to.Ptr("10.0.0.0"), - // Hostname: to.Ptr("host1"), - // MaintenanceType: to.Ptr(armoracledatabase.DbNodeMaintenanceTypeVmdbRebootMigration), - // MemorySizeInGbs: to.Ptr[int32](100), - // Ocid: to.Ptr("ocid.dbNodes.1"), - // ProvisioningState: to.Ptr(armoracledatabase.ResourceProvisioningStateSucceeded), - // SoftwareStorageSizeInGb: to.Ptr[int32](1000), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // TimeMaintenanceWindowEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // TimeMaintenanceWindowStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), - // Vnic2ID: to.Ptr("ocid.vnic.id2"), - // VnicID: to.Ptr("ocid.vnic.id1"), + // res = armoracledatabase.DbNodesClientActionResponse{ + // DbNode: &armoracledatabase.DbNode{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1/dbNodes/ocid1"), + // Type: to.Ptr("Oracle.Database/cloudVmClusters/dbNodes"), + // Properties: &armoracledatabase.DbNodeProperties{ + // Ocid: to.Ptr("ocid.dbNodes.1"), + // BackupIPID: to.Ptr("id1"), + // BackupVnic2ID: to.Ptr("id1"), + // BackupVnicID: to.Ptr("id1"), + // CPUCoreCount: to.Ptr[int32](1000), + // DbNodeStorageSizeInGbs: to.Ptr[int32](500), + // DbServerID: to.Ptr("dbserver1"), + // DbSystemID: to.Ptr("db1"), + // FaultDomain: to.Ptr("domain1"), + // HostIPID: to.Ptr("10.0.0.0"), + // Hostname: to.Ptr("host1"), + // ProvisioningState: to.Ptr(armoracledatabase.ResourceProvisioningStateSucceeded), + // MaintenanceType: to.Ptr(armoracledatabase.DbNodeMaintenanceTypeVmdbRebootMigration), + // MemorySizeInGbs: to.Ptr[int32](100), + // SoftwareStorageSizeInGb: to.Ptr[int32](1000), + // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), + // TimeMaintenanceWindowEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), + // TimeMaintenanceWindowStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-21T13:44:04.924Z"); return t}()), + // Vnic2ID: to.Ptr("ocid.vnic.id2"), + // VnicID: to.Ptr("ocid.vnic.id1"), + // AdditionalDetails: to.Ptr("additionalDetails"), + // LifecycleState: to.Ptr(armoracledatabase.DbNodeProvisioningStateAvailable), + // LifecycleDetails: to.Ptr("lifecycleDetails"), + // }, // }, // } } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client.go index 34bc828e0228..24d65b8a367c 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_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 armoracledatabase @@ -46,7 +42,7 @@ func NewDbServersClient(subscriptionID string, credential azcore.TokenCredential // Get - Get a DbServer // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name // - dbserverocid - DbServer OCID. @@ -74,7 +70,7 @@ func (client *DbServersClient) Get(ctx context.Context, resourceGroupName string } // getCreateRequest creates the Get request. -func (client *DbServersClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, dbserverocid string, options *DbServersClientGetOptions) (*policy.Request, error) { +func (client *DbServersClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, dbserverocid string, _ *DbServersClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}/dbServers/{dbserverocid}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -97,7 +93,7 @@ func (client *DbServersClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -112,38 +108,38 @@ func (client *DbServersClient) getHandleResponse(resp *http.Response) (DbServers return result, nil } -// NewListByCloudExadataInfrastructurePager - List DbServer resources by CloudExadataInfrastructure +// NewListByParentPager - List DbServer resources by CloudExadataInfrastructure // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudexadatainfrastructurename - CloudExadataInfrastructure name -// - options - DbServersClientListByCloudExadataInfrastructureOptions contains the optional parameters for the DbServersClient.NewListByCloudExadataInfrastructurePager +// - options - DbServersClientListByParentOptions contains the optional parameters for the DbServersClient.NewListByParentPager // method. -func (client *DbServersClient) NewListByCloudExadataInfrastructurePager(resourceGroupName string, cloudexadatainfrastructurename string, options *DbServersClientListByCloudExadataInfrastructureOptions) *runtime.Pager[DbServersClientListByCloudExadataInfrastructureResponse] { - return runtime.NewPager(runtime.PagingHandler[DbServersClientListByCloudExadataInfrastructureResponse]{ - More: func(page DbServersClientListByCloudExadataInfrastructureResponse) bool { +func (client *DbServersClient) NewListByParentPager(resourceGroupName string, cloudexadatainfrastructurename string, options *DbServersClientListByParentOptions) *runtime.Pager[DbServersClientListByParentResponse] { + return runtime.NewPager(runtime.PagingHandler[DbServersClientListByParentResponse]{ + More: func(page DbServersClientListByParentResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *DbServersClientListByCloudExadataInfrastructureResponse) (DbServersClientListByCloudExadataInfrastructureResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DbServersClient.NewListByCloudExadataInfrastructurePager") + Fetcher: func(ctx context.Context, page *DbServersClientListByParentResponse) (DbServersClientListByParentResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DbServersClient.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.listByCloudExadataInfrastructureCreateRequest(ctx, resourceGroupName, cloudexadatainfrastructurename, options) + return client.listByParentCreateRequest(ctx, resourceGroupName, cloudexadatainfrastructurename, options) }, nil) if err != nil { - return DbServersClientListByCloudExadataInfrastructureResponse{}, err + return DbServersClientListByParentResponse{}, err } - return client.listByCloudExadataInfrastructureHandleResponse(resp) + return client.listByParentHandleResponse(resp) }, Tracer: client.internal.Tracer(), }) } -// listByCloudExadataInfrastructureCreateRequest creates the ListByCloudExadataInfrastructure request. -func (client *DbServersClient) listByCloudExadataInfrastructureCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, options *DbServersClientListByCloudExadataInfrastructureOptions) (*policy.Request, error) { +// listByParentCreateRequest creates the ListByParent request. +func (client *DbServersClient) listByParentCreateRequest(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, _ *DbServersClientListByParentOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudExadataInfrastructures/{cloudexadatainfrastructurename}/dbServers" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -162,17 +158,17 @@ func (client *DbServersClient) listByCloudExadataInfrastructureCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByCloudExadataInfrastructureHandleResponse handles the ListByCloudExadataInfrastructure response. -func (client *DbServersClient) listByCloudExadataInfrastructureHandleResponse(resp *http.Response) (DbServersClientListByCloudExadataInfrastructureResponse, error) { - result := DbServersClientListByCloudExadataInfrastructureResponse{} +// listByParentHandleResponse handles the ListByParent response. +func (client *DbServersClient) listByParentHandleResponse(resp *http.Response) (DbServersClientListByParentResponse, error) { + result := DbServersClientListByParentResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.DbServerListResult); err != nil { - return DbServersClientListByCloudExadataInfrastructureResponse{}, err + return DbServersClientListByParentResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client_example_test.go deleted file mode 100644 index 12f1139bea15..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbservers_client_example_test.go +++ /dev/null @@ -1,112 +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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbServers_listByParent.json -func ExampleDbServersClient_NewListByCloudExadataInfrastructurePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDbServersClient().NewListByCloudExadataInfrastructurePager("rg000", "infra1", 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.DbServerListResult = armoracledatabase.DbServerListResult{ - // Value: []*armoracledatabase.DbServer{ - // { - // Type: to.Ptr("Oracle.Database/cloudVmClusters/dbServers"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1/dbServers/ocid1"), - // Properties: &armoracledatabase.DbServerProperties{ - // AutonomousVirtualMachineIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // AutonomousVMClusterIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // CompartmentID: to.Ptr("ocid1....aaaa"), - // CPUCoreCount: to.Ptr[int32](100), - // DbNodeIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // DbNodeStorageSizeInGbs: to.Ptr[int32](150), - // DisplayName: to.Ptr("dbserver1"), - // ExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // LifecycleState: to.Ptr(armoracledatabase.DbServerProvisioningStateAvailable), - // MaxCPUCount: to.Ptr[int32](1000), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // Ocid: to.Ptr("ocid1"), - // VMClusterIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbServers_get.json -func ExampleDbServersClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDbServersClient().Get(ctx, "rg000", "infra1", "ocid1....aaaaaa", 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.DbServer = armoracledatabase.DbServer{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters/dbServers"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1/dbServers/ocid1"), - // Properties: &armoracledatabase.DbServerProperties{ - // AutonomousVirtualMachineIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // AutonomousVMClusterIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // CompartmentID: to.Ptr("ocid1....aaaa"), - // CPUCoreCount: to.Ptr[int32](100), - // DbNodeIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // DbNodeStorageSizeInGbs: to.Ptr[int32](150), - // DisplayName: to.Ptr("dbserver1"), - // ExadataInfrastructureID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudExadataInfrastructures/infra1"), - // LifecycleState: to.Ptr(armoracledatabase.DbServerProvisioningStateAvailable), - // MaxCPUCount: to.Ptr[int32](1000), - // MaxMemoryInGbs: to.Ptr[int32](1000), - // Ocid: to.Ptr("ocid1"), - // VMClusterIDs: []*string{ - // to.Ptr("ocid1..aaaaa")}, - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client.go index 64a1709916e8..f278455d8dec 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_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 armoracledatabase @@ -46,7 +42,7 @@ func NewDbSystemShapesClient(subscriptionID string, credential azcore.TokenCrede // Get - Get a DbSystemShape // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - dbsystemshapename - DbSystemShape name // - options - DbSystemShapesClientGetOptions contains the optional parameters for the DbSystemShapesClient.Get method. @@ -73,7 +69,7 @@ func (client *DbSystemShapesClient) Get(ctx context.Context, location string, db } // getCreateRequest creates the Get request. -func (client *DbSystemShapesClient) getCreateRequest(ctx context.Context, location string, dbsystemshapename string, options *DbSystemShapesClientGetOptions) (*policy.Request, error) { +func (client *DbSystemShapesClient) getCreateRequest(ctx context.Context, location string, dbsystemshapename string, _ *DbSystemShapesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dbSystemShapes/{dbsystemshapename}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -92,7 +88,7 @@ func (client *DbSystemShapesClient) getCreateRequest(ctx context.Context, locati return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -107,9 +103,9 @@ func (client *DbSystemShapesClient) getHandleResponse(resp *http.Response) (DbSy return result, nil } -// NewListByLocationPager - List DbSystemShape resources by Location +// NewListByLocationPager - List DbSystemShape resources by SubscriptionLocationResource // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - options - DbSystemShapesClientListByLocationOptions contains the optional parameters for the DbSystemShapesClient.NewListByLocationPager // method. @@ -152,7 +148,10 @@ func (client *DbSystemShapesClient) listByLocationCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") + if options != nil && options.Zone != nil { + reqQP.Set("zone", *options.Zone) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client_example_test.go index 63e720f7e41f..5af88d41be7e 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_client_example_test.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dbsystemshapes_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 armoracledatabase_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbSystemShapes_listByLocation.json +// Generated from example definition: 2025-03-01/dbSystemShapes_listByLocation.json func ExampleDbSystemShapesClient_NewListByLocationPager() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,80 +33,38 @@ func ExampleDbSystemShapesClient_NewListByLocationPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DbSystemShapeListResult = armoracledatabase.DbSystemShapeListResult{ - // Value: []*armoracledatabase.DbSystemShape{ - // { - // Type: to.Ptr("Oracle.Database/locations/dbSystemShapes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dbSystemShapes/EXADATA.X9M"), - // Properties: &armoracledatabase.DbSystemShapeProperties{ - // AvailableCoreCount: to.Ptr[int32](100), - // AvailableCoreCountPerNode: to.Ptr[int32](1000), - // AvailableDataStorageInTbs: to.Ptr[int32](10), - // AvailableDataStoragePerServerInTbs: to.Ptr[float64](100), - // AvailableDbNodePerNodeInGbs: to.Ptr[int32](10), - // AvailableDbNodeStorageInGbs: to.Ptr[int32](10), - // AvailableMemoryInGbs: to.Ptr[int32](10), - // AvailableMemoryPerNodeInGbs: to.Ptr[int32](10), - // CoreCountIncrement: to.Ptr[int32](1), - // MaxStorageCount: to.Ptr[int32](100), - // MaximumNodeCount: to.Ptr[int32](1000), - // MinCoreCountPerNode: to.Ptr[int32](0), - // MinDataStorageInTbs: to.Ptr[int32](0), - // MinDbNodeStoragePerNodeInGbs: to.Ptr[int32](0), - // MinMemoryPerNodeInGbs: to.Ptr[int32](0), - // MinStorageCount: to.Ptr[int32](0), - // MinimumCoreCount: to.Ptr[int32](1), - // MinimumNodeCount: to.Ptr[int32](0), - // RuntimeMinimumCoreCount: to.Ptr[int32](1), - // ShapeFamily: to.Ptr("EXADATA"), + // page = armoracledatabase.DbSystemShapesClientListByLocationResponse{ + // DbSystemShapeListResult: armoracledatabase.DbSystemShapeListResult{ + // Value: []*armoracledatabase.DbSystemShape{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dbSystemShapes/EXADATA.X9M"), + // Type: to.Ptr("Oracle.Database/locations/dbSystemShapes"), + // Properties: &armoracledatabase.DbSystemShapeProperties{ + // ShapeFamily: to.Ptr("EXADATA"), + // ShapeName: to.Ptr("EXADATA.X9M"), + // AvailableCoreCount: to.Ptr[int32](100), + // MinimumCoreCount: to.Ptr[int32](1), + // RuntimeMinimumCoreCount: to.Ptr[int32](1), + // CoreCountIncrement: to.Ptr[int32](1), + // MinStorageCount: to.Ptr[int32](0), + // MaxStorageCount: to.Ptr[int32](100), + // AvailableDataStoragePerServerInTbs: to.Ptr[float64](100), + // AvailableMemoryPerNodeInGbs: to.Ptr[int32](10), + // AvailableDbNodePerNodeInGbs: to.Ptr[int32](10), + // MinCoreCountPerNode: to.Ptr[int32](0), + // AvailableMemoryInGbs: to.Ptr[int32](10), + // MinMemoryPerNodeInGbs: to.Ptr[int32](0), + // AvailableDbNodeStorageInGbs: to.Ptr[int32](10), + // MinDbNodeStoragePerNodeInGbs: to.Ptr[int32](0), + // AvailableDataStorageInTbs: to.Ptr[int32](10), + // MinDataStorageInTbs: to.Ptr[int32](0), + // MinimumNodeCount: to.Ptr[int32](0), + // MaximumNodeCount: to.Ptr[int32](1000), + // AvailableCoreCountPerNode: to.Ptr[int32](1000), + // }, // }, - // }}, + // }, + // }, // } } } - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dbSystemShapes_get.json -func ExampleDbSystemShapesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDbSystemShapesClient().Get(ctx, "eastus", "EXADATA.X9M", 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.DbSystemShape = armoracledatabase.DbSystemShape{ - // Type: to.Ptr("Oracle.Database/locations/dbSystemShapes"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dbSystemShapes/EXADATA.X9M"), - // Properties: &armoracledatabase.DbSystemShapeProperties{ - // AvailableCoreCount: to.Ptr[int32](100), - // AvailableCoreCountPerNode: to.Ptr[int32](1000), - // AvailableDataStorageInTbs: to.Ptr[int32](10), - // AvailableDataStoragePerServerInTbs: to.Ptr[float64](100), - // AvailableDbNodePerNodeInGbs: to.Ptr[int32](10), - // AvailableDbNodeStorageInGbs: to.Ptr[int32](10), - // AvailableMemoryInGbs: to.Ptr[int32](10), - // AvailableMemoryPerNodeInGbs: to.Ptr[int32](10), - // CoreCountIncrement: to.Ptr[int32](1), - // MaxStorageCount: to.Ptr[int32](100), - // MaximumNodeCount: to.Ptr[int32](1000), - // MinCoreCountPerNode: to.Ptr[int32](0), - // MinDataStorageInTbs: to.Ptr[int32](0), - // MinDbNodeStoragePerNodeInGbs: to.Ptr[int32](0), - // MinMemoryPerNodeInGbs: to.Ptr[int32](0), - // MinStorageCount: to.Ptr[int32](0), - // MinimumCoreCount: to.Ptr[int32](1), - // MinimumNodeCount: to.Ptr[int32](0), - // RuntimeMinimumCoreCount: to.Ptr[int32](1), - // ShapeFamily: to.Ptr("EXADATA"), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client.go index 0a36f1bbd684..03fbe7ec5e39 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_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 armoracledatabase @@ -46,7 +42,7 @@ func NewDNSPrivateViewsClient(subscriptionID string, credential azcore.TokenCred // Get - Get a DnsPrivateView // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - dnsprivateviewocid - DnsPrivateView OCID // - options - DNSPrivateViewsClientGetOptions contains the optional parameters for the DNSPrivateViewsClient.Get method. @@ -73,7 +69,7 @@ func (client *DNSPrivateViewsClient) Get(ctx context.Context, location string, d } // getCreateRequest creates the Get request. -func (client *DNSPrivateViewsClient) getCreateRequest(ctx context.Context, location string, dnsprivateviewocid string, options *DNSPrivateViewsClientGetOptions) (*policy.Request, error) { +func (client *DNSPrivateViewsClient) getCreateRequest(ctx context.Context, location string, dnsprivateviewocid string, _ *DNSPrivateViewsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateViews/{dnsprivateviewocid}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -92,7 +88,7 @@ func (client *DNSPrivateViewsClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -107,9 +103,9 @@ func (client *DNSPrivateViewsClient) getHandleResponse(resp *http.Response) (DNS return result, nil } -// NewListByLocationPager - List DnsPrivateView resources by Location +// NewListByLocationPager - List DnsPrivateView resources by SubscriptionLocationResource // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - options - DNSPrivateViewsClientListByLocationOptions contains the optional parameters for the DNSPrivateViewsClient.NewListByLocationPager // method. @@ -137,7 +133,7 @@ func (client *DNSPrivateViewsClient) NewListByLocationPager(location string, opt } // listByLocationCreateRequest creates the ListByLocation request. -func (client *DNSPrivateViewsClient) listByLocationCreateRequest(ctx context.Context, location string, options *DNSPrivateViewsClientListByLocationOptions) (*policy.Request, error) { +func (client *DNSPrivateViewsClient) listByLocationCreateRequest(ctx context.Context, location string, _ *DNSPrivateViewsClientListByLocationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateViews" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -152,7 +148,7 @@ func (client *DNSPrivateViewsClient) listByLocationCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client_example_test.go deleted file mode 100644 index 4987b77cd99c..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivateviews_client_example_test.go +++ /dev/null @@ -1,105 +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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dnsPrivateViews_listByLocation.json -func ExampleDNSPrivateViewsClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDNSPrivateViewsClient().NewListByLocationPager("eastus", 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.DNSPrivateViewListResult = armoracledatabase.DNSPrivateViewListResult{ - // Value: []*armoracledatabase.DNSPrivateView{ - // { - // Type: to.Ptr("Oracle.Database/locations/dnsPrivateViews"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dnsPrivateViews/ocid1....aaaaaa"), - // Properties: &armoracledatabase.DNSPrivateViewProperties{ - // DisplayName: to.Ptr("example-dns-private-view1"), - // IsProtected: to.Ptr(false), - // LifecycleState: to.Ptr(armoracledatabase.DNSPrivateViewsLifecycleStateActive), - // Ocid: to.Ptr("ocid1....aaaaaa"), - // Self: to.Ptr("https://api.example.com/view1"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-26T12:34:56.000Z"); return t}()), - // TimeUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-26T14:00:00.000Z"); return t}()), - // }, - // }, - // { - // Type: to.Ptr("Oracle.Database/locations/dnsPrivateViews"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dnsPrivateViews/ocid1....aaaaab"), - // Properties: &armoracledatabase.DNSPrivateViewProperties{ - // DisplayName: to.Ptr("example-dns-private-view2"), - // IsProtected: to.Ptr(true), - // LifecycleState: to.Ptr(armoracledatabase.DNSPrivateViewsLifecycleState("Creating")), - // Ocid: to.Ptr("ocid1....aaaaab"), - // Self: to.Ptr("https://api.example.com/view2"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-27T09:45:00.000Z"); return t}()), - // TimeUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-27T10:30:00.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dnsPrivateViews_get.json -func ExampleDNSPrivateViewsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDNSPrivateViewsClient().Get(ctx, "eastus", "ocid1....aaaaaa", 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.DNSPrivateView = armoracledatabase.DNSPrivateView{ - // Type: to.Ptr("Oracle.Database/locations/dnsPrivateViews"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dnsPrivateViews/ocid1....aaaaaa"), - // Properties: &armoracledatabase.DNSPrivateViewProperties{ - // DisplayName: to.Ptr("example-dns-private-view"), - // IsProtected: to.Ptr(false), - // LifecycleState: to.Ptr(armoracledatabase.DNSPrivateViewsLifecycleStateActive), - // Ocid: to.Ptr("ocid1....aaaaaa"), - // Self: to.Ptr("https://api.example.com/your-dns-private-view"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-26T12:34:56.000Z"); return t}()), - // TimeUpdated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-26T14:00:00.000Z"); return t}()), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client.go index 15733949a0c4..1e3d217d0d1b 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_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 armoracledatabase @@ -46,7 +42,7 @@ func NewDNSPrivateZonesClient(subscriptionID string, credential azcore.TokenCred // Get - Get a DnsPrivateZone // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - dnsprivatezonename - DnsPrivateZone name // - options - DNSPrivateZonesClientGetOptions contains the optional parameters for the DNSPrivateZonesClient.Get method. @@ -73,7 +69,7 @@ func (client *DNSPrivateZonesClient) Get(ctx context.Context, location string, d } // getCreateRequest creates the Get request. -func (client *DNSPrivateZonesClient) getCreateRequest(ctx context.Context, location string, dnsprivatezonename string, options *DNSPrivateZonesClientGetOptions) (*policy.Request, error) { +func (client *DNSPrivateZonesClient) getCreateRequest(ctx context.Context, location string, dnsprivatezonename string, _ *DNSPrivateZonesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateZones/{dnsprivatezonename}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -92,7 +88,7 @@ func (client *DNSPrivateZonesClient) getCreateRequest(ctx context.Context, locat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -107,9 +103,9 @@ func (client *DNSPrivateZonesClient) getHandleResponse(resp *http.Response) (DNS return result, nil } -// NewListByLocationPager - List DnsPrivateZone resources by Location +// NewListByLocationPager - List DnsPrivateZone resources by SubscriptionLocationResource // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - options - DNSPrivateZonesClientListByLocationOptions contains the optional parameters for the DNSPrivateZonesClient.NewListByLocationPager // method. @@ -137,7 +133,7 @@ func (client *DNSPrivateZonesClient) NewListByLocationPager(location string, opt } // listByLocationCreateRequest creates the ListByLocation request. -func (client *DNSPrivateZonesClient) listByLocationCreateRequest(ctx context.Context, location string, options *DNSPrivateZonesClientListByLocationOptions) (*policy.Request, error) { +func (client *DNSPrivateZonesClient) listByLocationCreateRequest(ctx context.Context, location string, _ *DNSPrivateZonesClientListByLocationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/dnsPrivateZones" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -152,7 +148,7 @@ func (client *DNSPrivateZonesClient) listByLocationCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client_example_test.go deleted file mode 100644 index b15f526f959e..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/dnsprivatezones_client_example_test.go +++ /dev/null @@ -1,111 +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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dnsPrivateZones_listByLocation.json -func ExampleDNSPrivateZonesClient_NewListByLocationPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDNSPrivateZonesClient().NewListByLocationPager("eastus", 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.DNSPrivateZoneListResult = armoracledatabase.DNSPrivateZoneListResult{ - // Value: []*armoracledatabase.DNSPrivateZone{ - // { - // Type: to.Ptr("Oracle.Database/locations/dnsPrivateZones"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dnsPrivateZones/zone1"), - // Properties: &armoracledatabase.DNSPrivateZoneProperties{ - // IsProtected: to.Ptr(false), - // LifecycleState: to.Ptr(armoracledatabase.DNSPrivateZonesLifecycleStateActive), - // Ocid: to.Ptr("zone-id-1"), - // Self: to.Ptr("https://api.example.com/zone1"), - // Serial: to.Ptr[int32](12345), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-26T12:34:56.000Z"); return t}()), - // Version: to.Ptr("1.0.0.0"), - // ViewID: to.Ptr("view-id-1"), - // ZoneType: to.Ptr(armoracledatabase.ZoneTypePrimary), - // }, - // }, - // { - // Type: to.Ptr("Oracle.Database/locations/dnsPrivateZones"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dnsPrivateZones/zone2"), - // Properties: &armoracledatabase.DNSPrivateZoneProperties{ - // IsProtected: to.Ptr(true), - // LifecycleState: to.Ptr(armoracledatabase.DNSPrivateZonesLifecycleStateCreating), - // Ocid: to.Ptr("zone-id-2"), - // Self: to.Ptr("https://api.example.com/zone2"), - // Serial: to.Ptr[int32](54321), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-27T09:45:00.000Z"); return t}()), - // Version: to.Ptr("2.0.0.0"), - // ViewID: to.Ptr("view-id-2"), - // ZoneType: to.Ptr(armoracledatabase.ZoneTypeSecondary), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/dnsPrivateZones_get.json -func ExampleDNSPrivateZonesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDNSPrivateZonesClient().Get(ctx, "eastus", "example-dns-private-zone", 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.DNSPrivateZone = armoracledatabase.DNSPrivateZone{ - // Type: to.Ptr("Oracle.Database/locations/dnsPrivateZones"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/dnsPrivateZones/example-dns-private-zone"), - // Properties: &armoracledatabase.DNSPrivateZoneProperties{ - // IsProtected: to.Ptr(false), - // LifecycleState: to.Ptr(armoracledatabase.DNSPrivateZonesLifecycleStateActive), - // Ocid: to.Ptr("your-zone-id"), - // Self: to.Ptr("https://api.example.com/your-dns-private-zone"), - // Serial: to.Ptr[int32](12345), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-26T12:34:56.000Z"); return t}()), - // Version: to.Ptr("1.0.0.0"), - // ViewID: to.Ptr("your-view-id"), - // ZoneType: to.Ptr(armoracledatabase.ZoneTypePrimary), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/exadbvmclusters_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/exadbvmclusters_client.go new file mode 100644 index 000000000000..6c94bfd4cf4f --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/exadbvmclusters_client.go @@ -0,0 +1,538 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armoracledatabase + +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" +) + +// ExadbVMClustersClient contains the methods for the ExadbVMClusters group. +// Don't use this type directly, use NewExadbVMClustersClient() instead. +type ExadbVMClustersClient struct { + internal *arm.Client + subscriptionID string +} + +// NewExadbVMClustersClient creates a new instance of ExadbVMClustersClient 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 NewExadbVMClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExadbVMClustersClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExadbVMClustersClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Create a ExadbVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - exadbVMClusterName - The name of the ExadbVmCluster +// - resource - Resource create parameters. +// - options - ExadbVMClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the ExadbVMClustersClient.BeginCreateOrUpdate +// method. +func (client *ExadbVMClustersClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, exadbVMClusterName string, resource ExadbVMCluster, options *ExadbVMClustersClientBeginCreateOrUpdateOptions) (*runtime.Poller[ExadbVMClustersClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, exadbVMClusterName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExadbVMClustersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExadbVMClustersClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Create a ExadbVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +func (client *ExadbVMClustersClient) createOrUpdate(ctx context.Context, resourceGroupName string, exadbVMClusterName string, resource ExadbVMCluster, options *ExadbVMClustersClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ExadbVMClustersClient.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, exadbVMClusterName, 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 *ExadbVMClustersClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, exadbVMClusterName string, resource ExadbVMCluster, _ *ExadbVMClustersClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if exadbVMClusterName == "" { + return nil, errors.New("parameter exadbVMClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exadbVmClusterName}", url.PathEscape(exadbVMClusterName)) + 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-03-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 +} + +// BeginDelete - Delete a ExadbVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - exadbVMClusterName - The name of the ExadbVmCluster +// - options - ExadbVMClustersClientBeginDeleteOptions contains the optional parameters for the ExadbVMClustersClient.BeginDelete +// method. +func (client *ExadbVMClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, exadbVMClusterName string, options *ExadbVMClustersClientBeginDeleteOptions) (*runtime.Poller[ExadbVMClustersClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, exadbVMClusterName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExadbVMClustersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExadbVMClustersClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a ExadbVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +func (client *ExadbVMClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, exadbVMClusterName string, options *ExadbVMClustersClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ExadbVMClustersClient.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, exadbVMClusterName, 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 *ExadbVMClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, exadbVMClusterName string, _ *ExadbVMClustersClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if exadbVMClusterName == "" { + return nil, errors.New("parameter exadbVMClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exadbVmClusterName}", url.PathEscape(exadbVMClusterName)) + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a ExadbVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - exadbVMClusterName - The name of the ExadbVmCluster +// - options - ExadbVMClustersClientGetOptions contains the optional parameters for the ExadbVMClustersClient.Get method. +func (client *ExadbVMClustersClient) Get(ctx context.Context, resourceGroupName string, exadbVMClusterName string, options *ExadbVMClustersClientGetOptions) (ExadbVMClustersClientGetResponse, error) { + var err error + const operationName = "ExadbVMClustersClient.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, exadbVMClusterName, options) + if err != nil { + return ExadbVMClustersClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExadbVMClustersClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExadbVMClustersClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ExadbVMClustersClient) getCreateRequest(ctx context.Context, resourceGroupName string, exadbVMClusterName string, _ *ExadbVMClustersClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if exadbVMClusterName == "" { + return nil, errors.New("parameter exadbVMClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exadbVmClusterName}", url.PathEscape(exadbVMClusterName)) + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExadbVMClustersClient) getHandleResponse(resp *http.Response) (ExadbVMClustersClientGetResponse, error) { + result := ExadbVMClustersClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExadbVMCluster); err != nil { + return ExadbVMClustersClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List ExadbVmCluster resources by resource group +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ExadbVMClustersClientListByResourceGroupOptions contains the optional parameters for the ExadbVMClustersClient.NewListByResourceGroupPager +// method. +func (client *ExadbVMClustersClient) NewListByResourceGroupPager(resourceGroupName string, options *ExadbVMClustersClientListByResourceGroupOptions) *runtime.Pager[ExadbVMClustersClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ExadbVMClustersClientListByResourceGroupResponse]{ + More: func(page ExadbVMClustersClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExadbVMClustersClientListByResourceGroupResponse) (ExadbVMClustersClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExadbVMClustersClient.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 ExadbVMClustersClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ExadbVMClustersClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *ExadbVMClustersClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ExadbVMClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (ExadbVMClustersClientListByResourceGroupResponse, error) { + result := ExadbVMClustersClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExadbVMClusterListResult); err != nil { + return ExadbVMClustersClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List ExadbVmCluster resources by subscription ID +// +// Generated from API version 2025-03-01 +// - options - ExadbVMClustersClientListBySubscriptionOptions contains the optional parameters for the ExadbVMClustersClient.NewListBySubscriptionPager +// method. +func (client *ExadbVMClustersClient) NewListBySubscriptionPager(options *ExadbVMClustersClientListBySubscriptionOptions) *runtime.Pager[ExadbVMClustersClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ExadbVMClustersClientListBySubscriptionResponse]{ + More: func(page ExadbVMClustersClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExadbVMClustersClientListBySubscriptionResponse) (ExadbVMClustersClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExadbVMClustersClient.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 ExadbVMClustersClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ExadbVMClustersClient) listBySubscriptionCreateRequest(ctx context.Context, _ *ExadbVMClustersClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/exadbVmClusters" + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ExadbVMClustersClient) listBySubscriptionHandleResponse(resp *http.Response) (ExadbVMClustersClientListBySubscriptionResponse, error) { + result := ExadbVMClustersClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExadbVMClusterListResult); err != nil { + return ExadbVMClustersClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginRemoveVMs - Remove VMs from the VM Cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - exadbVMClusterName - The name of the ExadbVmCluster +// - body - The content of the action request +// - options - ExadbVMClustersClientBeginRemoveVMsOptions contains the optional parameters for the ExadbVMClustersClient.BeginRemoveVMs +// method. +func (client *ExadbVMClustersClient) BeginRemoveVMs(ctx context.Context, resourceGroupName string, exadbVMClusterName string, body RemoveVirtualMachineFromExadbVMClusterDetails, options *ExadbVMClustersClientBeginRemoveVMsOptions) (*runtime.Poller[ExadbVMClustersClientRemoveVMsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.removeVMs(ctx, resourceGroupName, exadbVMClusterName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExadbVMClustersClientRemoveVMsResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExadbVMClustersClientRemoveVMsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// RemoveVMs - Remove VMs from the VM Cluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +func (client *ExadbVMClustersClient) removeVMs(ctx context.Context, resourceGroupName string, exadbVMClusterName string, body RemoveVirtualMachineFromExadbVMClusterDetails, options *ExadbVMClustersClientBeginRemoveVMsOptions) (*http.Response, error) { + var err error + const operationName = "ExadbVMClustersClient.BeginRemoveVMs" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.removeVMsCreateRequest(ctx, resourceGroupName, exadbVMClusterName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// removeVMsCreateRequest creates the RemoveVMs request. +func (client *ExadbVMClustersClient) removeVMsCreateRequest(ctx context.Context, resourceGroupName string, exadbVMClusterName string, body RemoveVirtualMachineFromExadbVMClusterDetails, _ *ExadbVMClustersClientBeginRemoveVMsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}/removeVms" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if exadbVMClusterName == "" { + return nil, errors.New("parameter exadbVMClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exadbVmClusterName}", url.PathEscape(exadbVMClusterName)) + 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-03-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 +} + +// BeginUpdate - Update a ExadbVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - exadbVMClusterName - The name of the ExadbVmCluster +// - properties - The resource properties to be updated. +// - options - ExadbVMClustersClientBeginUpdateOptions contains the optional parameters for the ExadbVMClustersClient.BeginUpdate +// method. +func (client *ExadbVMClustersClient) BeginUpdate(ctx context.Context, resourceGroupName string, exadbVMClusterName string, properties ExadbVMClusterUpdate, options *ExadbVMClustersClientBeginUpdateOptions) (*runtime.Poller[ExadbVMClustersClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, exadbVMClusterName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExadbVMClustersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExadbVMClustersClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a ExadbVmCluster +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +func (client *ExadbVMClustersClient) update(ctx context.Context, resourceGroupName string, exadbVMClusterName string, properties ExadbVMClusterUpdate, options *ExadbVMClustersClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ExadbVMClustersClient.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, exadbVMClusterName, 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 *ExadbVMClustersClient) updateCreateRequest(ctx context.Context, resourceGroupName string, exadbVMClusterName string, properties ExadbVMClusterUpdate, _ *ExadbVMClustersClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if exadbVMClusterName == "" { + return nil, errors.New("parameter exadbVMClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exadbVmClusterName}", url.PathEscape(exadbVMClusterName)) + 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-03-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/oracledatabase/armoracledatabase/exadbvmclusters_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/exadbvmclusters_client_example_test.go new file mode 100644 index 000000000000..5d57b0fe1b41 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/exadbvmclusters_client_example_test.go @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armoracledatabase_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/oracledatabase/armoracledatabase/v2" + "log" +) + +// Generated from example definition: 2025-03-01/ExadbVmClusters_RemoveVms_MaximumSet_Gen.json +func ExampleExadbVMClustersClient_BeginRemoveVMs() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewExadbVMClustersClient().BeginRemoveVMs(ctx, "rgopenapi", "vmClusterName", armoracledatabase.RemoveVirtualMachineFromExadbVMClusterDetails{ + DbNodes: []*armoracledatabase.DbNodeDetails{ + { + DbNodeID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Oracle.Database/exadbVmClusters/vmCluster/dbNodes/dbNodeName"), + }, + }, + }, 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 = armoracledatabase.ExadbVMClustersClientRemoveVMsResponse{ + // ExadbVMCluster: &armoracledatabase.ExadbVMCluster{ + // Properties: &armoracledatabase.ExadbVMClusterProperties{ + // Ocid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), + // ClusterName: to.Ptr("hssswln"), + // BackupSubnetCidr: to.Ptr("fr"), + // NsgURL: to.Ptr("https://microsoft.com/a"), + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), + // LifecycleState: to.Ptr(armoracledatabase.ExadbVMClusterLifecycleStateProvisioning), + // VnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1"), + // SubnetID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), + // DataCollectionOptions: &armoracledatabase.DataCollectionOptions{ + // IsDiagnosticsEventsEnabled: to.Ptr(true), + // IsHealthMonitoringEnabled: to.Ptr(true), + // IsIncidentLogsEnabled: to.Ptr(true), + // }, + // DisplayName: to.Ptr("dyhkncxzzgcwlfkfygvqlvqbxekvkbhjprmuxtaukewjnfrrnfqgrqsjfgsayrezkspqplrduuomuvtpkqurcoqjdnadlvedgfngglcgafbxtcewxlgckvehhqgfwkokbjoqftunjsgfjwbdaftxoytsphydwogtlnfxxuzzjvqcrin"), + // Domain: to.Ptr("vzfak"), + // EnabledEcpuCount: to.Ptr[int32](0), + // ExascaleDbStorageVaultID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/exascaleDbStorageVaults/storageVaultName"), + // GridImageOcid: to.Ptr("ocid1.dbpatch.oc1..aaaaa3klq"), + // GridImageType: to.Ptr(armoracledatabase.GridImageTypeReleaseUpdate), + // GiVersion: to.Ptr("mwuazccgbujljfeqjpttmwqmppliba"), + // Hostname: to.Ptr("tdn"), + // LicenseModel: to.Ptr(armoracledatabase.LicenseModelLicenseIncluded), + // MemorySizeInGbs: to.Ptr[int32](6), + // NodeCount: to.Ptr[int32](8), + // NsgCidrs: []*armoracledatabase.NsgCidr{ + // { + // Source: to.Ptr("10.0.0.0/16"), + // DestinationPortRange: &armoracledatabase.PortRange{ + // Min: to.Ptr[int32](1520), + // Max: to.Ptr[int32](1522), + // }, + // }, + // }, + // PrivateZoneOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), + // ScanListenerPortTCP: to.Ptr[int32](9), + // ScanListenerPortTCPSSL: to.Ptr[int32](18), + // ListenerPort: to.Ptr[int32](20), + // Shape: to.Ptr("evenjblxxfsztdxlcr"), + // SSHPublicKeys: []*string{ + // to.Ptr("wiseakllkohemfmnoyteg"), + // }, + // SystemVersion: to.Ptr("udwsykstqawwjrvzebfyyccnjzhxtijvywlgnrkqxnboibyppistnbvqqsnsxmjnzeumgnatmarzfnjhglmtrknszthrxtwewwqjbkwytbhtjbgondtktkpvjmxdcuyjupr"), + // TimeZone: to.Ptr("ayuqnpfkasdzmxlfnkjzrenyogbvcysdbkstjhyjdgxygitlykihtwdiktilukyplgxovaonrqcqaviyaqgyrqfrklqvqyobnxgmzpqbgjhdtjdquhyqnvhavnqpfupaqhdedgdvfomeueeuwjjfiqiyxspybpyj"), + // TotalEcpuCount: to.Ptr[int32](56), + // VMFileSystemStorage: &armoracledatabase.ExadbVMClusterStorageDetails{ + // TotalSizeInGbs: to.Ptr[int32](10), + // }, + // LifecycleDetails: to.Ptr("tl"), + // ScanDNSName: to.Ptr("ya"), + // ScanIPIDs: []*string{ + // to.Ptr("hdjuwrxrykhbuhtehlwm"), + // }, + // ScanDNSRecordID: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), + // SnapshotFileSystemStorage: &armoracledatabase.ExadbVMClusterStorageDetails{ + // TotalSizeInGbs: to.Ptr[int32](10), + // }, + // TotalFileSystemStorage: &armoracledatabase.ExadbVMClusterStorageDetails{ + // TotalSizeInGbs: to.Ptr[int32](10), + // }, + // VipIDs: []*string{ + // to.Ptr("fleeucwejtkaxnquq"), + // }, + // ZoneOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), + // OciURL: to.Ptr("https://microsoft.com/a"), + // IormConfigCache: &armoracledatabase.ExadataIormConfig{ + // DbPlans: []*armoracledatabase.DbIormConfig{ + // { + // DbName: to.Ptr("db1"), + // FlashCacheLimit: to.Ptr("none"), + // Share: to.Ptr[int32](32), + // }, + // }, + // LifecycleDetails: to.Ptr("Disabled"), + // LifecycleState: to.Ptr(armoracledatabase.IormLifecycleStateDisabled), + // Objective: to.Ptr(armoracledatabase.ObjectiveLowLatency), + // }, + // BackupSubnetOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), + // SubnetOcid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), + // }, + // Zones: []*string{ + // to.Ptr("iupjvcfsbvfhrebwf"), + // }, + // Tags: map[string]*string{ + // "key9683": to.Ptr("umnfswbmhxzsomcluslxhnxxika"), + // }, + // Location: to.Ptr("xojp"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Oracle.Database/exadbVmClusters/vmCluster"), + // Name: to.Ptr("joekjadzkdyqh"), + // Type: to.Ptr("ugekszbnqazqsofdniamlclolkcsi"), + // SystemData: &armoracledatabase.SystemData{ + // CreatedBy: to.Ptr("ilrpjodjmvzhybazxipoplnql"), + // CreatedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // LastModifiedBy: to.Ptr("lhjbxchqkaia"), + // LastModifiedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbnodes_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbnodes_client.go new file mode 100644 index 000000000000..f5537f5a1fd6 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbnodes_client.go @@ -0,0 +1,260 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armoracledatabase + +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" +) + +// ExascaleDbNodesClient contains the methods for the ExascaleDbNodes group. +// Don't use this type directly, use NewExascaleDbNodesClient() instead. +type ExascaleDbNodesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewExascaleDbNodesClient creates a new instance of ExascaleDbNodesClient 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 NewExascaleDbNodesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExascaleDbNodesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExascaleDbNodesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginAction - VM actions on DbNode of ExadbVmCluster by the provided filter +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - exadbVMClusterName - The name of the ExadbVmCluster +// - exascaleDbNodeName - The name of the ExascaleDbNode +// - body - The content of the action request +// - options - ExascaleDbNodesClientBeginActionOptions contains the optional parameters for the ExascaleDbNodesClient.BeginAction +// method. +func (client *ExascaleDbNodesClient) BeginAction(ctx context.Context, resourceGroupName string, exadbVMClusterName string, exascaleDbNodeName string, body DbNodeAction, options *ExascaleDbNodesClientBeginActionOptions) (*runtime.Poller[ExascaleDbNodesClientActionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.action(ctx, resourceGroupName, exadbVMClusterName, exascaleDbNodeName, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExascaleDbNodesClientActionResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExascaleDbNodesClientActionResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Action - VM actions on DbNode of ExadbVmCluster by the provided filter +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +func (client *ExascaleDbNodesClient) action(ctx context.Context, resourceGroupName string, exadbVMClusterName string, exascaleDbNodeName string, body DbNodeAction, options *ExascaleDbNodesClientBeginActionOptions) (*http.Response, error) { + var err error + const operationName = "ExascaleDbNodesClient.BeginAction" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.actionCreateRequest(ctx, resourceGroupName, exadbVMClusterName, exascaleDbNodeName, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// actionCreateRequest creates the Action request. +func (client *ExascaleDbNodesClient) actionCreateRequest(ctx context.Context, resourceGroupName string, exadbVMClusterName string, exascaleDbNodeName string, body DbNodeAction, _ *ExascaleDbNodesClientBeginActionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}/dbNodes/{exascaleDbNodeName}/action" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if exadbVMClusterName == "" { + return nil, errors.New("parameter exadbVMClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exadbVmClusterName}", url.PathEscape(exadbVMClusterName)) + if exascaleDbNodeName == "" { + return nil, errors.New("parameter exascaleDbNodeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exascaleDbNodeName}", url.PathEscape(exascaleDbNodeName)) + 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-03-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 +} + +// Get - Get a ExascaleDbNode +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - exadbVMClusterName - The name of the ExadbVmCluster +// - exascaleDbNodeName - The name of the ExascaleDbNode +// - options - ExascaleDbNodesClientGetOptions contains the optional parameters for the ExascaleDbNodesClient.Get method. +func (client *ExascaleDbNodesClient) Get(ctx context.Context, resourceGroupName string, exadbVMClusterName string, exascaleDbNodeName string, options *ExascaleDbNodesClientGetOptions) (ExascaleDbNodesClientGetResponse, error) { + var err error + const operationName = "ExascaleDbNodesClient.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, exadbVMClusterName, exascaleDbNodeName, options) + if err != nil { + return ExascaleDbNodesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExascaleDbNodesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExascaleDbNodesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ExascaleDbNodesClient) getCreateRequest(ctx context.Context, resourceGroupName string, exadbVMClusterName string, exascaleDbNodeName string, _ *ExascaleDbNodesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}/dbNodes/{exascaleDbNodeName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if exadbVMClusterName == "" { + return nil, errors.New("parameter exadbVMClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exadbVmClusterName}", url.PathEscape(exadbVMClusterName)) + if exascaleDbNodeName == "" { + return nil, errors.New("parameter exascaleDbNodeName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exascaleDbNodeName}", url.PathEscape(exascaleDbNodeName)) + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExascaleDbNodesClient) getHandleResponse(resp *http.Response) (ExascaleDbNodesClientGetResponse, error) { + result := ExascaleDbNodesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExascaleDbNode); err != nil { + return ExascaleDbNodesClientGetResponse{}, err + } + return result, nil +} + +// NewListByParentPager - List ExascaleDbNode resources by ExadbVmCluster +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - exadbVMClusterName - The name of the ExadbVmCluster +// - options - ExascaleDbNodesClientListByParentOptions contains the optional parameters for the ExascaleDbNodesClient.NewListByParentPager +// method. +func (client *ExascaleDbNodesClient) NewListByParentPager(resourceGroupName string, exadbVMClusterName string, options *ExascaleDbNodesClientListByParentOptions) *runtime.Pager[ExascaleDbNodesClientListByParentResponse] { + return runtime.NewPager(runtime.PagingHandler[ExascaleDbNodesClientListByParentResponse]{ + More: func(page ExascaleDbNodesClientListByParentResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExascaleDbNodesClientListByParentResponse) (ExascaleDbNodesClientListByParentResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExascaleDbNodesClient.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, exadbVMClusterName, options) + }, nil) + if err != nil { + return ExascaleDbNodesClientListByParentResponse{}, err + } + return client.listByParentHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByParentCreateRequest creates the ListByParent request. +func (client *ExascaleDbNodesClient) listByParentCreateRequest(ctx context.Context, resourceGroupName string, exadbVMClusterName string, _ *ExascaleDbNodesClientListByParentOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exadbVmClusters/{exadbVmClusterName}/dbNodes" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if exadbVMClusterName == "" { + return nil, errors.New("parameter exadbVMClusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exadbVmClusterName}", url.PathEscape(exadbVMClusterName)) + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByParentHandleResponse handles the ListByParent response. +func (client *ExascaleDbNodesClient) listByParentHandleResponse(resp *http.Response) (ExascaleDbNodesClientListByParentResponse, error) { + result := ExascaleDbNodesClientListByParentResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExascaleDbNodeListResult); err != nil { + return ExascaleDbNodesClientListByParentResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbnodes_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbnodes_client_example_test.go new file mode 100644 index 000000000000..2da5631e3e90 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbnodes_client_example_test.go @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armoracledatabase_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/oracledatabase/armoracledatabase/v2" + "log" +) + +// Generated from example definition: 2025-03-01/ExascaleDbNodes_Action_MaximumSet_Gen.json +func ExampleExascaleDbNodesClient_BeginAction() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewExascaleDbNodesClient().BeginAction(ctx, "rgopenapi", "vmClusterName", "dbNodeName", armoracledatabase.DbNodeAction{ + Action: to.Ptr(armoracledatabase.DbNodeActionEnumStart), + }, 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 = armoracledatabase.ExascaleDbNodesClientActionResponse{ + // DbActionResponse: &armoracledatabase.DbActionResponse{ + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), + // }, + // } +} + +// Generated from example definition: 2025-03-01/ExascaleDbNodes_ListByParent_MaximumSet_Gen.json +func ExampleExascaleDbNodesClient_NewListByParentPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewExascaleDbNodesClient().NewListByParentPager("rgopenapi", "vmClusterName", 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 = armoracledatabase.ExascaleDbNodesClientListByParentResponse{ + // ExascaleDbNodeListResult: armoracledatabase.ExascaleDbNodeListResult{ + // Value: []*armoracledatabase.ExascaleDbNode{ + // { + // Properties: &armoracledatabase.ExascaleDbNodeProperties{ + // Ocid: to.Ptr("ocid1.dbnode.oc1..aaaaa3klq"), + // AdditionalDetails: to.Ptr("zjvaydzrzxrmtiolutkhyfumql"), + // CPUCoreCount: to.Ptr[int32](25), + // DbNodeStorageSizeInGbs: to.Ptr[int32](7), + // FaultDomain: to.Ptr("bgtzblfwbdooaj"), + // Hostname: to.Ptr("nmbmxqpkdqueswkwystaupanqrn"), + // LifecycleState: to.Ptr(armoracledatabase.DbNodeProvisioningStateAvailable), + // MaintenanceType: to.Ptr("ncsgznwyxmzcrqnmzbn"), + // MemorySizeInGbs: to.Ptr[int32](29), + // SoftwareStorageSizeInGb: to.Ptr[int32](14), + // TimeMaintenanceWindowEnd: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:38.078Z"); return t}()), + // TimeMaintenanceWindowStart: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:38.078Z"); return t}()), + // TotalCPUCoreCount: to.Ptr[int32](26), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Oracle.Database/exadbVmClusters/vmCluster/dbNodes/dbNodeName"), + // Name: to.Ptr("lkjpzwgzy"), + // Type: to.Ptr("zdrljrxhtseejhwvzox"), + // SystemData: &armoracledatabase.SystemData{ + // CreatedBy: to.Ptr("ilrpjodjmvzhybazxipoplnql"), + // CreatedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // LastModifiedBy: to.Ptr("lhjbxchqkaia"), + // LastModifiedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/ajhmfpn"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbstoragevaults_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbstoragevaults_client.go new file mode 100644 index 000000000000..45c3a186a87e --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbstoragevaults_client.go @@ -0,0 +1,458 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armoracledatabase + +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" +) + +// ExascaleDbStorageVaultsClient contains the methods for the ExascaleDbStorageVaults group. +// Don't use this type directly, use NewExascaleDbStorageVaultsClient() instead. +type ExascaleDbStorageVaultsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewExascaleDbStorageVaultsClient creates a new instance of ExascaleDbStorageVaultsClient 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 NewExascaleDbStorageVaultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExascaleDbStorageVaultsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ExascaleDbStorageVaultsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a ExascaleDbStorageVault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - exascaleDbStorageVaultName - The name of the ExascaleDbStorageVault +// - resource - Resource create parameters. +// - options - ExascaleDbStorageVaultsClientBeginCreateOptions contains the optional parameters for the ExascaleDbStorageVaultsClient.BeginCreate +// method. +func (client *ExascaleDbStorageVaultsClient) BeginCreate(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, resource ExascaleDbStorageVault, options *ExascaleDbStorageVaultsClientBeginCreateOptions) (*runtime.Poller[ExascaleDbStorageVaultsClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, exascaleDbStorageVaultName, resource, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExascaleDbStorageVaultsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExascaleDbStorageVaultsClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a ExascaleDbStorageVault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +func (client *ExascaleDbStorageVaultsClient) create(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, resource ExascaleDbStorageVault, options *ExascaleDbStorageVaultsClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "ExascaleDbStorageVaultsClient.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, exascaleDbStorageVaultName, 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 *ExascaleDbStorageVaultsClient) createCreateRequest(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, resource ExascaleDbStorageVault, _ *ExascaleDbStorageVaultsClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exascaleDbStorageVaults/{exascaleDbStorageVaultName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if exascaleDbStorageVaultName == "" { + return nil, errors.New("parameter exascaleDbStorageVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exascaleDbStorageVaultName}", url.PathEscape(exascaleDbStorageVaultName)) + 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-03-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 +} + +// BeginDelete - Delete a ExascaleDbStorageVault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - exascaleDbStorageVaultName - The name of the ExascaleDbStorageVault +// - options - ExascaleDbStorageVaultsClientBeginDeleteOptions contains the optional parameters for the ExascaleDbStorageVaultsClient.BeginDelete +// method. +func (client *ExascaleDbStorageVaultsClient) BeginDelete(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, options *ExascaleDbStorageVaultsClientBeginDeleteOptions) (*runtime.Poller[ExascaleDbStorageVaultsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, exascaleDbStorageVaultName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExascaleDbStorageVaultsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExascaleDbStorageVaultsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a ExascaleDbStorageVault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +func (client *ExascaleDbStorageVaultsClient) deleteOperation(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, options *ExascaleDbStorageVaultsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "ExascaleDbStorageVaultsClient.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, exascaleDbStorageVaultName, 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 *ExascaleDbStorageVaultsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, _ *ExascaleDbStorageVaultsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exascaleDbStorageVaults/{exascaleDbStorageVaultName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if exascaleDbStorageVaultName == "" { + return nil, errors.New("parameter exascaleDbStorageVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exascaleDbStorageVaultName}", url.PathEscape(exascaleDbStorageVaultName)) + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a ExascaleDbStorageVault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - exascaleDbStorageVaultName - The name of the ExascaleDbStorageVault +// - options - ExascaleDbStorageVaultsClientGetOptions contains the optional parameters for the ExascaleDbStorageVaultsClient.Get +// method. +func (client *ExascaleDbStorageVaultsClient) Get(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, options *ExascaleDbStorageVaultsClientGetOptions) (ExascaleDbStorageVaultsClientGetResponse, error) { + var err error + const operationName = "ExascaleDbStorageVaultsClient.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, exascaleDbStorageVaultName, options) + if err != nil { + return ExascaleDbStorageVaultsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ExascaleDbStorageVaultsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ExascaleDbStorageVaultsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ExascaleDbStorageVaultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, _ *ExascaleDbStorageVaultsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exascaleDbStorageVaults/{exascaleDbStorageVaultName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if exascaleDbStorageVaultName == "" { + return nil, errors.New("parameter exascaleDbStorageVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exascaleDbStorageVaultName}", url.PathEscape(exascaleDbStorageVaultName)) + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ExascaleDbStorageVaultsClient) getHandleResponse(resp *http.Response) (ExascaleDbStorageVaultsClientGetResponse, error) { + result := ExascaleDbStorageVaultsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExascaleDbStorageVault); err != nil { + return ExascaleDbStorageVaultsClientGetResponse{}, err + } + return result, nil +} + +// NewListByResourceGroupPager - List ExascaleDbStorageVault resources by resource group +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - ExascaleDbStorageVaultsClientListByResourceGroupOptions contains the optional parameters for the ExascaleDbStorageVaultsClient.NewListByResourceGroupPager +// method. +func (client *ExascaleDbStorageVaultsClient) NewListByResourceGroupPager(resourceGroupName string, options *ExascaleDbStorageVaultsClientListByResourceGroupOptions) *runtime.Pager[ExascaleDbStorageVaultsClientListByResourceGroupResponse] { + return runtime.NewPager(runtime.PagingHandler[ExascaleDbStorageVaultsClientListByResourceGroupResponse]{ + More: func(page ExascaleDbStorageVaultsClientListByResourceGroupResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExascaleDbStorageVaultsClientListByResourceGroupResponse) (ExascaleDbStorageVaultsClientListByResourceGroupResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExascaleDbStorageVaultsClient.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 ExascaleDbStorageVaultsClientListByResourceGroupResponse{}, err + } + return client.listByResourceGroupHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *ExascaleDbStorageVaultsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *ExascaleDbStorageVaultsClientListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exascaleDbStorageVaults" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *ExascaleDbStorageVaultsClient) listByResourceGroupHandleResponse(resp *http.Response) (ExascaleDbStorageVaultsClientListByResourceGroupResponse, error) { + result := ExascaleDbStorageVaultsClientListByResourceGroupResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExascaleDbStorageVaultListResult); err != nil { + return ExascaleDbStorageVaultsClientListByResourceGroupResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - List ExascaleDbStorageVault resources by subscription ID +// +// Generated from API version 2025-03-01 +// - options - ExascaleDbStorageVaultsClientListBySubscriptionOptions contains the optional parameters for the ExascaleDbStorageVaultsClient.NewListBySubscriptionPager +// method. +func (client *ExascaleDbStorageVaultsClient) NewListBySubscriptionPager(options *ExascaleDbStorageVaultsClientListBySubscriptionOptions) *runtime.Pager[ExascaleDbStorageVaultsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[ExascaleDbStorageVaultsClientListBySubscriptionResponse]{ + More: func(page ExascaleDbStorageVaultsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ExascaleDbStorageVaultsClientListBySubscriptionResponse) (ExascaleDbStorageVaultsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ExascaleDbStorageVaultsClient.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 ExascaleDbStorageVaultsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *ExascaleDbStorageVaultsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *ExascaleDbStorageVaultsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/exascaleDbStorageVaults" + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *ExascaleDbStorageVaultsClient) listBySubscriptionHandleResponse(resp *http.Response) (ExascaleDbStorageVaultsClientListBySubscriptionResponse, error) { + result := ExascaleDbStorageVaultsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ExascaleDbStorageVaultListResult); err != nil { + return ExascaleDbStorageVaultsClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// BeginUpdate - Update a ExascaleDbStorageVault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - exascaleDbStorageVaultName - The name of the ExascaleDbStorageVault +// - properties - The resource properties to be updated. +// - options - ExascaleDbStorageVaultsClientBeginUpdateOptions contains the optional parameters for the ExascaleDbStorageVaultsClient.BeginUpdate +// method. +func (client *ExascaleDbStorageVaultsClient) BeginUpdate(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, properties ExascaleDbStorageVaultTagsUpdate, options *ExascaleDbStorageVaultsClientBeginUpdateOptions) (*runtime.Poller[ExascaleDbStorageVaultsClientUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.update(ctx, resourceGroupName, exascaleDbStorageVaultName, properties, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ExascaleDbStorageVaultsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[ExascaleDbStorageVaultsClientUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Update - Update a ExascaleDbStorageVault +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +func (client *ExascaleDbStorageVaultsClient) update(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, properties ExascaleDbStorageVaultTagsUpdate, options *ExascaleDbStorageVaultsClientBeginUpdateOptions) (*http.Response, error) { + var err error + const operationName = "ExascaleDbStorageVaultsClient.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, exascaleDbStorageVaultName, 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 *ExascaleDbStorageVaultsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, properties ExascaleDbStorageVaultTagsUpdate, _ *ExascaleDbStorageVaultsClientBeginUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/exascaleDbStorageVaults/{exascaleDbStorageVaultName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if exascaleDbStorageVaultName == "" { + return nil, errors.New("parameter exascaleDbStorageVaultName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{exascaleDbStorageVaultName}", url.PathEscape(exascaleDbStorageVaultName)) + 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-03-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/oracledatabase/armoracledatabase/exascaledbstoragevaults_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbstoragevaults_client_example_test.go new file mode 100644 index 000000000000..26a63945003a --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/exascaledbstoragevaults_client_example_test.go @@ -0,0 +1,394 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armoracledatabase_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/oracledatabase/armoracledatabase/v2" + "log" +) + +// Generated from example definition: 2025-03-01/ExascaleDbStorageVaults_Create_MaximumSet_Gen.json +func ExampleExascaleDbStorageVaultsClient_BeginCreate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewExascaleDbStorageVaultsClient().BeginCreate(ctx, "rgopenapi", "vmClusterName", armoracledatabase.ExascaleDbStorageVault{ + Properties: &armoracledatabase.ExascaleDbStorageVaultProperties{ + AdditionalFlashCacheInPercent: to.Ptr[int32](0), + Description: to.Ptr("dmnvnnduldfmrmkkvvsdtuvmsmruxzzpsfdydgytlckutfozephjygjetrauvbdfcwmti"), + DisplayName: to.Ptr("hbsybtelyvhpalemszcvartlhwvskrnpiveqfblvkdihoytqaotdgsgauvgivzaftfgeiwlyeqzssicwrrnlxtsmeakbcsxabjlt"), + HighCapacityDatabaseStorageInput: &armoracledatabase.ExascaleDbStorageInputDetails{ + TotalSizeInGbs: to.Ptr[int32](21), + }, + HighCapacityDatabaseStorage: &armoracledatabase.ExascaleDbStorageDetails{ + AvailableSizeInGbs: to.Ptr[int32](28), + TotalSizeInGbs: to.Ptr[int32](16), + }, + TimeZone: to.Ptr("ltrbozwxjunncicrtzjrpqnqrcjgghohztrdlbfjrbkpenopyldwolslwgrgumjfkyovvkzcuxjujuxtjjzubvqvnhrswnbdgcbslopeofmtepbrrlymqwwszvsglmyuvlcuejshtpokirwklnwpcykhyinjmlqvxtyixlthtdishhmtipbygsayvgqzfrprgppylydlcskbmvwctxifdltippfvsxiughqbojqpqrekxsotnqsk"), + LifecycleState: to.Ptr(armoracledatabase.ExascaleDbStorageVaultLifecycleStateProvisioning), + Ocid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), + }, + Zones: []*string{ + to.Ptr("qk"), + }, + Tags: map[string]*string{ + "key7827": to.Ptr("xqi"), + }, + Location: to.Ptr("ltguhzffucaytqg"), + }, 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 = armoracledatabase.ExascaleDbStorageVaultsClientCreateResponse{ + // ExascaleDbStorageVault: &armoracledatabase.ExascaleDbStorageVault{ + // Properties: &armoracledatabase.ExascaleDbStorageVaultProperties{ + // AdditionalFlashCacheInPercent: to.Ptr[int32](0), + // Description: to.Ptr("dmnvnnduldfmrmkkvvsdtuvmsmruxzzpsfdydgytlckutfozephjygjetrauvbdfcwmti"), + // DisplayName: to.Ptr("hbsybtelyvhpalemszcvartlhwvskrnpiveqfblvkdihoytqaotdgsgauvgivzaftfgeiwlyeqzssicwrrnlxtsmeakbcsxabjlt"), + // HighCapacityDatabaseStorageInput: &armoracledatabase.ExascaleDbStorageInputDetails{ + // TotalSizeInGbs: to.Ptr[int32](21), + // }, + // HighCapacityDatabaseStorage: &armoracledatabase.ExascaleDbStorageDetails{ + // AvailableSizeInGbs: to.Ptr[int32](28), + // TotalSizeInGbs: to.Ptr[int32](16), + // }, + // TimeZone: to.Ptr("ltrbozwxjunncicrtzjrpqnqrcjgghohztrdlbfjrbkpenopyldwolslwgrgumjfkyovvkzcuxjujuxtjjzubvqvnhrswnbdgcbslopeofmtepbrrlymqwwszvsglmyuvlcuejshtpokirwklnwpcykhyinjmlqvxtyixlthtdishhmtipbygsayvgqzfrprgppylydlcskbmvwctxifdltippfvsxiughqbojqpqrekxsotnqsk"), + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), + // LifecycleState: to.Ptr(armoracledatabase.ExascaleDbStorageVaultLifecycleStateProvisioning), + // LifecycleDetails: to.Ptr("iiav"), + // VMClusterCount: to.Ptr[int32](26), + // Ocid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), + // OciURL: to.Ptr("https://microsoft.com/a"), + // }, + // Zones: []*string{ + // to.Ptr("qk"), + // }, + // Tags: map[string]*string{ + // "key7827": to.Ptr("xqi"), + // }, + // Location: to.Ptr("ltguhzffucaytqg"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/exascaleDbStorageVaults/storageVaultName"), + // Name: to.Ptr("s"), + // Type: to.Ptr("efxpfdvhkaiqveccmdmaghlxxnmpwb"), + // SystemData: &armoracledatabase.SystemData{ + // CreatedBy: to.Ptr("ilrpjodjmvzhybazxipoplnql"), + // CreatedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // LastModifiedBy: to.Ptr("lhjbxchqkaia"), + // LastModifiedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-03-01/ExascaleDbStorageVaults_Delete_MaximumSet_Gen.json +func ExampleExascaleDbStorageVaultsClient_BeginDelete() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewExascaleDbStorageVaultsClient().BeginDelete(ctx, "rgopenapi", "vmClusterName", 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-03-01/ExascaleDbStorageVaults_Get_MaximumSet_Gen.json +func ExampleExascaleDbStorageVaultsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewExascaleDbStorageVaultsClient().Get(ctx, "rgopenapi", "vmClusterName", 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 = armoracledatabase.ExascaleDbStorageVaultsClientGetResponse{ + // ExascaleDbStorageVault: &armoracledatabase.ExascaleDbStorageVault{ + // Properties: &armoracledatabase.ExascaleDbStorageVaultProperties{ + // AdditionalFlashCacheInPercent: to.Ptr[int32](0), + // Description: to.Ptr("dmnvnnduldfmrmkkvvsdtuvmsmruxzzpsfdydgytlckutfozephjygjetrauvbdfcwmti"), + // DisplayName: to.Ptr("hbsybtelyvhpalemszcvartlhwvskrnpiveqfblvkdihoytqaotdgsgauvgivzaftfgeiwlyeqzssicwrrnlxtsmeakbcsxabjlt"), + // HighCapacityDatabaseStorageInput: &armoracledatabase.ExascaleDbStorageInputDetails{ + // TotalSizeInGbs: to.Ptr[int32](21), + // }, + // HighCapacityDatabaseStorage: &armoracledatabase.ExascaleDbStorageDetails{ + // AvailableSizeInGbs: to.Ptr[int32](28), + // TotalSizeInGbs: to.Ptr[int32](16), + // }, + // TimeZone: to.Ptr("ltrbozwxjunncicrtzjrpqnqrcjgghohztrdlbfjrbkpenopyldwolslwgrgumjfkyovvkzcuxjujuxtjjzubvqvnhrswnbdgcbslopeofmtepbrrlymqwwszvsglmyuvlcuejshtpokirwklnwpcykhyinjmlqvxtyixlthtdishhmtipbygsayvgqzfrprgppylydlcskbmvwctxifdltippfvsxiughqbojqpqrekxsotnqsk"), + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), + // LifecycleState: to.Ptr(armoracledatabase.ExascaleDbStorageVaultLifecycleStateProvisioning), + // LifecycleDetails: to.Ptr("iiav"), + // VMClusterCount: to.Ptr[int32](26), + // Ocid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), + // OciURL: to.Ptr("https://microsoft.com/a"), + // }, + // Zones: []*string{ + // to.Ptr("qk"), + // }, + // Tags: map[string]*string{ + // "key7827": to.Ptr("xqi"), + // }, + // Location: to.Ptr("ltguhzffucaytqg"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/exascaleDbStorageVaults/storageVaultName"), + // Name: to.Ptr("s"), + // Type: to.Ptr("efxpfdvhkaiqveccmdmaghlxxnmpwb"), + // SystemData: &armoracledatabase.SystemData{ + // CreatedBy: to.Ptr("ilrpjodjmvzhybazxipoplnql"), + // CreatedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // LastModifiedBy: to.Ptr("lhjbxchqkaia"), + // LastModifiedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-03-01/ExascaleDbStorageVaults_ListByResourceGroup_MaximumSet_Gen.json +func ExampleExascaleDbStorageVaultsClient_NewListByResourceGroupPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewExascaleDbStorageVaultsClient().NewListByResourceGroupPager("rgopenapi", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + for _, v := range page.Value { + // You could use page here. We use blank identifier for just demo purposes. + _ = v + } + // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. + // page = armoracledatabase.ExascaleDbStorageVaultsClientListByResourceGroupResponse{ + // ExascaleDbStorageVaultListResult: armoracledatabase.ExascaleDbStorageVaultListResult{ + // Value: []*armoracledatabase.ExascaleDbStorageVault{ + // { + // Properties: &armoracledatabase.ExascaleDbStorageVaultProperties{ + // AdditionalFlashCacheInPercent: to.Ptr[int32](0), + // Description: to.Ptr("dmnvnnduldfmrmkkvvsdtuvmsmruxzzpsfdydgytlckutfozephjygjetrauvbdfcwmti"), + // DisplayName: to.Ptr("hbsybtelyvhpalemszcvartlhwvskrnpiveqfblvkdihoytqaotdgsgauvgivzaftfgeiwlyeqzssicwrrnlxtsmeakbcsxabjlt"), + // HighCapacityDatabaseStorageInput: &armoracledatabase.ExascaleDbStorageInputDetails{ + // TotalSizeInGbs: to.Ptr[int32](21), + // }, + // HighCapacityDatabaseStorage: &armoracledatabase.ExascaleDbStorageDetails{ + // AvailableSizeInGbs: to.Ptr[int32](28), + // TotalSizeInGbs: to.Ptr[int32](16), + // }, + // TimeZone: to.Ptr("ltrbozwxjunncicrtzjrpqnqrcjgghohztrdlbfjrbkpenopyldwolslwgrgumjfkyovvkzcuxjujuxtjjzubvqvnhrswnbdgcbslopeofmtepbrrlymqwwszvsglmyuvlcuejshtpokirwklnwpcykhyinjmlqvxtyixlthtdishhmtipbygsayvgqzfrprgppylydlcskbmvwctxifdltippfvsxiughqbojqpqrekxsotnqsk"), + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), + // LifecycleState: to.Ptr(armoracledatabase.ExascaleDbStorageVaultLifecycleStateProvisioning), + // LifecycleDetails: to.Ptr("iiav"), + // VMClusterCount: to.Ptr[int32](26), + // Ocid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), + // OciURL: to.Ptr("https://microsoft.com/a"), + // }, + // Zones: []*string{ + // to.Ptr("qk"), + // }, + // Tags: map[string]*string{ + // "key7827": to.Ptr("xqi"), + // }, + // Location: to.Ptr("ltguhzffucaytqg"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/exascaleDbStorageVaults/storageVaultName"), + // Name: to.Ptr("s"), + // Type: to.Ptr("efxpfdvhkaiqveccmdmaghlxxnmpwb"), + // SystemData: &armoracledatabase.SystemData{ + // CreatedBy: to.Ptr("ilrpjodjmvzhybazxipoplnql"), + // CreatedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // LastModifiedBy: to.Ptr("lhjbxchqkaia"), + // LastModifiedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2025-03-01/ExascaleDbStorageVaults_ListBySubscription_MaximumSet_Gen.json +func ExampleExascaleDbStorageVaultsClient_NewListBySubscriptionPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewExascaleDbStorageVaultsClient().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 = armoracledatabase.ExascaleDbStorageVaultsClientListBySubscriptionResponse{ + // ExascaleDbStorageVaultListResult: armoracledatabase.ExascaleDbStorageVaultListResult{ + // Value: []*armoracledatabase.ExascaleDbStorageVault{ + // { + // Properties: &armoracledatabase.ExascaleDbStorageVaultProperties{ + // AdditionalFlashCacheInPercent: to.Ptr[int32](0), + // Description: to.Ptr("dmnvnnduldfmrmkkvvsdtuvmsmruxzzpsfdydgytlckutfozephjygjetrauvbdfcwmti"), + // DisplayName: to.Ptr("hbsybtelyvhpalemszcvartlhwvskrnpiveqfblvkdihoytqaotdgsgauvgivzaftfgeiwlyeqzssicwrrnlxtsmeakbcsxabjlt"), + // HighCapacityDatabaseStorageInput: &armoracledatabase.ExascaleDbStorageInputDetails{ + // TotalSizeInGbs: to.Ptr[int32](21), + // }, + // HighCapacityDatabaseStorage: &armoracledatabase.ExascaleDbStorageDetails{ + // AvailableSizeInGbs: to.Ptr[int32](28), + // TotalSizeInGbs: to.Ptr[int32](16), + // }, + // TimeZone: to.Ptr("ltrbozwxjunncicrtzjrpqnqrcjgghohztrdlbfjrbkpenopyldwolslwgrgumjfkyovvkzcuxjujuxtjjzubvqvnhrswnbdgcbslopeofmtepbrrlymqwwszvsglmyuvlcuejshtpokirwklnwpcykhyinjmlqvxtyixlthtdishhmtipbygsayvgqzfrprgppylydlcskbmvwctxifdltippfvsxiughqbojqpqrekxsotnqsk"), + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), + // LifecycleState: to.Ptr(armoracledatabase.ExascaleDbStorageVaultLifecycleStateProvisioning), + // LifecycleDetails: to.Ptr("iiav"), + // VMClusterCount: to.Ptr[int32](26), + // Ocid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), + // OciURL: to.Ptr("https://microsoft.com/a"), + // }, + // Zones: []*string{ + // to.Ptr("qk"), + // }, + // Tags: map[string]*string{ + // "key7827": to.Ptr("xqi"), + // }, + // Location: to.Ptr("ltguhzffucaytqg"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/exascaleDbStorageVaults/storageVaultName"), + // Name: to.Ptr("s"), + // Type: to.Ptr("efxpfdvhkaiqveccmdmaghlxxnmpwb"), + // SystemData: &armoracledatabase.SystemData{ + // CreatedBy: to.Ptr("ilrpjodjmvzhybazxipoplnql"), + // CreatedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // LastModifiedBy: to.Ptr("lhjbxchqkaia"), + // LastModifiedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} + +// Generated from example definition: 2025-03-01/ExascaleDbStorageVaults_Update_MaximumSet_Gen.json +func ExampleExascaleDbStorageVaultsClient_BeginUpdate() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + poller, err := clientFactory.NewExascaleDbStorageVaultsClient().BeginUpdate(ctx, "rgopenapi", "vmClusterName", armoracledatabase.ExascaleDbStorageVaultTagsUpdate{ + Tags: map[string]*string{ + "key6179": to.Ptr("ouj"), + }, + }, 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 = armoracledatabase.ExascaleDbStorageVaultsClientUpdateResponse{ + // ExascaleDbStorageVault: &armoracledatabase.ExascaleDbStorageVault{ + // Properties: &armoracledatabase.ExascaleDbStorageVaultProperties{ + // AdditionalFlashCacheInPercent: to.Ptr[int32](0), + // Description: to.Ptr("dmnvnnduldfmrmkkvvsdtuvmsmruxzzpsfdydgytlckutfozephjygjetrauvbdfcwmti"), + // DisplayName: to.Ptr("hbsybtelyvhpalemszcvartlhwvskrnpiveqfblvkdihoytqaotdgsgauvgivzaftfgeiwlyeqzssicwrrnlxtsmeakbcsxabjlt"), + // HighCapacityDatabaseStorageInput: &armoracledatabase.ExascaleDbStorageInputDetails{ + // TotalSizeInGbs: to.Ptr[int32](21), + // }, + // HighCapacityDatabaseStorage: &armoracledatabase.ExascaleDbStorageDetails{ + // AvailableSizeInGbs: to.Ptr[int32](28), + // TotalSizeInGbs: to.Ptr[int32](16), + // }, + // TimeZone: to.Ptr("ltrbozwxjunncicrtzjrpqnqrcjgghohztrdlbfjrbkpenopyldwolslwgrgumjfkyovvkzcuxjujuxtjjzubvqvnhrswnbdgcbslopeofmtepbrrlymqwwszvsglmyuvlcuejshtpokirwklnwpcykhyinjmlqvxtyixlthtdishhmtipbygsayvgqzfrprgppylydlcskbmvwctxifdltippfvsxiughqbojqpqrekxsotnqsk"), + // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), + // LifecycleState: to.Ptr(armoracledatabase.ExascaleDbStorageVaultLifecycleStateProvisioning), + // LifecycleDetails: to.Ptr("iiav"), + // VMClusterCount: to.Ptr[int32](26), + // Ocid: to.Ptr("ocid1.autonomousdatabase.oc1..aaaaa3klq"), + // OciURL: to.Ptr("https://microsoft.com/a"), + // }, + // Zones: []*string{ + // to.Ptr("qk"), + // }, + // Tags: map[string]*string{ + // "key7827": to.Ptr("xqi"), + // }, + // Location: to.Ptr("ltguhzffucaytqg"), + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/exascaleDbStorageVaults/storageVaultName"), + // Name: to.Ptr("s"), + // Type: to.Ptr("efxpfdvhkaiqveccmdmaghlxxnmpwb"), + // SystemData: &armoracledatabase.SystemData{ + // CreatedBy: to.Ptr("ilrpjodjmvzhybazxipoplnql"), + // CreatedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // LastModifiedBy: to.Ptr("lhjbxchqkaia"), + // LastModifiedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // }, + // }, + // } +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasebackups_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasebackups_server.go index 5e0bd6cdfd6b..3d7687796501 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasebackups_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasebackups_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -29,20 +25,20 @@ type AutonomousDatabaseBackupsServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, resource armoracledatabase.AutonomousDatabaseBackup, options *armoracledatabase.AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method AutonomousDatabaseBackupsClient.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, autonomousdatabasename string, adbbackupid string, options *armoracledatabase.AutonomousDatabaseBackupsClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method AutonomousDatabaseBackupsClient.Get // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, options *armoracledatabase.AutonomousDatabaseBackupsClientGetOptions) (resp azfake.Responder[armoracledatabase.AutonomousDatabaseBackupsClientGetResponse], errResp azfake.ErrorResponder) - // NewListByAutonomousDatabasePager is the fake for method AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager + // NewListByParentPager is the fake for method AutonomousDatabaseBackupsClient.NewListByParentPager // HTTP status codes to indicate success: http.StatusOK - NewListByAutonomousDatabasePager func(resourceGroupName string, autonomousdatabasename string, options *armoracledatabase.AutonomousDatabaseBackupsClientListByAutonomousDatabaseOptions) (resp azfake.PagerResponder[armoracledatabase.AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse]) + NewListByParentPager func(resourceGroupName string, autonomousdatabasename string, options *armoracledatabase.AutonomousDatabaseBackupsClientListByParentOptions) (resp azfake.PagerResponder[armoracledatabase.AutonomousDatabaseBackupsClientListByParentResponse]) // BeginUpdate is the fake for method AutonomousDatabaseBackupsClient.BeginUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginUpdate func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, properties armoracledatabase.AutonomousDatabaseBackupUpdate, options *armoracledatabase.AutonomousDatabaseBackupsClientBeginUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientUpdateResponse], errResp azfake.ErrorResponder) + BeginUpdate func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, adbbackupid string, properties armoracledatabase.AutonomousDatabaseBackup, options *armoracledatabase.AutonomousDatabaseBackupsClientBeginUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewAutonomousDatabaseBackupsServerTransport creates a new instance of AutonomousDatabaseBackupsServerTransport with the provided implementation. @@ -50,22 +46,22 @@ type AutonomousDatabaseBackupsServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewAutonomousDatabaseBackupsServerTransport(srv *AutonomousDatabaseBackupsServer) *AutonomousDatabaseBackupsServerTransport { return &AutonomousDatabaseBackupsServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientDeleteResponse]](), - newListByAutonomousDatabasePager: newTracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientUpdateResponse]](), + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientDeleteResponse]](), + newListByParentPager: newTracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabaseBackupsClientListByParentResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientUpdateResponse]](), } } // AutonomousDatabaseBackupsServerTransport connects instances of armoracledatabase.AutonomousDatabaseBackupsClient to instances of AutonomousDatabaseBackupsServer. // Don't use this type directly, use NewAutonomousDatabaseBackupsServerTransport instead. type AutonomousDatabaseBackupsServerTransport struct { - srv *AutonomousDatabaseBackupsServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientDeleteResponse]] - newListByAutonomousDatabasePager *tracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse]] - beginUpdate *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientUpdateResponse]] + srv *AutonomousDatabaseBackupsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientDeleteResponse]] + newListByParentPager *tracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabaseBackupsClientListByParentResponse]] + beginUpdate *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabaseBackupsClientUpdateResponse]] } // Do implements the policy.Transporter interface for AutonomousDatabaseBackupsServerTransport. @@ -76,29 +72,48 @@ func (a *AutonomousDatabaseBackupsServerTransport) Do(req *http.Request) (*http. return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AutonomousDatabaseBackupsClient.BeginCreateOrUpdate": - resp, err = a.dispatchBeginCreateOrUpdate(req) - case "AutonomousDatabaseBackupsClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AutonomousDatabaseBackupsClient.Get": - resp, err = a.dispatchGet(req) - case "AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager": - resp, err = a.dispatchNewListByAutonomousDatabasePager(req) - case "AutonomousDatabaseBackupsClient.BeginUpdate": - resp, err = a.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AutonomousDatabaseBackupsServerTransport) 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 autonomousDatabaseBackupsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = autonomousDatabaseBackupsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AutonomousDatabaseBackupsClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AutonomousDatabaseBackupsClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AutonomousDatabaseBackupsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AutonomousDatabaseBackupsClient.NewListByParentPager": + res.resp, res.err = a.dispatchNewListByParentPager(req) + case "AutonomousDatabaseBackupsClient.BeginUpdate": + res.resp, res.err = a.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 (a *AutonomousDatabaseBackupsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -110,7 +125,7 @@ func (a *AutonomousDatabaseBackupsServerTransport) dispatchBeginCreateOrUpdate(r const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseBackups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AutonomousDatabaseBackup](req) @@ -162,7 +177,7 @@ func (a *AutonomousDatabaseBackupsServerTransport) dispatchBeginDelete(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseBackups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -190,9 +205,9 @@ func (a *AutonomousDatabaseBackupsServerTransport) dispatchBeginDelete(req *http return nil, err } - if !contains([]int{http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { a.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) { a.beginDelete.remove(req) @@ -208,7 +223,7 @@ func (a *AutonomousDatabaseBackupsServerTransport) dispatchGet(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseBackups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -238,16 +253,16 @@ func (a *AutonomousDatabaseBackupsServerTransport) dispatchGet(req *http.Request return resp, nil } -func (a *AutonomousDatabaseBackupsServerTransport) dispatchNewListByAutonomousDatabasePager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByAutonomousDatabasePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByAutonomousDatabasePager not implemented")} +func (a *AutonomousDatabaseBackupsServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListByParentPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByParentPager not implemented")} } - newListByAutonomousDatabasePager := a.newListByAutonomousDatabasePager.get(req) - if newListByAutonomousDatabasePager == nil { + newListByParentPager := a.newListByParentPager.get(req) + if newListByParentPager == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseBackups` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -258,23 +273,23 @@ func (a *AutonomousDatabaseBackupsServerTransport) dispatchNewListByAutonomousDa if err != nil { return nil, err } - resp := a.srv.NewListByAutonomousDatabasePager(resourceGroupNameParam, autonomousdatabasenameParam, nil) - newListByAutonomousDatabasePager = &resp - a.newListByAutonomousDatabasePager.add(req, newListByAutonomousDatabasePager) - server.PagerResponderInjectNextLinks(newListByAutonomousDatabasePager, req, func(page *armoracledatabase.AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse, createLink func() string) { + resp := a.srv.NewListByParentPager(resourceGroupNameParam, autonomousdatabasenameParam, nil) + newListByParentPager = &resp + a.newListByParentPager.add(req, newListByParentPager) + server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *armoracledatabase.AutonomousDatabaseBackupsClientListByParentResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } - resp, err := server.PagerResponderNext(newListByAutonomousDatabasePager, req) + resp, err := server.PagerResponderNext(newListByParentPager, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByAutonomousDatabasePager.remove(req) + a.newListByParentPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } - if !server.PagerResponderMore(newListByAutonomousDatabasePager) { - a.newListByAutonomousDatabasePager.remove(req) + if !server.PagerResponderMore(newListByParentPager) { + a.newListByParentPager.remove(req) } return resp, nil } @@ -288,10 +303,10 @@ func (a *AutonomousDatabaseBackupsServerTransport) dispatchBeginUpdate(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseBackups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AutonomousDatabaseBackupUpdate](req) + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AutonomousDatabaseBackup](req) if err != nil { return nil, err } @@ -330,3 +345,9 @@ func (a *AutonomousDatabaseBackupsServerTransport) dispatchBeginUpdate(req *http return resp, nil } + +// set this to conditionally intercept incoming requests to AutonomousDatabaseBackupsServerTransport +var autonomousDatabaseBackupsServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/autonomousdatabasecharactersets_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasecharactersets_server.go index 9d1bd70f9046..8214d5631c2c 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasecharactersets_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasecharactersets_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -58,23 +54,42 @@ func (a *AutonomousDatabaseCharacterSetsServerTransport) Do(req *http.Request) ( return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AutonomousDatabaseCharacterSetsClient.Get": - resp, err = a.dispatchGet(req) - case "AutonomousDatabaseCharacterSetsClient.NewListByLocationPager": - resp, err = a.dispatchNewListByLocationPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AutonomousDatabaseCharacterSetsServerTransport) 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 autonomousDatabaseCharacterSetsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = autonomousDatabaseCharacterSetsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AutonomousDatabaseCharacterSetsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AutonomousDatabaseCharacterSetsClient.NewListByLocationPager": + res.resp, res.err = a.dispatchNewListByLocationPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AutonomousDatabaseCharacterSetsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -84,7 +99,7 @@ func (a *AutonomousDatabaseCharacterSetsServerTransport) dispatchGet(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseCharacterSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -119,7 +134,7 @@ func (a *AutonomousDatabaseCharacterSetsServerTransport) dispatchNewListByLocati const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseCharacterSets` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -146,3 +161,9 @@ func (a *AutonomousDatabaseCharacterSetsServerTransport) dispatchNewListByLocati } return resp, nil } + +// set this to conditionally intercept incoming requests to AutonomousDatabaseCharacterSetsServerTransport +var autonomousDatabaseCharacterSetsServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/autonomousdatabasenationalcharactersets_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasenationalcharactersets_server.go index dafabee3cd7d..f60857282ec1 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasenationalcharactersets_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabasenationalcharactersets_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -58,23 +54,42 @@ func (a *AutonomousDatabaseNationalCharacterSetsServerTransport) Do(req *http.Re return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AutonomousDatabaseNationalCharacterSetsClient.Get": - resp, err = a.dispatchGet(req) - case "AutonomousDatabaseNationalCharacterSetsClient.NewListByLocationPager": - resp, err = a.dispatchNewListByLocationPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AutonomousDatabaseNationalCharacterSetsServerTransport) 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 autonomousDatabaseNationalCharacterSetsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = autonomousDatabaseNationalCharacterSetsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AutonomousDatabaseNationalCharacterSetsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AutonomousDatabaseNationalCharacterSetsClient.NewListByLocationPager": + res.resp, res.err = a.dispatchNewListByLocationPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AutonomousDatabaseNationalCharacterSetsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -84,7 +99,7 @@ func (a *AutonomousDatabaseNationalCharacterSetsServerTransport) dispatchGet(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseNationalCharacterSets/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -119,7 +134,7 @@ func (a *AutonomousDatabaseNationalCharacterSetsServerTransport) dispatchNewList const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDatabaseNationalCharacterSets` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -146,3 +161,9 @@ func (a *AutonomousDatabaseNationalCharacterSetsServerTransport) dispatchNewList } return resp, nil } + +// set this to conditionally intercept incoming requests to AutonomousDatabaseNationalCharacterSetsServerTransport +var autonomousDatabaseNationalCharacterSetsServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/autonomousdatabases_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabases_server.go index ef146360cfaa..82b126747ac9 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabases_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabases_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -24,12 +20,16 @@ import ( // AutonomousDatabasesServer is a fake server for instances of the armoracledatabase.AutonomousDatabasesClient type. type AutonomousDatabasesServer struct { + // BeginChangeDisasterRecoveryConfiguration is the fake for method AutonomousDatabasesClient.BeginChangeDisasterRecoveryConfiguration + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginChangeDisasterRecoveryConfiguration func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, body armoracledatabase.DisasterRecoveryConfigurationDetails, options *armoracledatabase.AutonomousDatabasesClientBeginChangeDisasterRecoveryConfigurationOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientChangeDisasterRecoveryConfigurationResponse], errResp azfake.ErrorResponder) + // BeginCreateOrUpdate is the fake for method AutonomousDatabasesClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, autonomousdatabasename string, resource armoracledatabase.AutonomousDatabase, options *armoracledatabase.AutonomousDatabasesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method AutonomousDatabasesClient.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, autonomousdatabasename string, options *armoracledatabase.AutonomousDatabasesClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientDeleteResponse], errResp azfake.ErrorResponder) // BeginFailover is the fake for method AutonomousDatabasesClient.BeginFailover @@ -74,32 +74,34 @@ type AutonomousDatabasesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewAutonomousDatabasesServerTransport(srv *AutonomousDatabasesServer) *AutonomousDatabasesServerTransport { return &AutonomousDatabasesServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientDeleteResponse]](), - beginFailover: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientFailoverResponse]](), - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListBySubscriptionResponse]](), - beginRestore: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientRestoreResponse]](), - beginShrink: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientShrinkResponse]](), - beginSwitchover: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientSwitchoverResponse]](), - beginUpdate: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientUpdateResponse]](), + srv: srv, + beginChangeDisasterRecoveryConfiguration: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientChangeDisasterRecoveryConfigurationResponse]](), + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientDeleteResponse]](), + beginFailover: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientFailoverResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListBySubscriptionResponse]](), + beginRestore: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientRestoreResponse]](), + beginShrink: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientShrinkResponse]](), + beginSwitchover: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientSwitchoverResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientUpdateResponse]](), } } // AutonomousDatabasesServerTransport connects instances of armoracledatabase.AutonomousDatabasesClient to instances of AutonomousDatabasesServer. // Don't use this type directly, use NewAutonomousDatabasesServerTransport instead. type AutonomousDatabasesServerTransport struct { - srv *AutonomousDatabasesServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientDeleteResponse]] - beginFailover *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientFailoverResponse]] - newListByResourceGroupPager *tracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListBySubscriptionResponse]] - beginRestore *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientRestoreResponse]] - beginShrink *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientShrinkResponse]] - beginSwitchover *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientSwitchoverResponse]] - beginUpdate *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientUpdateResponse]] + srv *AutonomousDatabasesServer + beginChangeDisasterRecoveryConfiguration *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientChangeDisasterRecoveryConfigurationResponse]] + beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientDeleteResponse]] + beginFailover *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientFailoverResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armoracledatabase.AutonomousDatabasesClientListBySubscriptionResponse]] + beginRestore *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientRestoreResponse]] + beginShrink *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientShrinkResponse]] + beginSwitchover *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientSwitchoverResponse]] + beginUpdate *tracker[azfake.PollerResponder[armoracledatabase.AutonomousDatabasesClientUpdateResponse]] } // Do implements the policy.Transporter interface for AutonomousDatabasesServerTransport. @@ -110,40 +112,109 @@ func (a *AutonomousDatabasesServerTransport) 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 "AutonomousDatabasesClient.BeginCreateOrUpdate": - resp, err = a.dispatchBeginCreateOrUpdate(req) - case "AutonomousDatabasesClient.BeginDelete": - resp, err = a.dispatchBeginDelete(req) - case "AutonomousDatabasesClient.BeginFailover": - resp, err = a.dispatchBeginFailover(req) - case "AutonomousDatabasesClient.GenerateWallet": - resp, err = a.dispatchGenerateWallet(req) - case "AutonomousDatabasesClient.Get": - resp, err = a.dispatchGet(req) - case "AutonomousDatabasesClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AutonomousDatabasesClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "AutonomousDatabasesClient.BeginRestore": - resp, err = a.dispatchBeginRestore(req) - case "AutonomousDatabasesClient.BeginShrink": - resp, err = a.dispatchBeginShrink(req) - case "AutonomousDatabasesClient.BeginSwitchover": - resp, err = a.dispatchBeginSwitchover(req) - case "AutonomousDatabasesClient.BeginUpdate": - resp, err = a.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) + return a.dispatchToMethodFake(req, method) +} + +func (a *AutonomousDatabasesServerTransport) 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 autonomousDatabasesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = autonomousDatabasesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AutonomousDatabasesClient.BeginChangeDisasterRecoveryConfiguration": + res.resp, res.err = a.dispatchBeginChangeDisasterRecoveryConfiguration(req) + case "AutonomousDatabasesClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AutonomousDatabasesClient.BeginDelete": + res.resp, res.err = a.dispatchBeginDelete(req) + case "AutonomousDatabasesClient.BeginFailover": + res.resp, res.err = a.dispatchBeginFailover(req) + case "AutonomousDatabasesClient.GenerateWallet": + res.resp, res.err = a.dispatchGenerateWallet(req) + case "AutonomousDatabasesClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AutonomousDatabasesClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AutonomousDatabasesClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + case "AutonomousDatabasesClient.BeginRestore": + res.resp, res.err = a.dispatchBeginRestore(req) + case "AutonomousDatabasesClient.BeginShrink": + res.resp, res.err = a.dispatchBeginShrink(req) + case "AutonomousDatabasesClient.BeginSwitchover": + res.resp, res.err = a.dispatchBeginSwitchover(req) + case "AutonomousDatabasesClient.BeginUpdate": + res.resp, res.err = a.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 (a *AutonomousDatabasesServerTransport) dispatchBeginChangeDisasterRecoveryConfiguration(req *http.Request) (*http.Response, error) { + if a.srv.BeginChangeDisasterRecoveryConfiguration == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginChangeDisasterRecoveryConfiguration not implemented")} + } + beginChangeDisasterRecoveryConfiguration := a.beginChangeDisasterRecoveryConfiguration.get(req) + if beginChangeDisasterRecoveryConfiguration == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/changeDisasterRecoveryConfiguration` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.DisasterRecoveryConfigurationDetails](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + autonomousdatabasenameParam, err := url.PathUnescape(matches[regex.SubexpIndex("autonomousdatabasename")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.BeginChangeDisasterRecoveryConfiguration(req.Context(), resourceGroupNameParam, autonomousdatabasenameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginChangeDisasterRecoveryConfiguration = &respr + a.beginChangeDisasterRecoveryConfiguration.add(req, beginChangeDisasterRecoveryConfiguration) } + resp, err := server.PollerResponderNext(beginChangeDisasterRecoveryConfiguration, req) if err != nil { return nil, err } + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + a.beginChangeDisasterRecoveryConfiguration.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginChangeDisasterRecoveryConfiguration) { + a.beginChangeDisasterRecoveryConfiguration.remove(req) + } + return resp, nil } @@ -156,7 +227,7 @@ func (a *AutonomousDatabasesServerTransport) dispatchBeginCreateOrUpdate(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AutonomousDatabase](req) @@ -204,7 +275,7 @@ func (a *AutonomousDatabasesServerTransport) dispatchBeginDelete(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -228,9 +299,9 @@ func (a *AutonomousDatabasesServerTransport) 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) { a.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) { a.beginDelete.remove(req) @@ -248,7 +319,7 @@ func (a *AutonomousDatabasesServerTransport) dispatchBeginFailover(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/failover` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.PeerDbDetails](req) @@ -294,7 +365,7 @@ func (a *AutonomousDatabasesServerTransport) dispatchGenerateWallet(req *http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/generateWallet` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.GenerateAutonomousDatabaseWalletDetails](req) @@ -331,7 +402,7 @@ func (a *AutonomousDatabasesServerTransport) dispatchGet(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -366,7 +437,7 @@ func (a *AutonomousDatabasesServerTransport) dispatchNewListByResourceGroupPager const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -403,7 +474,7 @@ func (a *AutonomousDatabasesServerTransport) dispatchNewListBySubscriptionPager( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := a.srv.NewListBySubscriptionPager(nil) @@ -436,7 +507,7 @@ func (a *AutonomousDatabasesServerTransport) dispatchBeginRestore(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/restore` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.RestoreAutonomousDatabaseDetails](req) @@ -484,7 +555,7 @@ func (a *AutonomousDatabasesServerTransport) dispatchBeginShrink(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/shrink` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -528,7 +599,7 @@ func (a *AutonomousDatabasesServerTransport) dispatchBeginSwitchover(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/switchover` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.PeerDbDetails](req) @@ -576,7 +647,7 @@ func (a *AutonomousDatabasesServerTransport) dispatchBeginUpdate(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/autonomousDatabases/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AutonomousDatabaseUpdate](req) @@ -614,3 +685,9 @@ func (a *AutonomousDatabasesServerTransport) dispatchBeginUpdate(req *http.Reque return resp, nil } + +// set this to conditionally intercept incoming requests to AutonomousDatabasesServerTransport +var autonomousDatabasesServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/autonomousdatabaseversions_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabaseversions_server.go index de5dcb9d5459..89b0d76d93d0 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabaseversions_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/autonomousdatabaseversions_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -58,23 +54,42 @@ func (a *AutonomousDatabaseVersionsServerTransport) Do(req *http.Request) (*http return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AutonomousDatabaseVersionsClient.Get": - resp, err = a.dispatchGet(req) - case "AutonomousDatabaseVersionsClient.NewListByLocationPager": - resp, err = a.dispatchNewListByLocationPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AutonomousDatabaseVersionsServerTransport) 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 autonomousDatabaseVersionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = autonomousDatabaseVersionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AutonomousDatabaseVersionsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AutonomousDatabaseVersionsClient.NewListByLocationPager": + res.resp, res.err = a.dispatchNewListByLocationPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AutonomousDatabaseVersionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -84,7 +99,7 @@ func (a *AutonomousDatabaseVersionsServerTransport) dispatchGet(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDbVersions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -119,7 +134,7 @@ func (a *AutonomousDatabaseVersionsServerTransport) dispatchNewListByLocationPag const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/autonomousDbVersions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -146,3 +161,9 @@ func (a *AutonomousDatabaseVersionsServerTransport) dispatchNewListByLocationPag } return resp, nil } + +// set this to conditionally intercept incoming requests to AutonomousDatabaseVersionsServerTransport +var autonomousDatabaseVersionsServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/cloudexadatainfrastructures_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudexadatainfrastructures_server.go index 851f6f489568..ab273096f19b 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudexadatainfrastructures_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudexadatainfrastructures_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -33,7 +29,7 @@ type CloudExadataInfrastructuresServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, resource armoracledatabase.CloudExadataInfrastructure, options *armoracledatabase.CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CloudExadataInfrastructuresClient.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, cloudexadatainfrastructurename string, options *armoracledatabase.CloudExadataInfrastructuresClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.CloudExadataInfrastructuresClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method CloudExadataInfrastructuresClient.Get @@ -88,33 +84,52 @@ func (c *CloudExadataInfrastructuresServerTransport) Do(req *http.Request) (*htt return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "CloudExadataInfrastructuresClient.BeginAddStorageCapacity": - resp, err = c.dispatchBeginAddStorageCapacity(req) - case "CloudExadataInfrastructuresClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "CloudExadataInfrastructuresClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CloudExadataInfrastructuresClient.Get": - resp, err = c.dispatchGet(req) - case "CloudExadataInfrastructuresClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "CloudExadataInfrastructuresClient.NewListBySubscriptionPager": - resp, err = c.dispatchNewListBySubscriptionPager(req) - case "CloudExadataInfrastructuresClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return c.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (c *CloudExadataInfrastructuresServerTransport) 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 cloudExadataInfrastructuresServerTransportInterceptor != nil { + res.resp, res.err, intercepted = cloudExadataInfrastructuresServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CloudExadataInfrastructuresClient.BeginAddStorageCapacity": + res.resp, res.err = c.dispatchBeginAddStorageCapacity(req) + case "CloudExadataInfrastructuresClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "CloudExadataInfrastructuresClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CloudExadataInfrastructuresClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CloudExadataInfrastructuresClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "CloudExadataInfrastructuresClient.NewListBySubscriptionPager": + res.resp, res.err = c.dispatchNewListBySubscriptionPager(req) + case "CloudExadataInfrastructuresClient.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 *CloudExadataInfrastructuresServerTransport) dispatchBeginAddStorageCapacity(req *http.Request) (*http.Response, error) { @@ -126,7 +141,7 @@ func (c *CloudExadataInfrastructuresServerTransport) dispatchBeginAddStorageCapa const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/addStorageCapacity` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -170,7 +185,7 @@ func (c *CloudExadataInfrastructuresServerTransport) dispatchBeginCreateOrUpdate const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.CloudExadataInfrastructure](req) @@ -218,7 +233,7 @@ func (c *CloudExadataInfrastructuresServerTransport) dispatchBeginDelete(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -242,9 +257,9 @@ func (c *CloudExadataInfrastructuresServerTransport) dispatchBeginDelete(req *ht 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) @@ -260,7 +275,7 @@ func (c *CloudExadataInfrastructuresServerTransport) dispatchGet(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -295,7 +310,7 @@ func (c *CloudExadataInfrastructuresServerTransport) dispatchNewListByResourceGr const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -332,7 +347,7 @@ func (c *CloudExadataInfrastructuresServerTransport) dispatchNewListBySubscripti const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := c.srv.NewListBySubscriptionPager(nil) @@ -365,7 +380,7 @@ func (c *CloudExadataInfrastructuresServerTransport) dispatchBeginUpdate(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.CloudExadataInfrastructureUpdate](req) @@ -403,3 +418,9 @@ func (c *CloudExadataInfrastructuresServerTransport) dispatchBeginUpdate(req *ht return resp, nil } + +// set this to conditionally intercept incoming requests to CloudExadataInfrastructuresServerTransport +var cloudExadataInfrastructuresServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/cloudvmclusters_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudvmclusters_server.go index 36881c8e6c04..0b6245f49796 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudvmclusters_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/cloudvmclusters_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -33,7 +29,7 @@ type CloudVMClustersServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, cloudvmclustername string, resource armoracledatabase.CloudVMCluster, options *armoracledatabase.CloudVMClustersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.CloudVMClustersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method CloudVMClustersClient.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, cloudvmclustername string, options *armoracledatabase.CloudVMClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.CloudVMClustersClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method CloudVMClustersClient.Get @@ -98,37 +94,56 @@ func (c *CloudVMClustersServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "CloudVMClustersClient.BeginAddVMs": - resp, err = c.dispatchBeginAddVMs(req) - case "CloudVMClustersClient.BeginCreateOrUpdate": - resp, err = c.dispatchBeginCreateOrUpdate(req) - case "CloudVMClustersClient.BeginDelete": - resp, err = c.dispatchBeginDelete(req) - case "CloudVMClustersClient.Get": - resp, err = c.dispatchGet(req) - case "CloudVMClustersClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "CloudVMClustersClient.NewListBySubscriptionPager": - resp, err = c.dispatchNewListBySubscriptionPager(req) - case "CloudVMClustersClient.ListPrivateIPAddresses": - resp, err = c.dispatchListPrivateIPAddresses(req) - case "CloudVMClustersClient.BeginRemoveVMs": - resp, err = c.dispatchBeginRemoveVMs(req) - case "CloudVMClustersClient.BeginUpdate": - resp, err = c.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return c.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (c *CloudVMClustersServerTransport) 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 cloudVMClustersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = cloudVMClustersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CloudVMClustersClient.BeginAddVMs": + res.resp, res.err = c.dispatchBeginAddVMs(req) + case "CloudVMClustersClient.BeginCreateOrUpdate": + res.resp, res.err = c.dispatchBeginCreateOrUpdate(req) + case "CloudVMClustersClient.BeginDelete": + res.resp, res.err = c.dispatchBeginDelete(req) + case "CloudVMClustersClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CloudVMClustersClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "CloudVMClustersClient.NewListBySubscriptionPager": + res.resp, res.err = c.dispatchNewListBySubscriptionPager(req) + case "CloudVMClustersClient.ListPrivateIPAddresses": + res.resp, res.err = c.dispatchListPrivateIPAddresses(req) + case "CloudVMClustersClient.BeginRemoveVMs": + res.resp, res.err = c.dispatchBeginRemoveVMs(req) + case "CloudVMClustersClient.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 *CloudVMClustersServerTransport) dispatchBeginAddVMs(req *http.Request) (*http.Response, error) { @@ -140,7 +155,7 @@ func (c *CloudVMClustersServerTransport) dispatchBeginAddVMs(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/addVms` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AddRemoveDbNode](req) @@ -188,7 +203,7 @@ func (c *CloudVMClustersServerTransport) dispatchBeginCreateOrUpdate(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.CloudVMCluster](req) @@ -236,7 +251,7 @@ func (c *CloudVMClustersServerTransport) dispatchBeginDelete(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -260,9 +275,9 @@ func (c *CloudVMClustersServerTransport) 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) { 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) @@ -278,7 +293,7 @@ func (c *CloudVMClustersServerTransport) dispatchGet(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -313,7 +328,7 @@ func (c *CloudVMClustersServerTransport) dispatchNewListByResourceGroupPager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -350,7 +365,7 @@ func (c *CloudVMClustersServerTransport) dispatchNewListBySubscriptionPager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := c.srv.NewListBySubscriptionPager(nil) @@ -381,7 +396,7 @@ func (c *CloudVMClustersServerTransport) dispatchListPrivateIPAddresses(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listPrivateIpAddresses` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.PrivateIPAddressesFilter](req) @@ -404,7 +419,7 @@ func (c *CloudVMClustersServerTransport) dispatchListPrivateIPAddresses(req *htt 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).PrivateIPAddressPropertiesArray, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateIpAddressPropertiesArray, req) if err != nil { return nil, err } @@ -420,7 +435,7 @@ func (c *CloudVMClustersServerTransport) dispatchBeginRemoveVMs(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/removeVms` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AddRemoveDbNode](req) @@ -468,7 +483,7 @@ func (c *CloudVMClustersServerTransport) dispatchBeginUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.CloudVMClusterUpdate](req) @@ -506,3 +521,9 @@ func (c *CloudVMClustersServerTransport) dispatchBeginUpdate(req *http.Request) return resp, nil } + +// set this to conditionally intercept incoming requests to CloudVMClustersServerTransport +var cloudVMClustersServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/dbnodes_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbnodes_server.go index 592576157fa6..96e8b7bc6946 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbnodes_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbnodes_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -32,9 +28,9 @@ type DbNodesServer struct { // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, cloudvmclustername string, dbnodeocid string, options *armoracledatabase.DbNodesClientGetOptions) (resp azfake.Responder[armoracledatabase.DbNodesClientGetResponse], errResp azfake.ErrorResponder) - // NewListByCloudVMClusterPager is the fake for method DbNodesClient.NewListByCloudVMClusterPager + // NewListByParentPager is the fake for method DbNodesClient.NewListByParentPager // HTTP status codes to indicate success: http.StatusOK - NewListByCloudVMClusterPager func(resourceGroupName string, cloudvmclustername string, options *armoracledatabase.DbNodesClientListByCloudVMClusterOptions) (resp azfake.PagerResponder[armoracledatabase.DbNodesClientListByCloudVMClusterResponse]) + NewListByParentPager func(resourceGroupName string, cloudvmclustername string, options *armoracledatabase.DbNodesClientListByParentOptions) (resp azfake.PagerResponder[armoracledatabase.DbNodesClientListByParentResponse]) } // NewDbNodesServerTransport creates a new instance of DbNodesServerTransport with the provided implementation. @@ -42,18 +38,18 @@ type DbNodesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewDbNodesServerTransport(srv *DbNodesServer) *DbNodesServerTransport { return &DbNodesServerTransport{ - srv: srv, - beginAction: newTracker[azfake.PollerResponder[armoracledatabase.DbNodesClientActionResponse]](), - newListByCloudVMClusterPager: newTracker[azfake.PagerResponder[armoracledatabase.DbNodesClientListByCloudVMClusterResponse]](), + srv: srv, + beginAction: newTracker[azfake.PollerResponder[armoracledatabase.DbNodesClientActionResponse]](), + newListByParentPager: newTracker[azfake.PagerResponder[armoracledatabase.DbNodesClientListByParentResponse]](), } } // DbNodesServerTransport connects instances of armoracledatabase.DbNodesClient to instances of DbNodesServer. // Don't use this type directly, use NewDbNodesServerTransport instead. type DbNodesServerTransport struct { - srv *DbNodesServer - beginAction *tracker[azfake.PollerResponder[armoracledatabase.DbNodesClientActionResponse]] - newListByCloudVMClusterPager *tracker[azfake.PagerResponder[armoracledatabase.DbNodesClientListByCloudVMClusterResponse]] + srv *DbNodesServer + beginAction *tracker[azfake.PollerResponder[armoracledatabase.DbNodesClientActionResponse]] + newListByParentPager *tracker[azfake.PagerResponder[armoracledatabase.DbNodesClientListByParentResponse]] } // Do implements the policy.Transporter interface for DbNodesServerTransport. @@ -64,25 +60,44 @@ func (d *DbNodesServerTransport) 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 d.dispatchToMethodFake(req, method) +} - switch method { - case "DbNodesClient.BeginAction": - resp, err = d.dispatchBeginAction(req) - case "DbNodesClient.Get": - resp, err = d.dispatchGet(req) - case "DbNodesClient.NewListByCloudVMClusterPager": - resp, err = d.dispatchNewListByCloudVMClusterPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DbNodesServerTransport) 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 dbNodesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dbNodesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DbNodesClient.BeginAction": + res.resp, res.err = d.dispatchBeginAction(req) + case "DbNodesClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DbNodesClient.NewListByParentPager": + res.resp, res.err = d.dispatchNewListByParentPager(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 *DbNodesServerTransport) dispatchBeginAction(req *http.Request) (*http.Response, error) { @@ -94,7 +109,7 @@ func (d *DbNodesServerTransport) dispatchBeginAction(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/action` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.DbNodeAction](req) @@ -144,7 +159,7 @@ func (d *DbNodesServerTransport) dispatchGet(req *http.Request) (*http.Response, const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -174,16 +189,16 @@ func (d *DbNodesServerTransport) dispatchGet(req *http.Request) (*http.Response, return resp, nil } -func (d *DbNodesServerTransport) dispatchNewListByCloudVMClusterPager(req *http.Request) (*http.Response, error) { - if d.srv.NewListByCloudVMClusterPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByCloudVMClusterPager not implemented")} +func (d *DbNodesServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListByParentPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByParentPager not implemented")} } - newListByCloudVMClusterPager := d.newListByCloudVMClusterPager.get(req) - if newListByCloudVMClusterPager == nil { + newListByParentPager := d.newListByParentPager.get(req) + if newListByParentPager == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbNodes` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -194,23 +209,29 @@ func (d *DbNodesServerTransport) dispatchNewListByCloudVMClusterPager(req *http. if err != nil { return nil, err } - resp := d.srv.NewListByCloudVMClusterPager(resourceGroupNameParam, cloudvmclusternameParam, nil) - newListByCloudVMClusterPager = &resp - d.newListByCloudVMClusterPager.add(req, newListByCloudVMClusterPager) - server.PagerResponderInjectNextLinks(newListByCloudVMClusterPager, req, func(page *armoracledatabase.DbNodesClientListByCloudVMClusterResponse, createLink func() string) { + resp := d.srv.NewListByParentPager(resourceGroupNameParam, cloudvmclusternameParam, nil) + newListByParentPager = &resp + d.newListByParentPager.add(req, newListByParentPager) + server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *armoracledatabase.DbNodesClientListByParentResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } - resp, err := server.PagerResponderNext(newListByCloudVMClusterPager, req) + resp, err := server.PagerResponderNext(newListByParentPager, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListByCloudVMClusterPager.remove(req) + d.newListByParentPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } - if !server.PagerResponderMore(newListByCloudVMClusterPager) { - d.newListByCloudVMClusterPager.remove(req) + if !server.PagerResponderMore(newListByParentPager) { + d.newListByParentPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to DbNodesServerTransport +var dbNodesServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/dbservers_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbservers_server.go index 1235b75c166e..fa6e29f49bcc 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbservers_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbservers_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -28,9 +24,9 @@ type DbServersServer struct { // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, cloudexadatainfrastructurename string, dbserverocid string, options *armoracledatabase.DbServersClientGetOptions) (resp azfake.Responder[armoracledatabase.DbServersClientGetResponse], errResp azfake.ErrorResponder) - // NewListByCloudExadataInfrastructurePager is the fake for method DbServersClient.NewListByCloudExadataInfrastructurePager + // NewListByParentPager is the fake for method DbServersClient.NewListByParentPager // HTTP status codes to indicate success: http.StatusOK - NewListByCloudExadataInfrastructurePager func(resourceGroupName string, cloudexadatainfrastructurename string, options *armoracledatabase.DbServersClientListByCloudExadataInfrastructureOptions) (resp azfake.PagerResponder[armoracledatabase.DbServersClientListByCloudExadataInfrastructureResponse]) + NewListByParentPager func(resourceGroupName string, cloudexadatainfrastructurename string, options *armoracledatabase.DbServersClientListByParentOptions) (resp azfake.PagerResponder[armoracledatabase.DbServersClientListByParentResponse]) } // NewDbServersServerTransport creates a new instance of DbServersServerTransport with the provided implementation. @@ -38,16 +34,16 @@ type DbServersServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewDbServersServerTransport(srv *DbServersServer) *DbServersServerTransport { return &DbServersServerTransport{ - srv: srv, - newListByCloudExadataInfrastructurePager: newTracker[azfake.PagerResponder[armoracledatabase.DbServersClientListByCloudExadataInfrastructureResponse]](), + srv: srv, + newListByParentPager: newTracker[azfake.PagerResponder[armoracledatabase.DbServersClientListByParentResponse]](), } } // DbServersServerTransport connects instances of armoracledatabase.DbServersClient to instances of DbServersServer. // Don't use this type directly, use NewDbServersServerTransport instead. type DbServersServerTransport struct { - srv *DbServersServer - newListByCloudExadataInfrastructurePager *tracker[azfake.PagerResponder[armoracledatabase.DbServersClientListByCloudExadataInfrastructureResponse]] + srv *DbServersServer + newListByParentPager *tracker[azfake.PagerResponder[armoracledatabase.DbServersClientListByParentResponse]] } // Do implements the policy.Transporter interface for DbServersServerTransport. @@ -58,23 +54,42 @@ func (d *DbServersServerTransport) 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 d.dispatchToMethodFake(req, method) +} - switch method { - case "DbServersClient.Get": - resp, err = d.dispatchGet(req) - case "DbServersClient.NewListByCloudExadataInfrastructurePager": - resp, err = d.dispatchNewListByCloudExadataInfrastructurePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DbServersServerTransport) 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 dbServersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dbServersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DbServersClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DbServersClient.NewListByParentPager": + res.resp, res.err = d.dispatchNewListByParentPager(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 *DbServersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -84,7 +99,7 @@ func (d *DbServersServerTransport) dispatchGet(req *http.Request) (*http.Respons const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbServers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -114,16 +129,16 @@ func (d *DbServersServerTransport) dispatchGet(req *http.Request) (*http.Respons return resp, nil } -func (d *DbServersServerTransport) dispatchNewListByCloudExadataInfrastructurePager(req *http.Request) (*http.Response, error) { - if d.srv.NewListByCloudExadataInfrastructurePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByCloudExadataInfrastructurePager not implemented")} +func (d *DbServersServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListByParentPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByParentPager not implemented")} } - newListByCloudExadataInfrastructurePager := d.newListByCloudExadataInfrastructurePager.get(req) - if newListByCloudExadataInfrastructurePager == nil { + newListByParentPager := d.newListByParentPager.get(req) + if newListByParentPager == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudExadataInfrastructures/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbServers` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -134,23 +149,29 @@ func (d *DbServersServerTransport) dispatchNewListByCloudExadataInfrastructurePa if err != nil { return nil, err } - resp := d.srv.NewListByCloudExadataInfrastructurePager(resourceGroupNameParam, cloudexadatainfrastructurenameParam, nil) - newListByCloudExadataInfrastructurePager = &resp - d.newListByCloudExadataInfrastructurePager.add(req, newListByCloudExadataInfrastructurePager) - server.PagerResponderInjectNextLinks(newListByCloudExadataInfrastructurePager, req, func(page *armoracledatabase.DbServersClientListByCloudExadataInfrastructureResponse, createLink func() string) { + resp := d.srv.NewListByParentPager(resourceGroupNameParam, cloudexadatainfrastructurenameParam, nil) + newListByParentPager = &resp + d.newListByParentPager.add(req, newListByParentPager) + server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *armoracledatabase.DbServersClientListByParentResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } - resp, err := server.PagerResponderNext(newListByCloudExadataInfrastructurePager, req) + resp, err := server.PagerResponderNext(newListByParentPager, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - d.newListByCloudExadataInfrastructurePager.remove(req) + d.newListByParentPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } - if !server.PagerResponderMore(newListByCloudExadataInfrastructurePager) { - d.newListByCloudExadataInfrastructurePager.remove(req) + if !server.PagerResponderMore(newListByParentPager) { + d.newListByParentPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to DbServersServerTransport +var dbServersServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/dbsystemshapes_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbsystemshapes_server.go index 3d93e8727067..33c429c48e73 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbsystemshapes_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dbsystemshapes_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -58,23 +54,42 @@ func (d *DbSystemShapesServerTransport) Do(req *http.Request) (*http.Response, e return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DbSystemShapesClient.Get": - resp, err = d.dispatchGet(req) - case "DbSystemShapesClient.NewListByLocationPager": - resp, err = d.dispatchNewListByLocationPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DbSystemShapesServerTransport) 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 dbSystemShapesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dbSystemShapesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DbSystemShapesClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DbSystemShapesClient.NewListByLocationPager": + res.resp, res.err = d.dispatchNewListByLocationPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DbSystemShapesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -84,7 +99,7 @@ func (d *DbSystemShapesServerTransport) dispatchGet(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbSystemShapes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -119,14 +134,26 @@ func (d *DbSystemShapesServerTransport) dispatchNewListByLocationPager(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbSystemShapes` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } + qp := req.URL.Query() locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } - resp := d.srv.NewListByLocationPager(locationParam, nil) + zoneUnescaped, err := url.QueryUnescape(qp.Get("zone")) + if err != nil { + return nil, err + } + zoneParam := getOptional(zoneUnescaped) + var options *armoracledatabase.DbSystemShapesClientListByLocationOptions + if zoneParam != nil { + options = &armoracledatabase.DbSystemShapesClientListByLocationOptions{ + Zone: zoneParam, + } + } + resp := d.srv.NewListByLocationPager(locationParam, options) newListByLocationPager = &resp d.newListByLocationPager.add(req, newListByLocationPager) server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armoracledatabase.DbSystemShapesClientListByLocationResponse, createLink func() string) { @@ -146,3 +173,9 @@ func (d *DbSystemShapesServerTransport) dispatchNewListByLocationPager(req *http } return resp, nil } + +// set this to conditionally intercept incoming requests to DbSystemShapesServerTransport +var dbSystemShapesServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/dnsprivateviews_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivateviews_server.go index 53257e7ca744..59bc2fb44223 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivateviews_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivateviews_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -58,23 +54,42 @@ func (d *DNSPrivateViewsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DNSPrivateViewsClient.Get": - resp, err = d.dispatchGet(req) - case "DNSPrivateViewsClient.NewListByLocationPager": - resp, err = d.dispatchNewListByLocationPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DNSPrivateViewsServerTransport) 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 dnsPrivateViewsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dnsPrivateViewsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DNSPrivateViewsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DNSPrivateViewsClient.NewListByLocationPager": + res.resp, res.err = d.dispatchNewListByLocationPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DNSPrivateViewsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -84,7 +99,7 @@ func (d *DNSPrivateViewsServerTransport) dispatchGet(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dnsPrivateViews/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -119,7 +134,7 @@ func (d *DNSPrivateViewsServerTransport) dispatchNewListByLocationPager(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dnsPrivateViews` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -146,3 +161,9 @@ func (d *DNSPrivateViewsServerTransport) dispatchNewListByLocationPager(req *htt } return resp, nil } + +// set this to conditionally intercept incoming requests to DNSPrivateViewsServerTransport +var dnsPrivateViewsServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/dnsprivatezones_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivatezones_server.go index 6c379ca9545d..b67140b317e3 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivatezones_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/dnsprivatezones_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -58,23 +54,42 @@ func (d *DNSPrivateZonesServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DNSPrivateZonesClient.Get": - resp, err = d.dispatchGet(req) - case "DNSPrivateZonesClient.NewListByLocationPager": - resp, err = d.dispatchNewListByLocationPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DNSPrivateZonesServerTransport) 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 dnsPrivateZonesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = dnsPrivateZonesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DNSPrivateZonesClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DNSPrivateZonesClient.NewListByLocationPager": + res.resp, res.err = d.dispatchNewListByLocationPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DNSPrivateZonesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -84,7 +99,7 @@ func (d *DNSPrivateZonesServerTransport) dispatchGet(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dnsPrivateZones/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -119,7 +134,7 @@ func (d *DNSPrivateZonesServerTransport) dispatchNewListByLocationPager(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dnsPrivateZones` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -146,3 +161,9 @@ func (d *DNSPrivateZonesServerTransport) dispatchNewListByLocationPager(req *htt } return resp, nil } + +// set this to conditionally intercept incoming requests to DNSPrivateZonesServerTransport +var dnsPrivateZonesServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/exadbvmclusters_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/exadbvmclusters_server.go new file mode 100644 index 000000000000..8b6b6299f0e9 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/exadbvmclusters_server.go @@ -0,0 +1,430 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the 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/oracledatabase/armoracledatabase/v2" + "net/http" + "net/url" + "regexp" +) + +// ExadbVMClustersServer is a fake server for instances of the armoracledatabase.ExadbVMClustersClient type. +type ExadbVMClustersServer struct { + // BeginCreateOrUpdate is the fake for method ExadbVMClustersClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, exadbVMClusterName string, resource armoracledatabase.ExadbVMCluster, options *armoracledatabase.ExadbVMClustersClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.ExadbVMClustersClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ExadbVMClustersClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, exadbVMClusterName string, options *armoracledatabase.ExadbVMClustersClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.ExadbVMClustersClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ExadbVMClustersClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, exadbVMClusterName string, options *armoracledatabase.ExadbVMClustersClientGetOptions) (resp azfake.Responder[armoracledatabase.ExadbVMClustersClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method ExadbVMClustersClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armoracledatabase.ExadbVMClustersClientListByResourceGroupOptions) (resp azfake.PagerResponder[armoracledatabase.ExadbVMClustersClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method ExadbVMClustersClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armoracledatabase.ExadbVMClustersClientListBySubscriptionOptions) (resp azfake.PagerResponder[armoracledatabase.ExadbVMClustersClientListBySubscriptionResponse]) + + // BeginRemoveVMs is the fake for method ExadbVMClustersClient.BeginRemoveVMs + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginRemoveVMs func(ctx context.Context, resourceGroupName string, exadbVMClusterName string, body armoracledatabase.RemoveVirtualMachineFromExadbVMClusterDetails, options *armoracledatabase.ExadbVMClustersClientBeginRemoveVMsOptions) (resp azfake.PollerResponder[armoracledatabase.ExadbVMClustersClientRemoveVMsResponse], errResp azfake.ErrorResponder) + + // BeginUpdate is the fake for method ExadbVMClustersClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, exadbVMClusterName string, properties armoracledatabase.ExadbVMClusterUpdate, options *armoracledatabase.ExadbVMClustersClientBeginUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.ExadbVMClustersClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewExadbVMClustersServerTransport creates a new instance of ExadbVMClustersServerTransport with the provided implementation. +// The returned ExadbVMClustersServerTransport instance is connected to an instance of armoracledatabase.ExadbVMClustersClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewExadbVMClustersServerTransport(srv *ExadbVMClustersServer) *ExadbVMClustersServerTransport { + return &ExadbVMClustersServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.ExadbVMClustersClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.ExadbVMClustersClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armoracledatabase.ExadbVMClustersClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armoracledatabase.ExadbVMClustersClientListBySubscriptionResponse]](), + beginRemoveVMs: newTracker[azfake.PollerResponder[armoracledatabase.ExadbVMClustersClientRemoveVMsResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armoracledatabase.ExadbVMClustersClientUpdateResponse]](), + } +} + +// ExadbVMClustersServerTransport connects instances of armoracledatabase.ExadbVMClustersClient to instances of ExadbVMClustersServer. +// Don't use this type directly, use NewExadbVMClustersServerTransport instead. +type ExadbVMClustersServerTransport struct { + srv *ExadbVMClustersServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.ExadbVMClustersClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armoracledatabase.ExadbVMClustersClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armoracledatabase.ExadbVMClustersClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armoracledatabase.ExadbVMClustersClientListBySubscriptionResponse]] + beginRemoveVMs *tracker[azfake.PollerResponder[armoracledatabase.ExadbVMClustersClientRemoveVMsResponse]] + beginUpdate *tracker[azfake.PollerResponder[armoracledatabase.ExadbVMClustersClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for ExadbVMClustersServerTransport. +func (e *ExadbVMClustersServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *ExadbVMClustersServerTransport) 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 exadbVMClustersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = exadbVMClustersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ExadbVMClustersClient.BeginCreateOrUpdate": + res.resp, res.err = e.dispatchBeginCreateOrUpdate(req) + case "ExadbVMClustersClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "ExadbVMClustersClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "ExadbVMClustersClient.NewListByResourceGroupPager": + res.resp, res.err = e.dispatchNewListByResourceGroupPager(req) + case "ExadbVMClustersClient.NewListBySubscriptionPager": + res.resp, res.err = e.dispatchNewListBySubscriptionPager(req) + case "ExadbVMClustersClient.BeginRemoveVMs": + res.resp, res.err = e.dispatchBeginRemoveVMs(req) + case "ExadbVMClustersClient.BeginUpdate": + res.resp, res.err = e.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 (e *ExadbVMClustersServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := e.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exadbVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.ExadbVMCluster](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + exadbVMClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exadbVmClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, exadbVMClusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + e.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + e.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + e.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (e *ExadbVMClustersServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exadbVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + exadbVMClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exadbVmClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, exadbVMClusterNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + e.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *ExadbVMClustersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exadbVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + exadbVMClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exadbVmClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, exadbVMClusterNameParam, 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).ExadbVMCluster, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *ExadbVMClustersServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := e.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exadbVmClusters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + resp := e.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + e.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armoracledatabase.ExadbVMClustersClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + e.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (e *ExadbVMClustersServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := e.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exadbVmClusters` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := e.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + e.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armoracledatabase.ExadbVMClustersClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + e.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (e *ExadbVMClustersServerTransport) dispatchBeginRemoveVMs(req *http.Request) (*http.Response, error) { + if e.srv.BeginRemoveVMs == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginRemoveVMs not implemented")} + } + beginRemoveVMs := e.beginRemoveVMs.get(req) + if beginRemoveVMs == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exadbVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/removeVms` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.RemoveVirtualMachineFromExadbVMClusterDetails](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + exadbVMClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exadbVmClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginRemoveVMs(req.Context(), resourceGroupNameParam, exadbVMClusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginRemoveVMs = &respr + e.beginRemoveVMs.add(req, beginRemoveVMs) + } + + resp, err := server.PollerResponderNext(beginRemoveVMs, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + e.beginRemoveVMs.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginRemoveVMs) { + e.beginRemoveVMs.remove(req) + } + + return resp, nil +} + +func (e *ExadbVMClustersServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := e.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exadbVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.ExadbVMClusterUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + exadbVMClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exadbVmClusterName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginUpdate(req.Context(), resourceGroupNameParam, exadbVMClusterNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + e.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) { + e.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) { + e.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to ExadbVMClustersServerTransport +var exadbVMClustersServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/exascaledbnodes_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/exascaledbnodes_server.go new file mode 100644 index 000000000000..e8ee10bd4895 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/exascaledbnodes_server.go @@ -0,0 +1,237 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the 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/oracledatabase/armoracledatabase/v2" + "net/http" + "net/url" + "regexp" +) + +// ExascaleDbNodesServer is a fake server for instances of the armoracledatabase.ExascaleDbNodesClient type. +type ExascaleDbNodesServer struct { + // BeginAction is the fake for method ExascaleDbNodesClient.BeginAction + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginAction func(ctx context.Context, resourceGroupName string, exadbVMClusterName string, exascaleDbNodeName string, body armoracledatabase.DbNodeAction, options *armoracledatabase.ExascaleDbNodesClientBeginActionOptions) (resp azfake.PollerResponder[armoracledatabase.ExascaleDbNodesClientActionResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ExascaleDbNodesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, exadbVMClusterName string, exascaleDbNodeName string, options *armoracledatabase.ExascaleDbNodesClientGetOptions) (resp azfake.Responder[armoracledatabase.ExascaleDbNodesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByParentPager is the fake for method ExascaleDbNodesClient.NewListByParentPager + // HTTP status codes to indicate success: http.StatusOK + NewListByParentPager func(resourceGroupName string, exadbVMClusterName string, options *armoracledatabase.ExascaleDbNodesClientListByParentOptions) (resp azfake.PagerResponder[armoracledatabase.ExascaleDbNodesClientListByParentResponse]) +} + +// NewExascaleDbNodesServerTransport creates a new instance of ExascaleDbNodesServerTransport with the provided implementation. +// The returned ExascaleDbNodesServerTransport instance is connected to an instance of armoracledatabase.ExascaleDbNodesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewExascaleDbNodesServerTransport(srv *ExascaleDbNodesServer) *ExascaleDbNodesServerTransport { + return &ExascaleDbNodesServerTransport{ + srv: srv, + beginAction: newTracker[azfake.PollerResponder[armoracledatabase.ExascaleDbNodesClientActionResponse]](), + newListByParentPager: newTracker[azfake.PagerResponder[armoracledatabase.ExascaleDbNodesClientListByParentResponse]](), + } +} + +// ExascaleDbNodesServerTransport connects instances of armoracledatabase.ExascaleDbNodesClient to instances of ExascaleDbNodesServer. +// Don't use this type directly, use NewExascaleDbNodesServerTransport instead. +type ExascaleDbNodesServerTransport struct { + srv *ExascaleDbNodesServer + beginAction *tracker[azfake.PollerResponder[armoracledatabase.ExascaleDbNodesClientActionResponse]] + newListByParentPager *tracker[azfake.PagerResponder[armoracledatabase.ExascaleDbNodesClientListByParentResponse]] +} + +// Do implements the policy.Transporter interface for ExascaleDbNodesServerTransport. +func (e *ExascaleDbNodesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *ExascaleDbNodesServerTransport) 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 exascaleDbNodesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = exascaleDbNodesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ExascaleDbNodesClient.BeginAction": + res.resp, res.err = e.dispatchBeginAction(req) + case "ExascaleDbNodesClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "ExascaleDbNodesClient.NewListByParentPager": + res.resp, res.err = e.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 (e *ExascaleDbNodesServerTransport) dispatchBeginAction(req *http.Request) (*http.Response, error) { + if e.srv.BeginAction == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginAction not implemented")} + } + beginAction := e.beginAction.get(req) + if beginAction == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exadbVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/action` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.DbNodeAction](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + exadbVMClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exadbVmClusterName")]) + if err != nil { + return nil, err + } + exascaleDbNodeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exascaleDbNodeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginAction(req.Context(), resourceGroupNameParam, exadbVMClusterNameParam, exascaleDbNodeNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginAction = &respr + e.beginAction.add(req, beginAction) + } + + resp, err := server.PollerResponderNext(beginAction, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + e.beginAction.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginAction) { + e.beginAction.remove(req) + } + + return resp, nil +} + +func (e *ExascaleDbNodesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exadbVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbNodes/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + exadbVMClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exadbVmClusterName")]) + if err != nil { + return nil, err + } + exascaleDbNodeNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exascaleDbNodeName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, exadbVMClusterNameParam, exascaleDbNodeNameParam, 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).ExascaleDbNode, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *ExascaleDbNodesServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByParentPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByParentPager not implemented")} + } + newListByParentPager := e.newListByParentPager.get(req) + if newListByParentPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exadbVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dbNodes` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + exadbVMClusterNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exadbVmClusterName")]) + if err != nil { + return nil, err + } + resp := e.srv.NewListByParentPager(resourceGroupNameParam, exadbVMClusterNameParam, nil) + newListByParentPager = &resp + e.newListByParentPager.add(req, newListByParentPager) + server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *armoracledatabase.ExascaleDbNodesClientListByParentResponse, 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) { + e.newListByParentPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByParentPager) { + e.newListByParentPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ExascaleDbNodesServerTransport +var exascaleDbNodesServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/exascaledbstoragevaults_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/exascaledbstoragevaults_server.go new file mode 100644 index 000000000000..959f49ea47a4 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/exascaledbstoragevaults_server.go @@ -0,0 +1,374 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" + "net/http" + "net/url" + "regexp" +) + +// ExascaleDbStorageVaultsServer is a fake server for instances of the armoracledatabase.ExascaleDbStorageVaultsClient type. +type ExascaleDbStorageVaultsServer struct { + // BeginCreate is the fake for method ExascaleDbStorageVaultsClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, resource armoracledatabase.ExascaleDbStorageVault, options *armoracledatabase.ExascaleDbStorageVaultsClientBeginCreateOptions) (resp azfake.PollerResponder[armoracledatabase.ExascaleDbStorageVaultsClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method ExascaleDbStorageVaultsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, options *armoracledatabase.ExascaleDbStorageVaultsClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.ExascaleDbStorageVaultsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ExascaleDbStorageVaultsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, options *armoracledatabase.ExascaleDbStorageVaultsClientGetOptions) (resp azfake.Responder[armoracledatabase.ExascaleDbStorageVaultsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByResourceGroupPager is the fake for method ExascaleDbStorageVaultsClient.NewListByResourceGroupPager + // HTTP status codes to indicate success: http.StatusOK + NewListByResourceGroupPager func(resourceGroupName string, options *armoracledatabase.ExascaleDbStorageVaultsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armoracledatabase.ExascaleDbStorageVaultsClientListByResourceGroupResponse]) + + // NewListBySubscriptionPager is the fake for method ExascaleDbStorageVaultsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armoracledatabase.ExascaleDbStorageVaultsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armoracledatabase.ExascaleDbStorageVaultsClientListBySubscriptionResponse]) + + // BeginUpdate is the fake for method ExascaleDbStorageVaultsClient.BeginUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginUpdate func(ctx context.Context, resourceGroupName string, exascaleDbStorageVaultName string, properties armoracledatabase.ExascaleDbStorageVaultTagsUpdate, options *armoracledatabase.ExascaleDbStorageVaultsClientBeginUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.ExascaleDbStorageVaultsClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewExascaleDbStorageVaultsServerTransport creates a new instance of ExascaleDbStorageVaultsServerTransport with the provided implementation. +// The returned ExascaleDbStorageVaultsServerTransport instance is connected to an instance of armoracledatabase.ExascaleDbStorageVaultsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewExascaleDbStorageVaultsServerTransport(srv *ExascaleDbStorageVaultsServer) *ExascaleDbStorageVaultsServerTransport { + return &ExascaleDbStorageVaultsServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armoracledatabase.ExascaleDbStorageVaultsClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.ExascaleDbStorageVaultsClientDeleteResponse]](), + newListByResourceGroupPager: newTracker[azfake.PagerResponder[armoracledatabase.ExascaleDbStorageVaultsClientListByResourceGroupResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armoracledatabase.ExascaleDbStorageVaultsClientListBySubscriptionResponse]](), + beginUpdate: newTracker[azfake.PollerResponder[armoracledatabase.ExascaleDbStorageVaultsClientUpdateResponse]](), + } +} + +// ExascaleDbStorageVaultsServerTransport connects instances of armoracledatabase.ExascaleDbStorageVaultsClient to instances of ExascaleDbStorageVaultsServer. +// Don't use this type directly, use NewExascaleDbStorageVaultsServerTransport instead. +type ExascaleDbStorageVaultsServerTransport struct { + srv *ExascaleDbStorageVaultsServer + beginCreate *tracker[azfake.PollerResponder[armoracledatabase.ExascaleDbStorageVaultsClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armoracledatabase.ExascaleDbStorageVaultsClientDeleteResponse]] + newListByResourceGroupPager *tracker[azfake.PagerResponder[armoracledatabase.ExascaleDbStorageVaultsClientListByResourceGroupResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armoracledatabase.ExascaleDbStorageVaultsClientListBySubscriptionResponse]] + beginUpdate *tracker[azfake.PollerResponder[armoracledatabase.ExascaleDbStorageVaultsClientUpdateResponse]] +} + +// Do implements the policy.Transporter interface for ExascaleDbStorageVaultsServerTransport. +func (e *ExascaleDbStorageVaultsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return e.dispatchToMethodFake(req, method) +} + +func (e *ExascaleDbStorageVaultsServerTransport) 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 exascaleDbStorageVaultsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = exascaleDbStorageVaultsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ExascaleDbStorageVaultsClient.BeginCreate": + res.resp, res.err = e.dispatchBeginCreate(req) + case "ExascaleDbStorageVaultsClient.BeginDelete": + res.resp, res.err = e.dispatchBeginDelete(req) + case "ExascaleDbStorageVaultsClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "ExascaleDbStorageVaultsClient.NewListByResourceGroupPager": + res.resp, res.err = e.dispatchNewListByResourceGroupPager(req) + case "ExascaleDbStorageVaultsClient.NewListBySubscriptionPager": + res.resp, res.err = e.dispatchNewListBySubscriptionPager(req) + case "ExascaleDbStorageVaultsClient.BeginUpdate": + res.resp, res.err = e.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 (e *ExascaleDbStorageVaultsServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if e.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := e.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exascaleDbStorageVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.ExascaleDbStorageVault](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + exascaleDbStorageVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exascaleDbStorageVaultName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginCreate(req.Context(), resourceGroupNameParam, exascaleDbStorageVaultNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + e.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) { + e.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) { + e.beginCreate.remove(req) + } + + return resp, nil +} + +func (e *ExascaleDbStorageVaultsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if e.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := e.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exascaleDbStorageVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + exascaleDbStorageVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exascaleDbStorageVaultName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginDelete(req.Context(), resourceGroupNameParam, exascaleDbStorageVaultNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + e.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + e.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + e.beginDelete.remove(req) + } + + return resp, nil +} + +func (e *ExascaleDbStorageVaultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if e.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exascaleDbStorageVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + exascaleDbStorageVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exascaleDbStorageVaultName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.Get(req.Context(), resourceGroupNameParam, exascaleDbStorageVaultNameParam, 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).ExascaleDbStorageVault, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (e *ExascaleDbStorageVaultsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListByResourceGroupPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} + } + newListByResourceGroupPager := e.newListByResourceGroupPager.get(req) + if newListByResourceGroupPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exascaleDbStorageVaults` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if 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 + } + resp := e.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) + newListByResourceGroupPager = &resp + e.newListByResourceGroupPager.add(req, newListByResourceGroupPager) + server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armoracledatabase.ExascaleDbStorageVaultsClientListByResourceGroupResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListByResourceGroupPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByResourceGroupPager) { + e.newListByResourceGroupPager.remove(req) + } + return resp, nil +} + +func (e *ExascaleDbStorageVaultsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if e.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := e.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exascaleDbStorageVaults` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := e.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + e.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armoracledatabase.ExascaleDbStorageVaultsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + e.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + e.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (e *ExascaleDbStorageVaultsServerTransport) dispatchBeginUpdate(req *http.Request) (*http.Response, error) { + if e.srv.BeginUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginUpdate not implemented")} + } + beginUpdate := e.beginUpdate.get(req) + if beginUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/exascaleDbStorageVaults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.ExascaleDbStorageVaultTagsUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + exascaleDbStorageVaultNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("exascaleDbStorageVaultName")]) + if err != nil { + return nil, err + } + respr, errRespr := e.srv.BeginUpdate(req.Context(), resourceGroupNameParam, exascaleDbStorageVaultNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginUpdate = &respr + e.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) { + e.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) { + e.beginUpdate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to ExascaleDbStorageVaultsServerTransport +var exascaleDbStorageVaultsServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/flexcomponents_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/flexcomponents_server.go new file mode 100644 index 000000000000..77d7348117fd --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/flexcomponents_server.go @@ -0,0 +1,181 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the 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/oracledatabase/armoracledatabase/v2" + "net/http" + "net/url" + "regexp" +) + +// FlexComponentsServer is a fake server for instances of the armoracledatabase.FlexComponentsClient type. +type FlexComponentsServer struct { + // Get is the fake for method FlexComponentsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, location string, flexComponentName string, options *armoracledatabase.FlexComponentsClientGetOptions) (resp azfake.Responder[armoracledatabase.FlexComponentsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByParentPager is the fake for method FlexComponentsClient.NewListByParentPager + // HTTP status codes to indicate success: http.StatusOK + NewListByParentPager func(location string, options *armoracledatabase.FlexComponentsClientListByParentOptions) (resp azfake.PagerResponder[armoracledatabase.FlexComponentsClientListByParentResponse]) +} + +// NewFlexComponentsServerTransport creates a new instance of FlexComponentsServerTransport with the provided implementation. +// The returned FlexComponentsServerTransport instance is connected to an instance of armoracledatabase.FlexComponentsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewFlexComponentsServerTransport(srv *FlexComponentsServer) *FlexComponentsServerTransport { + return &FlexComponentsServerTransport{ + srv: srv, + newListByParentPager: newTracker[azfake.PagerResponder[armoracledatabase.FlexComponentsClientListByParentResponse]](), + } +} + +// FlexComponentsServerTransport connects instances of armoracledatabase.FlexComponentsClient to instances of FlexComponentsServer. +// Don't use this type directly, use NewFlexComponentsServerTransport instead. +type FlexComponentsServerTransport struct { + srv *FlexComponentsServer + newListByParentPager *tracker[azfake.PagerResponder[armoracledatabase.FlexComponentsClientListByParentResponse]] +} + +// Do implements the policy.Transporter interface for FlexComponentsServerTransport. +func (f *FlexComponentsServerTransport) 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 *FlexComponentsServerTransport) 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 flexComponentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = flexComponentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "FlexComponentsClient.Get": + res.resp, res.err = f.dispatchGet(req) + case "FlexComponentsClient.NewListByParentPager": + res.resp, res.err = f.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 (f *FlexComponentsServerTransport) 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~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/flexComponents/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + flexComponentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("flexComponentName")]) + if err != nil { + return nil, err + } + respr, errRespr := f.srv.Get(req.Context(), locationParam, flexComponentNameParam, 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).FlexComponent, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (f *FlexComponentsServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { + if f.srv.NewListByParentPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByParentPager not implemented")} + } + newListByParentPager := f.newListByParentPager.get(req) + if newListByParentPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/flexComponents` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + shapeUnescaped, err := url.QueryUnescape(qp.Get("shape")) + if err != nil { + return nil, err + } + shapeParam := getOptional(armoracledatabase.SystemShapes(shapeUnescaped)) + var options *armoracledatabase.FlexComponentsClientListByParentOptions + if shapeParam != nil { + options = &armoracledatabase.FlexComponentsClientListByParentOptions{ + Shape: shapeParam, + } + } + resp := f.srv.NewListByParentPager(locationParam, options) + newListByParentPager = &resp + f.newListByParentPager.add(req, newListByParentPager) + server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *armoracledatabase.FlexComponentsClientListByParentResponse, 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) { + f.newListByParentPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByParentPager) { + f.newListByParentPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to FlexComponentsServerTransport +var flexComponentsServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/giminorversions_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/giminorversions_server.go new file mode 100644 index 000000000000..2de9967f3769 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/giminorversions_server.go @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the 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/oracledatabase/armoracledatabase/v2" + "net/http" + "net/url" + "regexp" +) + +// GiMinorVersionsServer is a fake server for instances of the armoracledatabase.GiMinorVersionsClient type. +type GiMinorVersionsServer struct { + // Get is the fake for method GiMinorVersionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, location string, giversionname string, giMinorVersionName string, options *armoracledatabase.GiMinorVersionsClientGetOptions) (resp azfake.Responder[armoracledatabase.GiMinorVersionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListByParentPager is the fake for method GiMinorVersionsClient.NewListByParentPager + // HTTP status codes to indicate success: http.StatusOK + NewListByParentPager func(location string, giversionname string, options *armoracledatabase.GiMinorVersionsClientListByParentOptions) (resp azfake.PagerResponder[armoracledatabase.GiMinorVersionsClientListByParentResponse]) +} + +// NewGiMinorVersionsServerTransport creates a new instance of GiMinorVersionsServerTransport with the provided implementation. +// The returned GiMinorVersionsServerTransport instance is connected to an instance of armoracledatabase.GiMinorVersionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewGiMinorVersionsServerTransport(srv *GiMinorVersionsServer) *GiMinorVersionsServerTransport { + return &GiMinorVersionsServerTransport{ + srv: srv, + newListByParentPager: newTracker[azfake.PagerResponder[armoracledatabase.GiMinorVersionsClientListByParentResponse]](), + } +} + +// GiMinorVersionsServerTransport connects instances of armoracledatabase.GiMinorVersionsClient to instances of GiMinorVersionsServer. +// Don't use this type directly, use NewGiMinorVersionsServerTransport instead. +type GiMinorVersionsServerTransport struct { + srv *GiMinorVersionsServer + newListByParentPager *tracker[azfake.PagerResponder[armoracledatabase.GiMinorVersionsClientListByParentResponse]] +} + +// Do implements the policy.Transporter interface for GiMinorVersionsServerTransport. +func (g *GiMinorVersionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return g.dispatchToMethodFake(req, method) +} + +func (g *GiMinorVersionsServerTransport) 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 giMinorVersionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = giMinorVersionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GiMinorVersionsClient.Get": + res.resp, res.err = g.dispatchGet(req) + case "GiMinorVersionsClient.NewListByParentPager": + res.resp, res.err = g.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 (g *GiMinorVersionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if g.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/giVersions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/giMinorVersions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + giversionnameParam, err := url.PathUnescape(matches[regex.SubexpIndex("giversionname")]) + if err != nil { + return nil, err + } + giMinorVersionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("giMinorVersionName")]) + if err != nil { + return nil, err + } + respr, errRespr := g.srv.Get(req.Context(), locationParam, giversionnameParam, giMinorVersionNameParam, 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).GiMinorVersion, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (g *GiMinorVersionsServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { + if g.srv.NewListByParentPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByParentPager not implemented")} + } + newListByParentPager := g.newListByParentPager.get(req) + if newListByParentPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/giVersions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/giMinorVersions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + giversionnameParam, err := url.PathUnescape(matches[regex.SubexpIndex("giversionname")]) + if err != nil { + return nil, err + } + shapeFamilyUnescaped, err := url.QueryUnescape(qp.Get("shapeFamily")) + if err != nil { + return nil, err + } + shapeFamilyParam := getOptional(armoracledatabase.ShapeFamily(shapeFamilyUnescaped)) + zoneUnescaped, err := url.QueryUnescape(qp.Get("zone")) + if err != nil { + return nil, err + } + zoneParam := getOptional(zoneUnescaped) + var options *armoracledatabase.GiMinorVersionsClientListByParentOptions + if shapeFamilyParam != nil || zoneParam != nil { + options = &armoracledatabase.GiMinorVersionsClientListByParentOptions{ + ShapeFamily: shapeFamilyParam, + Zone: zoneParam, + } + } + resp := g.srv.NewListByParentPager(locationParam, giversionnameParam, options) + newListByParentPager = &resp + g.newListByParentPager.add(req, newListByParentPager) + server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *armoracledatabase.GiMinorVersionsClientListByParentResponse, 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) { + g.newListByParentPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListByParentPager) { + g.newListByParentPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to GiMinorVersionsServerTransport +var giMinorVersionsServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/giversions_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/giversions_server.go index 551d8334a426..82a52bb99ef9 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/giversions_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/giversions_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -58,23 +54,42 @@ func (g *GiVersionsServerTransport) 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 g.dispatchToMethodFake(req, method) +} - switch method { - case "GiVersionsClient.Get": - resp, err = g.dispatchGet(req) - case "GiVersionsClient.NewListByLocationPager": - resp, err = g.dispatchNewListByLocationPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (g *GiVersionsServerTransport) 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 giVersionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = giVersionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GiVersionsClient.Get": + res.resp, res.err = g.dispatchGet(req) + case "GiVersionsClient.NewListByLocationPager": + res.resp, res.err = g.dispatchNewListByLocationPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (g *GiVersionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -84,7 +99,7 @@ func (g *GiVersionsServerTransport) dispatchGet(req *http.Request) (*http.Respon const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/giVersions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -119,14 +134,32 @@ func (g *GiVersionsServerTransport) dispatchNewListByLocationPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/giVersions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } + qp := req.URL.Query() locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) if err != nil { return nil, err } - resp := g.srv.NewListByLocationPager(locationParam, nil) + shapeUnescaped, err := url.QueryUnescape(qp.Get("shape")) + if err != nil { + return nil, err + } + shapeParam := getOptional(armoracledatabase.SystemShapes(shapeUnescaped)) + zoneUnescaped, err := url.QueryUnescape(qp.Get("zone")) + if err != nil { + return nil, err + } + zoneParam := getOptional(zoneUnescaped) + var options *armoracledatabase.GiVersionsClientListByLocationOptions + if shapeParam != nil || zoneParam != nil { + options = &armoracledatabase.GiVersionsClientListByLocationOptions{ + Shape: shapeParam, + Zone: zoneParam, + } + } + resp := g.srv.NewListByLocationPager(locationParam, options) newListByLocationPager = &resp g.newListByLocationPager.add(req, newListByLocationPager) server.PagerResponderInjectNextLinks(newListByLocationPager, req, func(page *armoracledatabase.GiVersionsClientListByLocationResponse, createLink func() string) { @@ -146,3 +179,9 @@ func (g *GiVersionsServerTransport) dispatchNewListByLocationPager(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to GiVersionsServerTransport +var giVersionsServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/internal.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/internal.go index 5f75802a569e..d768e4760998 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/internal.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/internal.go @@ -1,19 +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 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 } @@ -31,6 +33,13 @@ func contains[T comparable](s []T, v T) bool { return false } +func getOptional[T any](v T) *T { + if reflect.ValueOf(v).IsZero() { + return nil + } + return &v +} + func newTracker[T any]() *tracker[T] { return &tracker[T]{ items: map[string]*T{}, diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/operations_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/operations_server.go index 4921fd567d63..ec23fad7f026 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/operations_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/operations_server.go @@ -1,10 +1,6 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -15,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" ) @@ -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/oracledatabase/armoracledatabase/fake/oraclesubscriptions_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/oraclesubscriptions_server.go index 712077d00f40..79184d29140c 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/oraclesubscriptions_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/oraclesubscriptions_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 @@ -16,19 +12,23 @@ 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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "regexp" ) // OracleSubscriptionsServer is a fake server for instances of the armoracledatabase.OracleSubscriptionsClient type. type OracleSubscriptionsServer struct { + // BeginAddAzureSubscriptions is the fake for method OracleSubscriptionsClient.BeginAddAzureSubscriptions + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginAddAzureSubscriptions func(ctx context.Context, body armoracledatabase.AzureSubscriptions, options *armoracledatabase.OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientAddAzureSubscriptionsResponse], errResp azfake.ErrorResponder) + // BeginCreateOrUpdate is the fake for method OracleSubscriptionsClient.BeginCreateOrUpdate // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated BeginCreateOrUpdate func(ctx context.Context, resource armoracledatabase.OracleSubscription, options *armoracledatabase.OracleSubscriptionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method OracleSubscriptionsClient.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, options *armoracledatabase.OracleSubscriptionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method OracleSubscriptionsClient.Get @@ -36,7 +36,7 @@ type OracleSubscriptionsServer struct { Get func(ctx context.Context, options *armoracledatabase.OracleSubscriptionsClientGetOptions) (resp azfake.Responder[armoracledatabase.OracleSubscriptionsClientGetResponse], errResp azfake.ErrorResponder) // BeginListActivationLinks is the fake for method OracleSubscriptionsClient.BeginListActivationLinks - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginListActivationLinks func(ctx context.Context, options *armoracledatabase.OracleSubscriptionsClientBeginListActivationLinksOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListActivationLinksResponse], errResp azfake.ErrorResponder) // NewListBySubscriptionPager is the fake for method OracleSubscriptionsClient.NewListBySubscriptionPager @@ -44,11 +44,11 @@ type OracleSubscriptionsServer struct { NewListBySubscriptionPager func(options *armoracledatabase.OracleSubscriptionsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armoracledatabase.OracleSubscriptionsClientListBySubscriptionResponse]) // BeginListCloudAccountDetails is the fake for method OracleSubscriptionsClient.BeginListCloudAccountDetails - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginListCloudAccountDetails func(ctx context.Context, options *armoracledatabase.OracleSubscriptionsClientBeginListCloudAccountDetailsOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListCloudAccountDetailsResponse], errResp azfake.ErrorResponder) // BeginListSaasSubscriptionDetails is the fake for method OracleSubscriptionsClient.BeginListSaasSubscriptionDetails - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginListSaasSubscriptionDetails func(ctx context.Context, options *armoracledatabase.OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions) (resp azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListSaasSubscriptionDetailsResponse], errResp azfake.ErrorResponder) // BeginUpdate is the fake for method OracleSubscriptionsClient.BeginUpdate @@ -62,6 +62,7 @@ type OracleSubscriptionsServer struct { func NewOracleSubscriptionsServerTransport(srv *OracleSubscriptionsServer) *OracleSubscriptionsServerTransport { return &OracleSubscriptionsServerTransport{ srv: srv, + beginAddAzureSubscriptions: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientAddAzureSubscriptionsResponse]](), beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientCreateOrUpdateResponse]](), beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientDeleteResponse]](), beginListActivationLinks: newTracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListActivationLinksResponse]](), @@ -76,6 +77,7 @@ func NewOracleSubscriptionsServerTransport(srv *OracleSubscriptionsServer) *Orac // Don't use this type directly, use NewOracleSubscriptionsServerTransport instead. type OracleSubscriptionsServerTransport struct { srv *OracleSubscriptionsServer + beginAddAzureSubscriptions *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientAddAzureSubscriptionsResponse]] beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientCreateOrUpdateResponse]] beginDelete *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientDeleteResponse]] beginListActivationLinks *tracker[azfake.PollerResponder[armoracledatabase.OracleSubscriptionsClientListActivationLinksResponse]] @@ -93,34 +95,95 @@ func (o *OracleSubscriptionsServerTransport) 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 "OracleSubscriptionsClient.BeginCreateOrUpdate": - resp, err = o.dispatchBeginCreateOrUpdate(req) - case "OracleSubscriptionsClient.BeginDelete": - resp, err = o.dispatchBeginDelete(req) - case "OracleSubscriptionsClient.Get": - resp, err = o.dispatchGet(req) - case "OracleSubscriptionsClient.BeginListActivationLinks": - resp, err = o.dispatchBeginListActivationLinks(req) - case "OracleSubscriptionsClient.NewListBySubscriptionPager": - resp, err = o.dispatchNewListBySubscriptionPager(req) - case "OracleSubscriptionsClient.BeginListCloudAccountDetails": - resp, err = o.dispatchBeginListCloudAccountDetails(req) - case "OracleSubscriptionsClient.BeginListSaasSubscriptionDetails": - resp, err = o.dispatchBeginListSaasSubscriptionDetails(req) - case "OracleSubscriptionsClient.BeginUpdate": - resp, err = o.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) + return o.dispatchToMethodFake(req, method) +} + +func (o *OracleSubscriptionsServerTransport) 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 oracleSubscriptionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = oracleSubscriptionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OracleSubscriptionsClient.BeginAddAzureSubscriptions": + res.resp, res.err = o.dispatchBeginAddAzureSubscriptions(req) + case "OracleSubscriptionsClient.BeginCreateOrUpdate": + res.resp, res.err = o.dispatchBeginCreateOrUpdate(req) + case "OracleSubscriptionsClient.BeginDelete": + res.resp, res.err = o.dispatchBeginDelete(req) + case "OracleSubscriptionsClient.Get": + res.resp, res.err = o.dispatchGet(req) + case "OracleSubscriptionsClient.BeginListActivationLinks": + res.resp, res.err = o.dispatchBeginListActivationLinks(req) + case "OracleSubscriptionsClient.NewListBySubscriptionPager": + res.resp, res.err = o.dispatchNewListBySubscriptionPager(req) + case "OracleSubscriptionsClient.BeginListCloudAccountDetails": + res.resp, res.err = o.dispatchBeginListCloudAccountDetails(req) + case "OracleSubscriptionsClient.BeginListSaasSubscriptionDetails": + res.resp, res.err = o.dispatchBeginListSaasSubscriptionDetails(req) + case "OracleSubscriptionsClient.BeginUpdate": + res.resp, res.err = o.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OracleSubscriptionsServerTransport) dispatchBeginAddAzureSubscriptions(req *http.Request) (*http.Response, error) { + if o.srv.BeginAddAzureSubscriptions == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginAddAzureSubscriptions not implemented")} + } + beginAddAzureSubscriptions := o.beginAddAzureSubscriptions.get(req) + if beginAddAzureSubscriptions == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default/addAzureSubscriptions` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armoracledatabase.AzureSubscriptions](req) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.BeginAddAzureSubscriptions(req.Context(), body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginAddAzureSubscriptions = &respr + o.beginAddAzureSubscriptions.add(req, beginAddAzureSubscriptions) } + resp, err := server.PollerResponderNext(beginAddAzureSubscriptions, req) if err != nil { return nil, err } + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + o.beginAddAzureSubscriptions.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(beginAddAzureSubscriptions) { + o.beginAddAzureSubscriptions.remove(req) + } + return resp, nil } @@ -133,7 +196,7 @@ func (o *OracleSubscriptionsServerTransport) dispatchBeginCreateOrUpdate(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.OracleSubscription](req) @@ -173,7 +236,7 @@ func (o *OracleSubscriptionsServerTransport) dispatchBeginDelete(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } respr, errRespr := o.srv.BeginDelete(req.Context(), nil) @@ -189,9 +252,9 @@ func (o *OracleSubscriptionsServerTransport) 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) { o.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) { o.beginDelete.remove(req) @@ -207,7 +270,7 @@ func (o *OracleSubscriptionsServerTransport) dispatchGet(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } respr, errRespr := o.srv.Get(req.Context(), nil) @@ -234,7 +297,7 @@ func (o *OracleSubscriptionsServerTransport) dispatchBeginListActivationLinks(re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default/listActivationLinks` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } respr, errRespr := o.srv.BeginListActivationLinks(req.Context(), nil) @@ -250,9 +313,9 @@ func (o *OracleSubscriptionsServerTransport) dispatchBeginListActivationLinks(re return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { o.beginListActivationLinks.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginListActivationLinks) { o.beginListActivationLinks.remove(req) @@ -270,7 +333,7 @@ func (o *OracleSubscriptionsServerTransport) dispatchNewListBySubscriptionPager( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := o.srv.NewListBySubscriptionPager(nil) @@ -303,7 +366,7 @@ func (o *OracleSubscriptionsServerTransport) dispatchBeginListCloudAccountDetail const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default/listCloudAccountDetails` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } respr, errRespr := o.srv.BeginListCloudAccountDetails(req.Context(), nil) @@ -319,9 +382,9 @@ func (o *OracleSubscriptionsServerTransport) dispatchBeginListCloudAccountDetail return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { o.beginListCloudAccountDetails.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginListCloudAccountDetails) { o.beginListCloudAccountDetails.remove(req) @@ -339,7 +402,7 @@ func (o *OracleSubscriptionsServerTransport) dispatchBeginListSaasSubscriptionDe const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default/listSaasSubscriptionDetails` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } respr, errRespr := o.srv.BeginListSaasSubscriptionDetails(req.Context(), nil) @@ -355,9 +418,9 @@ func (o *OracleSubscriptionsServerTransport) dispatchBeginListSaasSubscriptionDe return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { o.beginListSaasSubscriptionDetails.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginListSaasSubscriptionDetails) { o.beginListSaasSubscriptionDetails.remove(req) @@ -375,7 +438,7 @@ func (o *OracleSubscriptionsServerTransport) dispatchBeginUpdate(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/oracleSubscriptions/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.OracleSubscriptionUpdate](req) @@ -405,3 +468,9 @@ func (o *OracleSubscriptionsServerTransport) dispatchBeginUpdate(req *http.Reque return resp, nil } + +// set this to conditionally intercept incoming requests to OracleSubscriptionsServerTransport +var oracleSubscriptionsServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/server_factory.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/server_factory.go index 429a0dab5ead..db4536b4071f 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/server_factory.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/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,23 +15,71 @@ import ( // ServerFactory is a fake server for instances of the armoracledatabase.ClientFactory type. type ServerFactory struct { - AutonomousDatabaseBackupsServer AutonomousDatabaseBackupsServer - AutonomousDatabaseCharacterSetsServer AutonomousDatabaseCharacterSetsServer + // AutonomousDatabaseBackupsServer contains the fakes for client AutonomousDatabaseBackupsClient + AutonomousDatabaseBackupsServer AutonomousDatabaseBackupsServer + + // AutonomousDatabaseCharacterSetsServer contains the fakes for client AutonomousDatabaseCharacterSetsClient + AutonomousDatabaseCharacterSetsServer AutonomousDatabaseCharacterSetsServer + + // AutonomousDatabaseNationalCharacterSetsServer contains the fakes for client AutonomousDatabaseNationalCharacterSetsClient AutonomousDatabaseNationalCharacterSetsServer AutonomousDatabaseNationalCharacterSetsServer - AutonomousDatabaseVersionsServer AutonomousDatabaseVersionsServer - AutonomousDatabasesServer AutonomousDatabasesServer - CloudExadataInfrastructuresServer CloudExadataInfrastructuresServer - CloudVMClustersServer CloudVMClustersServer - DNSPrivateViewsServer DNSPrivateViewsServer - DNSPrivateZonesServer DNSPrivateZonesServer - DbNodesServer DbNodesServer - DbServersServer DbServersServer - DbSystemShapesServer DbSystemShapesServer - GiVersionsServer GiVersionsServer - OperationsServer OperationsServer - OracleSubscriptionsServer OracleSubscriptionsServer - SystemVersionsServer SystemVersionsServer - VirtualNetworkAddressesServer VirtualNetworkAddressesServer + + // AutonomousDatabaseVersionsServer contains the fakes for client AutonomousDatabaseVersionsClient + AutonomousDatabaseVersionsServer AutonomousDatabaseVersionsServer + + // AutonomousDatabasesServer contains the fakes for client AutonomousDatabasesClient + AutonomousDatabasesServer AutonomousDatabasesServer + + // CloudExadataInfrastructuresServer contains the fakes for client CloudExadataInfrastructuresClient + CloudExadataInfrastructuresServer CloudExadataInfrastructuresServer + + // CloudVMClustersServer contains the fakes for client CloudVMClustersClient + CloudVMClustersServer CloudVMClustersServer + + // DNSPrivateViewsServer contains the fakes for client DNSPrivateViewsClient + DNSPrivateViewsServer DNSPrivateViewsServer + + // DNSPrivateZonesServer contains the fakes for client DNSPrivateZonesClient + DNSPrivateZonesServer DNSPrivateZonesServer + + // DbNodesServer contains the fakes for client DbNodesClient + DbNodesServer DbNodesServer + + // DbServersServer contains the fakes for client DbServersClient + DbServersServer DbServersServer + + // DbSystemShapesServer contains the fakes for client DbSystemShapesClient + DbSystemShapesServer DbSystemShapesServer + + // ExadbVMClustersServer contains the fakes for client ExadbVMClustersClient + ExadbVMClustersServer ExadbVMClustersServer + + // ExascaleDbNodesServer contains the fakes for client ExascaleDbNodesClient + ExascaleDbNodesServer ExascaleDbNodesServer + + // ExascaleDbStorageVaultsServer contains the fakes for client ExascaleDbStorageVaultsClient + ExascaleDbStorageVaultsServer ExascaleDbStorageVaultsServer + + // FlexComponentsServer contains the fakes for client FlexComponentsClient + FlexComponentsServer FlexComponentsServer + + // GiMinorVersionsServer contains the fakes for client GiMinorVersionsClient + GiMinorVersionsServer GiMinorVersionsServer + + // GiVersionsServer contains the fakes for client GiVersionsClient + GiVersionsServer GiVersionsServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // OracleSubscriptionsServer contains the fakes for client OracleSubscriptionsClient + OracleSubscriptionsServer OracleSubscriptionsServer + + // SystemVersionsServer contains the fakes for client SystemVersionsClient + SystemVersionsServer SystemVersionsServer + + // VirtualNetworkAddressesServer contains the fakes for client VirtualNetworkAddressesClient + VirtualNetworkAddressesServer VirtualNetworkAddressesServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -64,6 +108,11 @@ type ServerFactoryTransport struct { trDbNodesServer *DbNodesServerTransport trDbServersServer *DbServersServerTransport trDbSystemShapesServer *DbSystemShapesServerTransport + trExadbVMClustersServer *ExadbVMClustersServerTransport + trExascaleDbNodesServer *ExascaleDbNodesServerTransport + trExascaleDbStorageVaultsServer *ExascaleDbStorageVaultsServerTransport + trFlexComponentsServer *FlexComponentsServerTransport + trGiMinorVersionsServer *GiMinorVersionsServerTransport trGiVersionsServer *GiVersionsServerTransport trOperationsServer *OperationsServerTransport trOracleSubscriptionsServer *OracleSubscriptionsServerTransport @@ -140,6 +189,31 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return NewDbSystemShapesServerTransport(&s.srv.DbSystemShapesServer) }) resp, err = s.trDbSystemShapesServer.Do(req) + case "ExadbVMClustersClient": + initServer(s, &s.trExadbVMClustersServer, func() *ExadbVMClustersServerTransport { + return NewExadbVMClustersServerTransport(&s.srv.ExadbVMClustersServer) + }) + resp, err = s.trExadbVMClustersServer.Do(req) + case "ExascaleDbNodesClient": + initServer(s, &s.trExascaleDbNodesServer, func() *ExascaleDbNodesServerTransport { + return NewExascaleDbNodesServerTransport(&s.srv.ExascaleDbNodesServer) + }) + resp, err = s.trExascaleDbNodesServer.Do(req) + case "ExascaleDbStorageVaultsClient": + initServer(s, &s.trExascaleDbStorageVaultsServer, func() *ExascaleDbStorageVaultsServerTransport { + return NewExascaleDbStorageVaultsServerTransport(&s.srv.ExascaleDbStorageVaultsServer) + }) + resp, err = s.trExascaleDbStorageVaultsServer.Do(req) + case "FlexComponentsClient": + initServer(s, &s.trFlexComponentsServer, func() *FlexComponentsServerTransport { + return NewFlexComponentsServerTransport(&s.srv.FlexComponentsServer) + }) + resp, err = s.trFlexComponentsServer.Do(req) + case "GiMinorVersionsClient": + initServer(s, &s.trGiMinorVersionsServer, func() *GiMinorVersionsServerTransport { + return NewGiMinorVersionsServerTransport(&s.srv.GiMinorVersionsServer) + }) + resp, err = s.trGiMinorVersionsServer.Do(req) case "GiVersionsClient": initServer(s, &s.trGiVersionsServer, func() *GiVersionsServerTransport { return NewGiVersionsServerTransport(&s.srv.GiVersionsServer) }) resp, err = s.trGiVersionsServer.Do(req) diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/systemversions_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/systemversions_server.go index 7ebdef8fbe82..839e67c507b1 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/systemversions_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/systemversions_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -58,23 +54,42 @@ func (s *SystemVersionsServerTransport) Do(req *http.Request) (*http.Response, e return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SystemVersionsClient.Get": - resp, err = s.dispatchGet(req) - case "SystemVersionsClient.NewListByLocationPager": - resp, err = s.dispatchNewListByLocationPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SystemVersionsServerTransport) 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 systemVersionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = systemVersionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SystemVersionsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SystemVersionsClient.NewListByLocationPager": + res.resp, res.err = s.dispatchNewListByLocationPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + select { + case resultChan <- res: + case <-req.Context().Done(): + } + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SystemVersionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -84,7 +99,7 @@ func (s *SystemVersionsServerTransport) dispatchGet(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/systemVersions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -119,7 +134,7 @@ func (s *SystemVersionsServerTransport) dispatchNewListByLocationPager(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/systemVersions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) @@ -146,3 +161,9 @@ func (s *SystemVersionsServerTransport) dispatchNewListByLocationPager(req *http } return resp, nil } + +// set this to conditionally intercept incoming requests to SystemVersionsServerTransport +var systemVersionsServerTransportInterceptor 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/oracledatabase/armoracledatabase/fake/time_rfc3339.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/time_rfc3339.go deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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 ( - "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 { - 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/oracledatabase/armoracledatabase/fake/virtualnetworkaddresses_server.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/virtualnetworkaddresses_server.go index 55ab35329e8a..67d470fbfa00 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/virtualnetworkaddresses_server.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/fake/virtualnetworkaddresses_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 @@ -16,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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" "net/http" "net/url" "regexp" @@ -29,16 +25,16 @@ type VirtualNetworkAddressesServer struct { BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, resource armoracledatabase.VirtualNetworkAddress, options *armoracledatabase.VirtualNetworkAddressesClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // BeginDelete is the fake for method VirtualNetworkAddressesClient.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, cloudvmclustername string, virtualnetworkaddressname string, options *armoracledatabase.VirtualNetworkAddressesClientBeginDeleteOptions) (resp azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method VirtualNetworkAddressesClient.Get // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, options *armoracledatabase.VirtualNetworkAddressesClientGetOptions) (resp azfake.Responder[armoracledatabase.VirtualNetworkAddressesClientGetResponse], errResp azfake.ErrorResponder) - // NewListByCloudVMClusterPager is the fake for method VirtualNetworkAddressesClient.NewListByCloudVMClusterPager + // NewListByParentPager is the fake for method VirtualNetworkAddressesClient.NewListByParentPager // HTTP status codes to indicate success: http.StatusOK - NewListByCloudVMClusterPager func(resourceGroupName string, cloudvmclustername string, options *armoracledatabase.VirtualNetworkAddressesClientListByCloudVMClusterOptions) (resp azfake.PagerResponder[armoracledatabase.VirtualNetworkAddressesClientListByCloudVMClusterResponse]) + NewListByParentPager func(resourceGroupName string, cloudvmclustername string, options *armoracledatabase.VirtualNetworkAddressesClientListByParentOptions) (resp azfake.PagerResponder[armoracledatabase.VirtualNetworkAddressesClientListByParentResponse]) } // NewVirtualNetworkAddressesServerTransport creates a new instance of VirtualNetworkAddressesServerTransport with the provided implementation. @@ -46,20 +42,20 @@ type VirtualNetworkAddressesServer struct { // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewVirtualNetworkAddressesServerTransport(srv *VirtualNetworkAddressesServer) *VirtualNetworkAddressesServerTransport { return &VirtualNetworkAddressesServerTransport{ - srv: srv, - beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientCreateOrUpdateResponse]](), - beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientDeleteResponse]](), - newListByCloudVMClusterPager: newTracker[azfake.PagerResponder[armoracledatabase.VirtualNetworkAddressesClientListByCloudVMClusterResponse]](), + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientDeleteResponse]](), + newListByParentPager: newTracker[azfake.PagerResponder[armoracledatabase.VirtualNetworkAddressesClientListByParentResponse]](), } } // VirtualNetworkAddressesServerTransport connects instances of armoracledatabase.VirtualNetworkAddressesClient to instances of VirtualNetworkAddressesServer. // Don't use this type directly, use NewVirtualNetworkAddressesServerTransport instead. type VirtualNetworkAddressesServerTransport struct { - srv *VirtualNetworkAddressesServer - beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientCreateOrUpdateResponse]] - beginDelete *tracker[azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientDeleteResponse]] - newListByCloudVMClusterPager *tracker[azfake.PagerResponder[armoracledatabase.VirtualNetworkAddressesClientListByCloudVMClusterResponse]] + srv *VirtualNetworkAddressesServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armoracledatabase.VirtualNetworkAddressesClientDeleteResponse]] + newListByParentPager *tracker[azfake.PagerResponder[armoracledatabase.VirtualNetworkAddressesClientListByParentResponse]] } // Do implements the policy.Transporter interface for VirtualNetworkAddressesServerTransport. @@ -70,27 +66,46 @@ func (v *VirtualNetworkAddressesServerTransport) Do(req *http.Request) (*http.Re 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 "VirtualNetworkAddressesClient.BeginCreateOrUpdate": - resp, err = v.dispatchBeginCreateOrUpdate(req) - case "VirtualNetworkAddressesClient.BeginDelete": - resp, err = v.dispatchBeginDelete(req) - case "VirtualNetworkAddressesClient.Get": - resp, err = v.dispatchGet(req) - case "VirtualNetworkAddressesClient.NewListByCloudVMClusterPager": - resp, err = v.dispatchNewListByCloudVMClusterPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (v *VirtualNetworkAddressesServerTransport) 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 virtualNetworkAddressesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = virtualNetworkAddressesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "VirtualNetworkAddressesClient.BeginCreateOrUpdate": + res.resp, res.err = v.dispatchBeginCreateOrUpdate(req) + case "VirtualNetworkAddressesClient.BeginDelete": + res.resp, res.err = v.dispatchBeginDelete(req) + case "VirtualNetworkAddressesClient.Get": + res.resp, res.err = v.dispatchGet(req) + case "VirtualNetworkAddressesClient.NewListByParentPager": + res.resp, res.err = v.dispatchNewListByParentPager(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 *VirtualNetworkAddressesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -102,7 +117,7 @@ func (v *VirtualNetworkAddressesServerTransport) dispatchBeginCreateOrUpdate(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualNetworkAddresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armoracledatabase.VirtualNetworkAddress](req) @@ -154,7 +169,7 @@ func (v *VirtualNetworkAddressesServerTransport) dispatchBeginDelete(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualNetworkAddresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -182,9 +197,9 @@ func (v *VirtualNetworkAddressesServerTransport) dispatchBeginDelete(req *http.R 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) @@ -200,7 +215,7 @@ func (v *VirtualNetworkAddressesServerTransport) dispatchGet(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualNetworkAddresses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -230,16 +245,16 @@ func (v *VirtualNetworkAddressesServerTransport) dispatchGet(req *http.Request) return resp, nil } -func (v *VirtualNetworkAddressesServerTransport) dispatchNewListByCloudVMClusterPager(req *http.Request) (*http.Response, error) { - if v.srv.NewListByCloudVMClusterPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByCloudVMClusterPager not implemented")} +func (v *VirtualNetworkAddressesServerTransport) dispatchNewListByParentPager(req *http.Request) (*http.Response, error) { + if v.srv.NewListByParentPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListByParentPager not implemented")} } - newListByCloudVMClusterPager := v.newListByCloudVMClusterPager.get(req) - if newListByCloudVMClusterPager == nil { + newListByParentPager := v.newListByParentPager.get(req) + if newListByParentPager == nil { const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Oracle\.Database/cloudVmClusters/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/virtualNetworkAddresses` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -250,23 +265,29 @@ func (v *VirtualNetworkAddressesServerTransport) dispatchNewListByCloudVMCluster if err != nil { return nil, err } - resp := v.srv.NewListByCloudVMClusterPager(resourceGroupNameParam, cloudvmclusternameParam, nil) - newListByCloudVMClusterPager = &resp - v.newListByCloudVMClusterPager.add(req, newListByCloudVMClusterPager) - server.PagerResponderInjectNextLinks(newListByCloudVMClusterPager, req, func(page *armoracledatabase.VirtualNetworkAddressesClientListByCloudVMClusterResponse, createLink func() string) { + resp := v.srv.NewListByParentPager(resourceGroupNameParam, cloudvmclusternameParam, nil) + newListByParentPager = &resp + v.newListByParentPager.add(req, newListByParentPager) + server.PagerResponderInjectNextLinks(newListByParentPager, req, func(page *armoracledatabase.VirtualNetworkAddressesClientListByParentResponse, createLink func() string) { page.NextLink = to.Ptr(createLink()) }) } - resp, err := server.PagerResponderNext(newListByCloudVMClusterPager, req) + resp, err := server.PagerResponderNext(newListByParentPager, req) if err != nil { return nil, err } if !contains([]int{http.StatusOK}, resp.StatusCode) { - v.newListByCloudVMClusterPager.remove(req) + v.newListByParentPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } - if !server.PagerResponderMore(newListByCloudVMClusterPager) { - v.newListByCloudVMClusterPager.remove(req) + if !server.PagerResponderMore(newListByParentPager) { + v.newListByParentPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to VirtualNetworkAddressesServerTransport +var virtualNetworkAddressesServerTransportInterceptor 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/oracledatabase/armoracledatabase/flexcomponents_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/flexcomponents_client.go new file mode 100644 index 000000000000..9af173cf717c --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/flexcomponents_client.go @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armoracledatabase + +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" +) + +// FlexComponentsClient contains the methods for the FlexComponents group. +// Don't use this type directly, use NewFlexComponentsClient() instead. +type FlexComponentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewFlexComponentsClient creates a new instance of FlexComponentsClient 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 NewFlexComponentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*FlexComponentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &FlexComponentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a FlexComponent +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - location - The name of the Azure region. +// - flexComponentName - The name of the FlexComponent +// - options - FlexComponentsClientGetOptions contains the optional parameters for the FlexComponentsClient.Get method. +func (client *FlexComponentsClient) Get(ctx context.Context, location string, flexComponentName string, options *FlexComponentsClientGetOptions) (FlexComponentsClientGetResponse, error) { + var err error + const operationName = "FlexComponentsClient.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, location, flexComponentName, options) + if err != nil { + return FlexComponentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return FlexComponentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return FlexComponentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *FlexComponentsClient) getCreateRequest(ctx context.Context, location string, flexComponentName string, _ *FlexComponentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/flexComponents/{flexComponentName}" + 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)) + if flexComponentName == "" { + return nil, errors.New("parameter flexComponentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{flexComponentName}", url.PathEscape(flexComponentName)) + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FlexComponentsClient) getHandleResponse(resp *http.Response) (FlexComponentsClientGetResponse, error) { + result := FlexComponentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FlexComponent); err != nil { + return FlexComponentsClientGetResponse{}, err + } + return result, nil +} + +// NewListByParentPager - List FlexComponent resources by SubscriptionLocationResource +// +// Generated from API version 2025-03-01 +// - location - The name of the Azure region. +// - options - FlexComponentsClientListByParentOptions contains the optional parameters for the FlexComponentsClient.NewListByParentPager +// method. +func (client *FlexComponentsClient) NewListByParentPager(location string, options *FlexComponentsClientListByParentOptions) *runtime.Pager[FlexComponentsClientListByParentResponse] { + return runtime.NewPager(runtime.PagingHandler[FlexComponentsClientListByParentResponse]{ + More: func(page FlexComponentsClientListByParentResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *FlexComponentsClientListByParentResponse) (FlexComponentsClientListByParentResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "FlexComponentsClient.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, location, options) + }, nil) + if err != nil { + return FlexComponentsClientListByParentResponse{}, err + } + return client.listByParentHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByParentCreateRequest creates the ListByParent request. +func (client *FlexComponentsClient) listByParentCreateRequest(ctx context.Context, location string, options *FlexComponentsClientListByParentOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/flexComponents" + 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.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-03-01") + if options != nil && options.Shape != nil { + reqQP.Set("shape", string(*options.Shape)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByParentHandleResponse handles the ListByParent response. +func (client *FlexComponentsClient) listByParentHandleResponse(resp *http.Response) (FlexComponentsClientListByParentResponse, error) { + result := FlexComponentsClientListByParentResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.FlexComponentListResult); err != nil { + return FlexComponentsClientListByParentResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/flexcomponents_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/flexcomponents_client_example_test.go new file mode 100644 index 000000000000..f4679d583cae --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/flexcomponents_client_example_test.go @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armoracledatabase_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/oracledatabase/armoracledatabase/v2" + "log" +) + +// Generated from example definition: 2025-03-01/FlexComponents_Get_MaximumSet_Gen.json +func ExampleFlexComponentsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewFlexComponentsClient().Get(ctx, "eastus", "flexComponent", 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 = armoracledatabase.FlexComponentsClientGetResponse{ + // FlexComponent: &armoracledatabase.FlexComponent{ + // Properties: &armoracledatabase.FlexComponentProperties{ + // MinimumCoreCount: to.Ptr[int32](16), + // AvailableCoreCount: to.Ptr[int32](11), + // AvailableDbStorageInGbs: to.Ptr[int32](8), + // RuntimeMinimumCoreCount: to.Ptr[int32](13), + // Shape: to.Ptr("Exadata.X11M"), + // AvailableMemoryInGbs: to.Ptr[int32](15), + // AvailableLocalStorageInGbs: to.Ptr[int32](13), + // ComputeModel: to.Ptr("ECPU"), + // HardwareType: to.Ptr(armoracledatabase.HardwareTypeCOMPUTE), + // DescriptionSummary: to.Ptr("The description summary for this Flex Component"), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/flexComponents/name"), + // Name: to.Ptr("fc"), + // Type: to.Ptr("Oracle.Database/flexComponents"), + // SystemData: &armoracledatabase.SystemData{ + // CreatedBy: to.Ptr("ilrpjodjmvzhybazxipoplnql"), + // CreatedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // LastModifiedBy: to.Ptr("lhjbxchqkaia"), + // LastModifiedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-03-01/FlexComponents_ListByParent_MaximumSet_Gen.json +func ExampleFlexComponentsClient_NewListByParentPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewFlexComponentsClient().NewListByParentPager("eastus", &FlexComponentsClientListByParentOptions{ + shape: to.Ptr(armoracledatabase.SystemShapesExadataX11M)}) + 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 = armoracledatabase.FlexComponentsClientListByParentResponse{ + // FlexComponentListResult: armoracledatabase.FlexComponentListResult{ + // Value: []*armoracledatabase.FlexComponent{ + // { + // Properties: &armoracledatabase.FlexComponentProperties{ + // MinimumCoreCount: to.Ptr[int32](16), + // AvailableCoreCount: to.Ptr[int32](11), + // AvailableDbStorageInGbs: to.Ptr[int32](8), + // RuntimeMinimumCoreCount: to.Ptr[int32](13), + // Shape: to.Ptr("Exadata.X11M"), + // AvailableMemoryInGbs: to.Ptr[int32](15), + // AvailableLocalStorageInGbs: to.Ptr[int32](13), + // ComputeModel: to.Ptr("ECPU"), + // HardwareType: to.Ptr(armoracledatabase.HardwareTypeCOMPUTE), + // DescriptionSummary: to.Ptr("The description summary for this Flex Component"), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/flexComponents/name"), + // Name: to.Ptr("fc"), + // Type: to.Ptr("Oracle.Database/flexComponents"), + // SystemData: &armoracledatabase.SystemData{ + // CreatedBy: to.Ptr("ilrpjodjmvzhybazxipoplnql"), + // CreatedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // LastModifiedBy: to.Ptr("lhjbxchqkaia"), + // LastModifiedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/giminorversions_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/giminorversions_client.go new file mode 100644 index 000000000000..23394357ca2e --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/giminorversions_client.go @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armoracledatabase + +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" +) + +// GiMinorVersionsClient contains the methods for the GiMinorVersions group. +// Don't use this type directly, use NewGiMinorVersionsClient() instead. +type GiMinorVersionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewGiMinorVersionsClient creates a new instance of GiMinorVersionsClient 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 NewGiMinorVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GiMinorVersionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GiMinorVersionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get a GiMinorVersion +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - location - The name of the Azure region. +// - giversionname - GiVersion name +// - giMinorVersionName - The name of the GiMinorVersion +// - options - GiMinorVersionsClientGetOptions contains the optional parameters for the GiMinorVersionsClient.Get method. +func (client *GiMinorVersionsClient) Get(ctx context.Context, location string, giversionname string, giMinorVersionName string, options *GiMinorVersionsClientGetOptions) (GiMinorVersionsClientGetResponse, error) { + var err error + const operationName = "GiMinorVersionsClient.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, location, giversionname, giMinorVersionName, options) + if err != nil { + return GiMinorVersionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return GiMinorVersionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return GiMinorVersionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *GiMinorVersionsClient) getCreateRequest(ctx context.Context, location string, giversionname string, giMinorVersionName string, _ *GiMinorVersionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/giVersions/{giversionname}/giMinorVersions/{giMinorVersionName}" + 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)) + if giversionname == "" { + return nil, errors.New("parameter giversionname cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{giversionname}", url.PathEscape(giversionname)) + if giMinorVersionName == "" { + return nil, errors.New("parameter giMinorVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{giMinorVersionName}", url.PathEscape(giMinorVersionName)) + 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-03-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GiMinorVersionsClient) getHandleResponse(resp *http.Response) (GiMinorVersionsClientGetResponse, error) { + result := GiMinorVersionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GiMinorVersion); err != nil { + return GiMinorVersionsClientGetResponse{}, err + } + return result, nil +} + +// NewListByParentPager - List GiMinorVersion resources by GiVersion +// +// Generated from API version 2025-03-01 +// - location - The name of the Azure region. +// - giversionname - GiVersion name +// - options - GiMinorVersionsClientListByParentOptions contains the optional parameters for the GiMinorVersionsClient.NewListByParentPager +// method. +func (client *GiMinorVersionsClient) NewListByParentPager(location string, giversionname string, options *GiMinorVersionsClientListByParentOptions) *runtime.Pager[GiMinorVersionsClientListByParentResponse] { + return runtime.NewPager(runtime.PagingHandler[GiMinorVersionsClientListByParentResponse]{ + More: func(page GiMinorVersionsClientListByParentResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GiMinorVersionsClientListByParentResponse) (GiMinorVersionsClientListByParentResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "GiMinorVersionsClient.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, location, giversionname, options) + }, nil) + if err != nil { + return GiMinorVersionsClientListByParentResponse{}, err + } + return client.listByParentHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByParentCreateRequest creates the ListByParent request. +func (client *GiMinorVersionsClient) listByParentCreateRequest(ctx context.Context, location string, giversionname string, options *GiMinorVersionsClientListByParentOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/giVersions/{giversionname}/giMinorVersions" + 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)) + if giversionname == "" { + return nil, errors.New("parameter giversionname cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{giversionname}", url.PathEscape(giversionname)) + 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-03-01") + if options != nil && options.ShapeFamily != nil { + reqQP.Set("shapeFamily", string(*options.ShapeFamily)) + } + if options != nil && options.Zone != nil { + reqQP.Set("zone", *options.Zone) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByParentHandleResponse handles the ListByParent response. +func (client *GiMinorVersionsClient) listByParentHandleResponse(resp *http.Response) (GiMinorVersionsClientListByParentResponse, error) { + result := GiMinorVersionsClientListByParentResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GiMinorVersionListResult); err != nil { + return GiMinorVersionsClientListByParentResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/giminorversions_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/giminorversions_client_example_test.go new file mode 100644 index 000000000000..ba2e4c3aea5f --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/giminorversions_client_example_test.go @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package armoracledatabase_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/oracledatabase/armoracledatabase/v2" + "log" +) + +// Generated from example definition: 2025-03-01/GiMinorVersions_Get_MaximumSet_Gen.json +func ExampleGiMinorVersionsClient_Get() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + res, err := clientFactory.NewGiMinorVersionsClient().Get(ctx, "eastus", "giVersionName", "giMinorVersionName", 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 = armoracledatabase.GiMinorVersionsClientGetResponse{ + // GiMinorVersion: &armoracledatabase.GiMinorVersion{ + // Properties: &armoracledatabase.GiMinorVersionProperties{ + // Version: to.Ptr("oznlupakllqglkgrepsttjqwcocrdmacagcrdloaikfhhwepottsdoezcoiyjmemxgbxstdjmjcmgjdoozvefmsungmipnnuhixcipskafmyczxzffyqoinjdbnlkthcsbqobeddkuyxqcrveozao"), + // GridImageOcid: to.Ptr("ocid1.dbpatch.oc1..aaaaa3klq"), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/giVersions/19.0.0.0/giMinorVersions/minorVersion"), + // Name: to.Ptr("bthzelohzaolpeytksswrnkbcnen"), + // Type: to.Ptr("acesitmovkyb"), + // SystemData: &armoracledatabase.SystemData{ + // CreatedBy: to.Ptr("ilrpjodjmvzhybazxipoplnql"), + // CreatedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // LastModifiedBy: to.Ptr("lhjbxchqkaia"), + // LastModifiedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // }, + // }, + // } +} + +// Generated from example definition: 2025-03-01/GiMinorVersions_ListByParent_MaximumSet_Gen.json +func ExampleGiMinorVersionsClient_NewListByParentPager() { + cred, err := azidentity.NewDefaultAzureCredential(nil) + if err != nil { + log.Fatalf("failed to obtain a credential: %v", err) + } + ctx := context.Background() + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) + if err != nil { + log.Fatalf("failed to create client: %v", err) + } + pager := clientFactory.NewGiMinorVersionsClient().NewListByParentPager("eastus", "giVersionName", &GiMinorVersionsClientListByParentOptions{ + shapeFamily: to.Ptr(armoracledatabase.ShapeFamily("rtfcosvtlpeeqoicsjqggtgc"))}) + 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 = armoracledatabase.GiMinorVersionsClientListByParentResponse{ + // GiMinorVersionListResult: armoracledatabase.GiMinorVersionListResult{ + // Value: []*armoracledatabase.GiMinorVersion{ + // { + // Properties: &armoracledatabase.GiMinorVersionProperties{ + // Version: to.Ptr("oznlupakllqglkgrepsttjqwcocrdmacagcrdloaikfhhwepottsdoezcoiyjmemxgbxstdjmjcmgjdoozvefmsungmipnnuhixcipskafmyczxzffyqoinjdbnlkthcsbqobeddkuyxqcrveozao"), + // GridImageOcid: to.Ptr("ocid1.dbpatch.oc1..aaaaa3klq"), + // }, + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/giVersions/19.0.0.0/giMinorVersions/minorVersion"), + // Name: to.Ptr("bthzelohzaolpeytksswrnkbcnen"), + // Type: to.Ptr("acesitmovkyb"), + // SystemData: &armoracledatabase.SystemData{ + // CreatedBy: to.Ptr("ilrpjodjmvzhybazxipoplnql"), + // CreatedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // LastModifiedBy: to.Ptr("lhjbxchqkaia"), + // LastModifiedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // }, + // }, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, + // } + } +} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client.go index 1a3b95f94727..4e6a293b13b0 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_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 armoracledatabase @@ -46,7 +42,7 @@ func NewGiVersionsClient(subscriptionID string, credential azcore.TokenCredentia // Get - Get a GiVersion // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - giversionname - GiVersion name // - options - GiVersionsClientGetOptions contains the optional parameters for the GiVersionsClient.Get method. @@ -73,7 +69,7 @@ func (client *GiVersionsClient) Get(ctx context.Context, location string, givers } // getCreateRequest creates the Get request. -func (client *GiVersionsClient) getCreateRequest(ctx context.Context, location string, giversionname string, options *GiVersionsClientGetOptions) (*policy.Request, error) { +func (client *GiVersionsClient) getCreateRequest(ctx context.Context, location string, giversionname string, _ *GiVersionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/giVersions/{giversionname}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -92,7 +88,7 @@ func (client *GiVersionsClient) getCreateRequest(ctx context.Context, location s return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -107,9 +103,9 @@ func (client *GiVersionsClient) getHandleResponse(resp *http.Response) (GiVersio return result, nil } -// NewListByLocationPager - List GiVersion resources by Location +// NewListByLocationPager - List GiVersion resources by SubscriptionLocationResource // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - options - GiVersionsClientListByLocationOptions contains the optional parameters for the GiVersionsClient.NewListByLocationPager // method. @@ -152,7 +148,13 @@ func (client *GiVersionsClient) listByLocationCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") + if options != nil && options.Shape != nil { + reqQP.Set("shape", string(*options.Shape)) + } + if options != nil && options.Zone != nil { + reqQP.Set("zone", *options.Zone) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client_example_test.go index f9115c0f888b..8c5f206d22a3 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client_example_test.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/giversions_client_example_test.go @@ -1,34 +1,30 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights 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 armoracledatabase_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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/giVersions_listByLocation.json -func ExampleGiVersionsClient_NewListByLocationPager() { +// Generated from example definition: 2025-03-01/GiVersions_ListByLocation_MaximumSet_Gen.json +func ExampleGiVersionsClient_NewListByLocationPager_listGiVersionsByLocationGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - pager := clientFactory.NewGiVersionsClient().NewListByLocationPager("eastus", nil) + pager := clientFactory.NewGiVersionsClient().NewListByLocationPager("eastus", &GiVersionsClientListByLocationOptions{ + shape: to.Ptr(armoracledatabase.SystemShapes("osixsklyaauhoqnkxvnvsqeqenhzogntqnpubldrrfvqncwetdtwqwjjcvspwhgecbimdlulwcubikebrdzmidrucgtsuqvytkqutmbyrvvyioxpocpmuwiivyanjzucaegihztluuvpznzaoakfsselumhhsvrtrbzwpjhcihsvyouonlxdluwhqfxoqvgthkaxppbydtqjntscgzbivfdcaobbkthrbdjwpejirqmbly"))}) for pager.More() { page, err := pager.NextPage(ctx) if err != nil { @@ -39,42 +35,62 @@ func ExampleGiVersionsClient_NewListByLocationPager() { _ = v } // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.GiVersionListResult = armoracledatabase.GiVersionListResult{ - // Value: []*armoracledatabase.GiVersion{ - // { - // Type: to.Ptr("Oracle.Database/locations/giVersions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/giVersions/19.0.0.0"), - // Properties: &armoracledatabase.GiVersionProperties{ - // Version: to.Ptr("19.0.0.0"), + // page = armoracledatabase.GiVersionsClientListByLocationResponse{ + // GiVersionListResult: armoracledatabase.GiVersionListResult{ + // Value: []*armoracledatabase.GiVersion{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/giVersions/19.0.0.0"), + // Type: to.Ptr("Oracle.Database/locations/giVersions"), + // Properties: &armoracledatabase.GiVersionProperties{ + // Version: to.Ptr("19.0.0.0"), + // }, + // Name: to.Ptr("lmktkddwvpv"), + // SystemData: &armoracledatabase.SystemData{ + // CreatedBy: to.Ptr("ilrpjodjmvzhybazxipoplnql"), + // CreatedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // LastModifiedBy: to.Ptr("lhjbxchqkaia"), + // LastModifiedByType: to.Ptr(armoracledatabase.CreatedByTypeUser), + // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2024-12-09T21:02:12.592Z"); return t}()), + // }, // }, - // }}, + // }, + // NextLink: to.Ptr("https://microsoft.com/a"), + // }, // } } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/giVersions_get.json -func ExampleGiVersionsClient_Get() { +// Generated from example definition: 2025-03-01/GiVersions_ListByLocation_MinimumSet_Gen.json +func ExampleGiVersionsClient_NewListByLocationPager_listGiVersionsByLocationGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewGiVersionsClient().Get(ctx, "eastus", "19.0.0.0", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) + pager := clientFactory.NewGiVersionsClient().NewListByLocationPager("eastus", 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 = armoracledatabase.GiVersionsClientListByLocationResponse{ + // GiVersionListResult: armoracledatabase.GiVersionListResult{ + // Value: []*armoracledatabase.GiVersion{ + // { + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/giVersions/19.0.0.0"), + // }, + // }, + // }, + // } } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.GiVersion = armoracledatabase.GiVersion{ - // Type: to.Ptr("Oracle.Database/locations/giVersions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/giVersions/19.0.0.0"), - // Properties: &armoracledatabase.GiVersionProperties{ - // Version: to.Ptr("19.0.0.0"), - // }, - // } } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/go.mod b/sdk/resourcemanager/oracledatabase/armoracledatabase/go.mod index 8ca2ccf191d8..1ce80604d279 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/go.mod +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/go.mod @@ -1,4 +1,4 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2 go 1.23.0 diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/interfaces.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/interfaces.go index 17c4012b7ecb..4ecd10943fca 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/interfaces.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/interfaces.go @@ -1,17 +1,14 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armoracledatabase // AutonomousDatabaseBasePropertiesClassification provides polymorphic access to related types. // Call the interface's GetAutonomousDatabaseBaseProperties() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *AutonomousDatabaseBaseProperties, *AutonomousDatabaseCloneProperties, *AutonomousDatabaseProperties +// - *AutonomousDatabaseBaseProperties, *AutonomousDatabaseCloneProperties, *AutonomousDatabaseCrossRegionDisasterRecoveryProperties, +// - *AutonomousDatabaseFromBackupTimestampProperties, *AutonomousDatabaseProperties type AutonomousDatabaseBasePropertiesClassification interface { // GetAutonomousDatabaseBaseProperties returns the AutonomousDatabaseBaseProperties content of the underlying type. GetAutonomousDatabaseBaseProperties() *AutonomousDatabaseBaseProperties diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/models.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/models.go index 49ee984711d8..057a5f09fae7 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/models.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/models.go @@ -1,24 +1,11 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code 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 armoracledatabase import "time" -// ActivationLinks - Activation Links model -type ActivationLinks struct { - // READ-ONLY; Existing Cloud Account Activation Link - ExistingCloudAccountActivationLink *string - - // READ-ONLY; New Cloud Account Activation Link - NewCloudAccountActivationLink *string -} - // AddRemoveDbNode - Add/Remove (Virtual Machine) DbNode model type AddRemoveDbNode struct { // REQUIRED; Db servers ocids @@ -61,12 +48,12 @@ type AutonomousDatabase struct { // Resource tags. Tags map[string]*string - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; The database 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 @@ -79,12 +66,12 @@ type AutonomousDatabaseBackup struct { // The resource-specific properties for this resource. Properties *AutonomousDatabaseBackupProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; AutonomousDatabaseBackup id 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 @@ -106,7 +93,7 @@ type AutonomousDatabaseBackupProperties struct { // The user-friendly name for the backup. The name does not have to be unique. DisplayName *string - // Retention period, in days, for long-term backups. + // Retention period, in days RetentionPeriodInDays *int32 // READ-ONLY; The OCID of the Autonomous Database. @@ -152,18 +139,6 @@ type AutonomousDatabaseBackupProperties struct { TimeStarted *string } -// AutonomousDatabaseBackupUpdate - The type used for update operations of the AutonomousDatabaseBackup. -type AutonomousDatabaseBackupUpdate struct { - // The updatable properties of the AutonomousDatabaseBackup. - Properties *AutonomousDatabaseBackupUpdateProperties -} - -// AutonomousDatabaseBackupUpdateProperties - The updatable properties of the AutonomousDatabaseBackup. -type AutonomousDatabaseBackupUpdateProperties struct { - // Retention period, in days, for long-term backups. - RetentionPeriodInDays *int32 -} - // AutonomousDatabaseBaseProperties - Autonomous Database base resource model. type AutonomousDatabaseBaseProperties struct { // REQUIRED; Database type to be created. @@ -245,7 +220,7 @@ type AutonomousDatabaseBaseProperties struct { // Indicates the Autonomous Database mode. OpenMode *OpenModeType - // The database OCID of the Disaster Recovery peer database, which is located in a different region from the current peer + // The Azure resource ID of the Disaster Recovery peer database, which is located in a different region from the current peer // database. PeerDbID *string @@ -316,8 +291,8 @@ type AutonomousDatabaseBaseProperties struct { LifecycleState *AutonomousDatabaseLifecycleState // READ-ONLY; Indicates the local disaster recovery (DR) type of the Autonomous Database Serverless instance.Autonomous Data - // Guard (ADG) DR type provides business critical DR with a faster recovery time objective - // (RTO) during failover or switchover.Backup-based DR type provides lower cost DR with a slower RTO during failover or switchover. + // Guard (ADG) DR type provides business critical DR with a faster recovery time objective (RTO) during failover or switchover.Backup-based + // DR type provides lower cost DR with a slower RTO during failover or switchover. LocalDisasterRecoveryType *DisasterRecoveryType // READ-ONLY; Local Autonomous Disaster Recovery standby database details. @@ -338,10 +313,9 @@ type AutonomousDatabaseBaseProperties struct { // READ-ONLY; Status of Operations Insights for this Autonomous Database. OperationsInsightsStatus *OperationsInsightsStatusType - // READ-ONLY; The list of OCIDs [https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm] of standby databases - // located in Autonomous Data Guard remote regions that are associated with the source - // database. Note that for Autonomous Database Serverless instances, standby databases located in the same region as the source - // primary database do not have OCIDs. + // READ-ONLY; The list of Azure resource IDs of standby databases located in Autonomous Data Guard remote regions that are + // associated with the source database. Note that for Autonomous Database Serverless instances, standby databases located + // in the same region as the source primary database do not have Azure IDs. PeerDbIDs []*string // READ-ONLY; The private endpoint for the resource. @@ -353,6 +327,9 @@ type AutonomousDatabaseBaseProperties struct { // READ-ONLY; Azure resource provisioning state. ProvisioningState *AzureResourceProvisioningState + // READ-ONLY; Indicates remote disaster recovery configuration + RemoteDisasterRecoveryConfiguration *DisasterRecoveryConfigurationDetails + // READ-ONLY; The SQL Web Developer URL for the Oracle Autonomous Database. SQLWebDeveloperURL *string @@ -372,6 +349,9 @@ type AutonomousDatabaseBaseProperties struct { // READ-ONLY; The date and time the Always Free database will be automatically deleted because of inactivity. TimeDeletionOfFreeAutonomousDatabase *string + // READ-ONLY; The date and time the Disaster Recovery role was switched for the standby Autonomous Database. + TimeDisasterRecoveryRoleChanged *time.Time + // READ-ONLY; The date and time that Autonomous Data Guard was enabled for an Autonomous Database where the standby was provisioned // in the same region as the primary database. TimeLocalDataGuardEnabled *string @@ -414,12 +394,12 @@ type AutonomousDatabaseCharacterSet struct { // The resource-specific properties for this resource. Properties *AutonomousDatabaseCharacterSetProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; AutonomousDatabaseCharacterSet 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 @@ -438,7 +418,7 @@ type AutonomousDatabaseCharacterSetListResult struct { // AutonomousDatabaseCharacterSetProperties - AutonomousDatabaseCharacterSet resource model type AutonomousDatabaseCharacterSetProperties struct { - // READ-ONLY; The Oracle Autonomous Database supported character sets. + // REQUIRED; The Oracle Autonomous Database supported character sets. CharacterSet *string } @@ -447,10 +427,11 @@ type AutonomousDatabaseCloneProperties struct { // REQUIRED; The Autonomous Database clone type. CloneType *CloneType - // REQUIRED; Database type to be created. + // CONSTANT; Database type to be created. + // Field has constant value DataBaseTypeClone, any specified value is ignored. DataBaseType *DataBaseType - // REQUIRED; The Azure ID of the Autonomous Database that was cloned to create the current Autonomous Database. + // REQUIRED; The Azure resource ID of the Autonomous Database that was cloned to create the current Autonomous Database. SourceID *string // Admin password. @@ -529,7 +510,7 @@ type AutonomousDatabaseCloneProperties struct { // Indicates the Autonomous Database mode. OpenMode *OpenModeType - // The database OCID of the Disaster Recovery peer database, which is located in a different region from the current peer + // The Azure resource ID of the Disaster Recovery peer database, which is located in a different region from the current peer // database. PeerDbID *string @@ -616,8 +597,8 @@ type AutonomousDatabaseCloneProperties struct { LifecycleState *AutonomousDatabaseLifecycleState // READ-ONLY; Indicates the local disaster recovery (DR) type of the Autonomous Database Serverless instance.Autonomous Data - // Guard (ADG) DR type provides business critical DR with a faster recovery time objective - // (RTO) during failover or switchover.Backup-based DR type provides lower cost DR with a slower RTO during failover or switchover. + // Guard (ADG) DR type provides business critical DR with a faster recovery time objective (RTO) during failover or switchover.Backup-based + // DR type provides lower cost DR with a slower RTO during failover or switchover. LocalDisasterRecoveryType *DisasterRecoveryType // READ-ONLY; Local Autonomous Disaster Recovery standby database details. @@ -638,10 +619,9 @@ type AutonomousDatabaseCloneProperties struct { // READ-ONLY; Status of Operations Insights for this Autonomous Database. OperationsInsightsStatus *OperationsInsightsStatusType - // READ-ONLY; The list of OCIDs [https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm] of standby databases - // located in Autonomous Data Guard remote regions that are associated with the source - // database. Note that for Autonomous Database Serverless instances, standby databases located in the same region as the source - // primary database do not have OCIDs. + // READ-ONLY; The list of Azure resource IDs of standby databases located in Autonomous Data Guard remote regions that are + // associated with the source database. Note that for Autonomous Database Serverless instances, standby databases located + // in the same region as the source primary database do not have Azure IDs. PeerDbIDs []*string // READ-ONLY; The private endpoint for the resource. @@ -656,6 +636,9 @@ type AutonomousDatabaseCloneProperties struct { // READ-ONLY; The refresh status of the clone. RefreshableStatus *RefreshableStatusType + // READ-ONLY; Indicates remote disaster recovery configuration + RemoteDisasterRecoveryConfiguration *DisasterRecoveryConfigurationDetails + // READ-ONLY; The SQL Web Developer URL for the Oracle Autonomous Database. SQLWebDeveloperURL *string @@ -675,6 +658,9 @@ type AutonomousDatabaseCloneProperties struct { // READ-ONLY; The date and time the Always Free database will be automatically deleted because of inactivity. TimeDeletionOfFreeAutonomousDatabase *string + // READ-ONLY; The date and time the Disaster Recovery role was switched for the standby Autonomous Database. + TimeDisasterRecoveryRoleChanged *time.Time + // READ-ONLY; The date and time that Autonomous Data Guard was enabled for an Autonomous Database where the standby was provisioned // in the same region as the primary database. TimeLocalDataGuardEnabled *string @@ -764,6 +750,7 @@ func (a *AutonomousDatabaseCloneProperties) GetAutonomousDatabaseBaseProperties( PrivateEndpointLabel: a.PrivateEndpointLabel, ProvisionableCpus: a.ProvisionableCpus, ProvisioningState: a.ProvisioningState, + RemoteDisasterRecoveryConfiguration: a.RemoteDisasterRecoveryConfiguration, Role: a.Role, SQLWebDeveloperURL: a.SQLWebDeveloperURL, ScheduledOperations: a.ScheduledOperations, @@ -773,6 +760,7 @@ func (a *AutonomousDatabaseCloneProperties) GetAutonomousDatabaseBaseProperties( TimeCreated: a.TimeCreated, TimeDataGuardRoleChanged: a.TimeDataGuardRoleChanged, TimeDeletionOfFreeAutonomousDatabase: a.TimeDeletionOfFreeAutonomousDatabase, + TimeDisasterRecoveryRoleChanged: a.TimeDisasterRecoveryRoleChanged, TimeLocalDataGuardEnabled: a.TimeLocalDataGuardEnabled, TimeMaintenanceBegin: a.TimeMaintenanceBegin, TimeMaintenanceEnd: a.TimeMaintenanceEnd, @@ -788,52 +776,23 @@ func (a *AutonomousDatabaseCloneProperties) GetAutonomousDatabaseBaseProperties( } } -// AutonomousDatabaseListResult - The response of a AutonomousDatabase list operation. -type AutonomousDatabaseListResult struct { - // REQUIRED; The AutonomousDatabase items on this page - Value []*AutonomousDatabase - - // The link to the next page of items - NextLink *string -} - -// AutonomousDatabaseNationalCharacterSets resource definition -type AutonomousDatabaseNationalCharacterSet struct { - // The resource-specific properties for this resource. - Properties *AutonomousDatabaseNationalCharacterSetProperties - - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// AutonomousDatabaseNationalCharacterSetListResult - The response of a AutonomousDatabaseNationalCharacterSet list operation. -type AutonomousDatabaseNationalCharacterSetListResult struct { - // REQUIRED; The AutonomousDatabaseNationalCharacterSet items on this page - Value []*AutonomousDatabaseNationalCharacterSet +// AutonomousDatabaseCrossRegionDisasterRecoveryProperties - Autonomous Database Cross Region Disaster Recovery resource model. +type AutonomousDatabaseCrossRegionDisasterRecoveryProperties struct { + // CONSTANT; Database type to be created. + // Field has constant value DataBaseTypeCrossRegionDisasterRecovery, any specified value is ignored. + DataBaseType *DataBaseType - // The link to the next page of items - NextLink *string -} + // REQUIRED; Indicates the cross-region disaster recovery (DR) type of the standby Autonomous Database Serverless instance. + // Autonomous Data Guard (ADG) DR type provides business critical DR with a faster recovery time objective (RTO) during failover + // or switchover. Backup-based DR type provides lower cost DR with a slower RTO during failover or switchover. + RemoteDisasterRecoveryType *DisasterRecoveryType -// AutonomousDatabaseNationalCharacterSetProperties - AutonomousDatabaseNationalCharacterSet resource model -type AutonomousDatabaseNationalCharacterSetProperties struct { - // READ-ONLY; The Oracle Autonomous Database supported national character sets. - CharacterSet *string -} + // CONSTANT; The source of the database. + // Field has constant value SourceTypeCrossRegionDisasterRecovery, any specified value is ignored. + Source *SourceType -// AutonomousDatabaseProperties - Autonomous Database resource model. -type AutonomousDatabaseProperties struct { - // REQUIRED; Database type to be created. - DataBaseType *DataBaseType + // REQUIRED; The Azure ID of the source Autonomous Database that will be used to create a new peer database for the DR association. + SourceID *string // Admin password. AdminPassword *string @@ -895,6 +854,10 @@ type AutonomousDatabaseProperties struct { // Specifies if the Autonomous Database preview version is being provisioned. IsPreviewVersionWithServiceTermsAccepted *bool + // If true, 7 days worth of backups are replicated across regions for Cross-Region ADB or Backup-Based DR between Primary + // and Standby. If false, the backups taken on the Primary are not replicated to the Standby database. + IsReplicateAutomaticBackups *bool + // The Oracle license model that applies to the Oracle Autonomous Database. The default is LICENSE_INCLUDED. LicenseModel *LicenseModel @@ -911,7 +874,7 @@ type AutonomousDatabaseProperties struct { // Indicates the Autonomous Database mode. OpenMode *OpenModeType - // The database OCID of the Disaster Recovery peer database, which is located in a different region from the current peer + // The Azure resource ID of the Disaster Recovery peer database, which is located in a different region from the current peer // database. PeerDbID *string @@ -930,6 +893,12 @@ type AutonomousDatabaseProperties struct { // The list of scheduled operations. ScheduledOperations *ScheduledOperationsType + // The name of the region where source Autonomous Database exists. + SourceLocation *string + + // The source database ocid + SourceOcid *string + // Client subnet SubnetID *string @@ -982,8 +951,8 @@ type AutonomousDatabaseProperties struct { LifecycleState *AutonomousDatabaseLifecycleState // READ-ONLY; Indicates the local disaster recovery (DR) type of the Autonomous Database Serverless instance.Autonomous Data - // Guard (ADG) DR type provides business critical DR with a faster recovery time objective - // (RTO) during failover or switchover.Backup-based DR type provides lower cost DR with a slower RTO during failover or switchover. + // Guard (ADG) DR type provides business critical DR with a faster recovery time objective (RTO) during failover or switchover.Backup-based + // DR type provides lower cost DR with a slower RTO during failover or switchover. LocalDisasterRecoveryType *DisasterRecoveryType // READ-ONLY; Local Autonomous Disaster Recovery standby database details. @@ -1004,10 +973,9 @@ type AutonomousDatabaseProperties struct { // READ-ONLY; Status of Operations Insights for this Autonomous Database. OperationsInsightsStatus *OperationsInsightsStatusType - // READ-ONLY; The list of OCIDs [https://docs.oracle.com/iaas/Content/General/Concepts/identifiers.htm] of standby databases - // located in Autonomous Data Guard remote regions that are associated with the source - // database. Note that for Autonomous Database Serverless instances, standby databases located in the same region as the source - // primary database do not have OCIDs. + // READ-ONLY; The list of Azure resource IDs of standby databases located in Autonomous Data Guard remote regions that are + // associated with the source database. Note that for Autonomous Database Serverless instances, standby databases located + // in the same region as the source primary database do not have Azure IDs. PeerDbIDs []*string // READ-ONLY; The private endpoint for the resource. @@ -1019,6 +987,9 @@ type AutonomousDatabaseProperties struct { // READ-ONLY; Azure resource provisioning state. ProvisioningState *AzureResourceProvisioningState + // READ-ONLY; Indicates remote disaster recovery configuration + RemoteDisasterRecoveryConfiguration *DisasterRecoveryConfigurationDetails + // READ-ONLY; The SQL Web Developer URL for the Oracle Autonomous Database. SQLWebDeveloperURL *string @@ -1038,6 +1009,9 @@ type AutonomousDatabaseProperties struct { // READ-ONLY; The date and time the Always Free database will be automatically deleted because of inactivity. TimeDeletionOfFreeAutonomousDatabase *string + // READ-ONLY; The date and time the Disaster Recovery role was switched for the standby Autonomous Database. + TimeDisasterRecoveryRoleChanged *time.Time + // READ-ONLY; The date and time that Autonomous Data Guard was enabled for an Autonomous Database where the standby was provisioned // in the same region as the primary database. TimeLocalDataGuardEnabled *string @@ -1070,8 +1044,8 @@ type AutonomousDatabaseProperties struct { UsedDataStorageSizeInTbs *int32 } -// GetAutonomousDatabaseBaseProperties implements the AutonomousDatabaseBasePropertiesClassification interface for type AutonomousDatabaseProperties. -func (a *AutonomousDatabaseProperties) GetAutonomousDatabaseBaseProperties() *AutonomousDatabaseBaseProperties { +// GetAutonomousDatabaseBaseProperties implements the AutonomousDatabaseBasePropertiesClassification interface for type AutonomousDatabaseCrossRegionDisasterRecoveryProperties. +func (a *AutonomousDatabaseCrossRegionDisasterRecoveryProperties) GetAutonomousDatabaseBaseProperties() *AutonomousDatabaseBaseProperties { return &AutonomousDatabaseBaseProperties{ ActualUsedDataStorageSizeInTbs: a.ActualUsedDataStorageSizeInTbs, AdminPassword: a.AdminPassword, @@ -1127,6 +1101,7 @@ func (a *AutonomousDatabaseProperties) GetAutonomousDatabaseBaseProperties() *Au PrivateEndpointLabel: a.PrivateEndpointLabel, ProvisionableCpus: a.ProvisionableCpus, ProvisioningState: a.ProvisioningState, + RemoteDisasterRecoveryConfiguration: a.RemoteDisasterRecoveryConfiguration, Role: a.Role, SQLWebDeveloperURL: a.SQLWebDeveloperURL, ScheduledOperations: a.ScheduledOperations, @@ -1136,6 +1111,7 @@ func (a *AutonomousDatabaseProperties) GetAutonomousDatabaseBaseProperties() *Au TimeCreated: a.TimeCreated, TimeDataGuardRoleChanged: a.TimeDataGuardRoleChanged, TimeDeletionOfFreeAutonomousDatabase: a.TimeDeletionOfFreeAutonomousDatabase, + TimeDisasterRecoveryRoleChanged: a.TimeDisasterRecoveryRoleChanged, TimeLocalDataGuardEnabled: a.TimeLocalDataGuardEnabled, TimeMaintenanceBegin: a.TimeMaintenanceBegin, TimeMaintenanceEnd: a.TimeMaintenanceEnd, @@ -1151,39 +1127,28 @@ func (a *AutonomousDatabaseProperties) GetAutonomousDatabaseBaseProperties() *Au } } -// AutonomousDatabaseStandbySummary - Autonomous Disaster Recovery standby database details. -type AutonomousDatabaseStandbySummary struct { - // The amount of time, in seconds, that the data of the standby database lags the data of the primary database. Can be used - // to determine the potential data loss in the event of a failover. - LagTimeInSeconds *int32 - - // Additional information about the current lifecycle state. - LifecycleDetails *string - - // The current state of the Autonomous Database. - LifecycleState *AutonomousDatabaseLifecycleState - - // The date and time the Autonomous Data Guard role was switched for the standby Autonomous Database. - TimeDataGuardRoleChanged *string +// AutonomousDatabaseFromBackupTimestampProperties - Autonomous Database From Backup Timestamp resource model. +type AutonomousDatabaseFromBackupTimestampProperties struct { + // REQUIRED; The Autonomous Database clone type. + CloneType *CloneType - // The date and time the Disaster Recovery role was switched for the standby Autonomous Database. - TimeDisasterRecoveryRoleChanged *string -} + // CONSTANT; Database type to be created. + // Field has constant value DataBaseTypeCloneFromBackupTimestamp, any specified value is ignored. + DataBaseType *DataBaseType -// AutonomousDatabaseUpdate - The type used for update operations of the AutonomousDatabase. -type AutonomousDatabaseUpdate struct { - // The updatable properties of the AutonomousDatabase. - Properties *AutonomousDatabaseUpdateProperties + // CONSTANT; The source of the database. + // Field has constant value SourceTypeBackupFromTimestamp, any specified value is ignored. + Source *SourceType - // Resource tags. - Tags map[string]*string -} + // REQUIRED; The ID of the source Autonomous Database that you will clone to create a new Autonomous Database. + SourceID *string -// AutonomousDatabaseUpdateProperties - The updatable properties of the AutonomousDatabase. -type AutonomousDatabaseUpdateProperties struct { // Admin password. AdminPassword *string + // Autonomous Database ID + AutonomousDatabaseID *string + // The maintenance schedule type of the Autonomous Database Serverless. AutonomousMaintenanceScheduleType *AutonomousMaintenanceScheduleType @@ -1193,9 +1158,15 @@ type AutonomousDatabaseUpdateProperties struct { // The number of CPU cores to be made available to the database. CPUCoreCount *int32 + // The character set for the autonomous database. + CharacterSet *string + // The compute amount (CPUs) available to the database. ComputeCount *float32 + // The compute model of the Autonomous Database. + ComputeModel *ComputeModel + // Customer Contacts. CustomerContacts []*CustomerContact @@ -1208,6 +1179,12 @@ type AutonomousDatabaseUpdateProperties struct { // The Oracle Database Edition that applies to the Autonomous databases. DatabaseEdition *DatabaseEditionType + // A valid Oracle Database version for Autonomous Database. + DbVersion *string + + // The Autonomous Database workload type + DbWorkload *WorkloadType + // The user-friendly name for the Autonomous Database. DisplayName *string @@ -1223,6 +1200,9 @@ type AutonomousDatabaseUpdateProperties struct { // Specifies if the Autonomous Database requires mTLS connections. IsMtlsConnectionRequired *bool + // Specifies if the Autonomous Database preview version is being provisioned. + IsPreviewVersionWithServiceTermsAccepted *bool + // The Oracle license model that applies to the Oracle Autonomous Database. The default is LICENSE_INCLUDED. LicenseModel *LicenseModel @@ -1233,278 +1213,1555 @@ type AutonomousDatabaseUpdateProperties struct { // Details for the long-term backup schedule. LongTermBackupSchedule *LongTermBackUpScheduleDetails + // The character set for the Autonomous Database. + NcharacterSet *string + // Indicates the Autonomous Database mode. OpenMode *OpenModeType - // The database OCID of the Disaster Recovery peer database, which is located in a different region from the current peer + // The Azure resource ID of the Disaster Recovery peer database, which is located in a different region from the current peer // database. PeerDbID *string // The Autonomous Database permission level. PermissionLevel *PermissionLevelType + // The private endpoint Ip address for the resource. + PrivateEndpointIP *string + + // The resource's private endpoint label. + PrivateEndpointLabel *string + // The Data Guard role of the Autonomous Container Database or Autonomous Database, if Autonomous Data Guard is enabled. Role *RoleType // The list of scheduled operations. - ScheduledOperations *ScheduledOperationsTypeUpdate + ScheduledOperations *ScheduledOperationsType + + // Client subnet + SubnetID *string + + // The timestamp specified for the point-in-time clone of the source Autonomous Database. The timestamp must be in the past. + Timestamp *time.Time + + // Clone from latest available backup timestamp. + UseLatestAvailableBackupTimeStamp *bool + + // VNET for network connectivity + VnetID *string // The client IP access control list (ACL). This is an array of CIDR notations and/or IP addresses. Values should be separate // strings, separated by commas. Example: ['1.1.1.1','1.1.1.0/24','1.1.2.25'] WhitelistedIPs []*string -} -// AutonomousDatabaseWalletFile - Autonomous Database Wallet File resource model. -type AutonomousDatabaseWalletFile struct { - // REQUIRED; The base64 encoded wallet files - WalletFiles *string -} + // READ-ONLY; The current amount of storage in use for user and system data, in terabytes (TB). + ActualUsedDataStorageSizeInTbs *float64 -// AutonomousDbVersion resource definition -type AutonomousDbVersion struct { - // The resource-specific properties for this resource. - Properties *AutonomousDbVersionProperties + // READ-ONLY; The amount of storage currently allocated for the database tables and billed for, rounded up. + AllocatedStorageSizeInTbs *float64 - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string + // READ-ONLY; Information about Oracle APEX Application Development. + ApexDetails *ApexDetailsType - // READ-ONLY; The name of the resource - Name *string + // READ-ONLY; List of Oracle Database versions available for a database upgrade. If there are no version upgrades available, + // this list is empty. + AvailableUpgradeVersions []*string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData + // READ-ONLY; The connection string used to connect to the Autonomous Database. + ConnectionStrings *ConnectionStringType - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} + // READ-ONLY; The URLs for accessing Oracle Application Express (APEX) and SQL Developer Web with a browser from a Compute + // instance within your VCN or that has a direct connection to your VCN. + ConnectionUrls *ConnectionURLType -// AutonomousDbVersionListResult - The response of a AutonomousDbVersion list operation. -type AutonomousDbVersionListResult struct { - // REQUIRED; The AutonomousDbVersion items on this page - Value []*AutonomousDbVersion + // READ-ONLY; Status of the Data Safe registration for this Autonomous Database. + DataSafeStatus *DataSafeStatusType - // The link to the next page of items - NextLink *string -} + // READ-ONLY; Indicates the number of seconds of data loss for a Data Guard failover. + FailedDataRecoveryInSeconds *int32 -// AutonomousDbVersionProperties - AutonomousDbVersion resource model -type AutonomousDbVersionProperties struct { - // READ-ONLY; Supported Autonomous Db versions. - Version *string + // READ-ONLY; The area assigned to In-Memory tables in Autonomous Database. + InMemoryAreaInGbs *int32 - // READ-ONLY; The Autonomous Database workload type - DbWorkload *WorkloadType + // READ-ONLY; Indicates if the Autonomous Database version is a preview version. + IsPreview *bool - // READ-ONLY; True if this version of the Oracle Database software's default is free. - IsDefaultForFree *bool + // READ-ONLY; Indicates whether the Autonomous Database has Cross Region Data Guard enabled. + IsRemoteDataGuardEnabled *bool - // READ-ONLY; True if this version of the Oracle Database software's default is paid. - IsDefaultForPaid *bool + // READ-ONLY; Additional information about the current lifecycle state. + LifecycleDetails *string - // READ-ONLY; True if this version of the Oracle Database software can be used for Always-Free Autonomous Databases. - IsFreeTierEnabled *bool + // READ-ONLY; Views lifecycleState + LifecycleState *AutonomousDatabaseLifecycleState - // READ-ONLY; True if this version of the Oracle Database software has payments enabled. - IsPaidEnabled *bool -} + // READ-ONLY; Indicates the local disaster recovery (DR) type of the Autonomous Database Serverless instance.Autonomous Data + // Guard (ADG) DR type provides business critical DR with a faster recovery time objective (RTO) during failover or switchover.Backup-based + // DR type provides lower cost DR with a slower RTO during failover or switchover. + LocalDisasterRecoveryType *DisasterRecoveryType -// CloudAccountDetails - Cloud Account Details model -type CloudAccountDetails struct { - // READ-ONLY; Cloud Account Home region - CloudAccountHomeRegion *string + // READ-ONLY; Local Autonomous Disaster Recovery standby database details. + LocalStandbyDb *AutonomousDatabaseStandbySummary - // READ-ONLY; Cloud Account name - CloudAccountName *string -} + // READ-ONLY; The amount of memory (in GBs) enabled per ECPU or OCPU. + MemoryPerOracleComputeUnitInGbs *int32 -// CloudExadataInfrastructure resource definition -type CloudExadataInfrastructure struct { - // REQUIRED; The geo-location where the resource lives - Location *string + // READ-ONLY; The date and time when the next long-term backup would be created. + NextLongTermBackupTimeStamp *time.Time - // REQUIRED; CloudExadataInfrastructure zones - Zones []*string + // READ-ONLY; HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + OciURL *string - // The resource-specific properties for this resource. - Properties *CloudExadataInfrastructureProperties + // READ-ONLY; Database ocid + Ocid *string - // Resource tags. - Tags map[string]*string + // READ-ONLY; Status of Operations Insights for this Autonomous Database. + OperationsInsightsStatus *OperationsInsightsStatusType - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string + // READ-ONLY; The list of Azure resource IDs of standby databases located in Autonomous Data Guard remote regions that are + // associated with the source database. Note that for Autonomous Database Serverless instances, standby databases located + // in the same region as the source primary database do not have Azure IDs. + PeerDbIDs []*string - // READ-ONLY; The name of the resource - Name *string + // READ-ONLY; The private endpoint for the resource. + PrivateEndpoint *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData + // READ-ONLY; An array of CPU values that an Autonomous Database can be scaled to. + ProvisionableCpus []*int32 - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *AzureResourceProvisioningState -// CloudExadataInfrastructureListResult - The response of a CloudExadataInfrastructure list operation. -type CloudExadataInfrastructureListResult struct { - // REQUIRED; The CloudExadataInfrastructure items on this page - Value []*CloudExadataInfrastructure + // READ-ONLY; Indicates remote disaster recovery configuration + RemoteDisasterRecoveryConfiguration *DisasterRecoveryConfigurationDetails - // The link to the next page of items - NextLink *string -} + // READ-ONLY; The SQL Web Developer URL for the Oracle Autonomous Database. + SQLWebDeveloperURL *string -// CloudExadataInfrastructureProperties - CloudExadataInfrastructure resource model -type CloudExadataInfrastructureProperties struct { - // REQUIRED; The name for the Exadata infrastructure. - DisplayName *string + // READ-ONLY; The URL of the Service Console for the Autonomous Database. + ServiceConsoleURL *string + + // READ-ONLY; The list of regions that support the creation of an Autonomous Database clone or an Autonomous Data Guard standby + // database. + SupportedRegionsToCloneTo []*string + + // READ-ONLY; The date and time that the database was created. + TimeCreated *time.Time + + // READ-ONLY; The date and time the Autonomous Data Guard role was switched for the Autonomous Database. + TimeDataGuardRoleChanged *string + + // READ-ONLY; The date and time the Always Free database will be automatically deleted because of inactivity. + TimeDeletionOfFreeAutonomousDatabase *string + + // READ-ONLY; The date and time the Disaster Recovery role was switched for the standby Autonomous Database. + TimeDisasterRecoveryRoleChanged *time.Time + + // READ-ONLY; The date and time that Autonomous Data Guard was enabled for an Autonomous Database where the standby was provisioned + // in the same region as the primary database. + TimeLocalDataGuardEnabled *string + + // READ-ONLY; The date and time when maintenance will begin. + TimeMaintenanceBegin *time.Time + + // READ-ONLY; The date and time when maintenance will end. + TimeMaintenanceEnd *time.Time + + // READ-ONLY; The timestamp of the last failover operation. + TimeOfLastFailover *string + + // READ-ONLY; The date and time when last refresh happened. + TimeOfLastRefresh *string + + // READ-ONLY; The refresh point timestamp (UTC). + TimeOfLastRefreshPoint *string + + // READ-ONLY; The timestamp of the last switchover operation for the Autonomous Database. + TimeOfLastSwitchover *string + + // READ-ONLY; The date and time the Always Free database will be stopped because of inactivity. + TimeReclamationOfFreeAutonomousDatabase *string + + // READ-ONLY; The storage space consumed by Autonomous Database in GBs. + UsedDataStorageSizeInGbs *int32 + + // READ-ONLY; The amount of storage that has been used, in terabytes. + UsedDataStorageSizeInTbs *int32 +} + +// GetAutonomousDatabaseBaseProperties implements the AutonomousDatabaseBasePropertiesClassification interface for type AutonomousDatabaseFromBackupTimestampProperties. +func (a *AutonomousDatabaseFromBackupTimestampProperties) GetAutonomousDatabaseBaseProperties() *AutonomousDatabaseBaseProperties { + return &AutonomousDatabaseBaseProperties{ + ActualUsedDataStorageSizeInTbs: a.ActualUsedDataStorageSizeInTbs, + AdminPassword: a.AdminPassword, + AllocatedStorageSizeInTbs: a.AllocatedStorageSizeInTbs, + ApexDetails: a.ApexDetails, + AutonomousDatabaseID: a.AutonomousDatabaseID, + AutonomousMaintenanceScheduleType: a.AutonomousMaintenanceScheduleType, + AvailableUpgradeVersions: a.AvailableUpgradeVersions, + BackupRetentionPeriodInDays: a.BackupRetentionPeriodInDays, + CPUCoreCount: a.CPUCoreCount, + CharacterSet: a.CharacterSet, + ComputeCount: a.ComputeCount, + ComputeModel: a.ComputeModel, + ConnectionStrings: a.ConnectionStrings, + ConnectionUrls: a.ConnectionUrls, + CustomerContacts: a.CustomerContacts, + DataBaseType: a.DataBaseType, + DataSafeStatus: a.DataSafeStatus, + DataStorageSizeInGbs: a.DataStorageSizeInGbs, + DataStorageSizeInTbs: a.DataStorageSizeInTbs, + DatabaseEdition: a.DatabaseEdition, + DbVersion: a.DbVersion, + DbWorkload: a.DbWorkload, + DisplayName: a.DisplayName, + FailedDataRecoveryInSeconds: a.FailedDataRecoveryInSeconds, + InMemoryAreaInGbs: a.InMemoryAreaInGbs, + IsAutoScalingEnabled: a.IsAutoScalingEnabled, + IsAutoScalingForStorageEnabled: a.IsAutoScalingForStorageEnabled, + IsLocalDataGuardEnabled: a.IsLocalDataGuardEnabled, + IsMtlsConnectionRequired: a.IsMtlsConnectionRequired, + IsPreview: a.IsPreview, + IsPreviewVersionWithServiceTermsAccepted: a.IsPreviewVersionWithServiceTermsAccepted, + IsRemoteDataGuardEnabled: a.IsRemoteDataGuardEnabled, + LicenseModel: a.LicenseModel, + LifecycleDetails: a.LifecycleDetails, + LifecycleState: a.LifecycleState, + LocalAdgAutoFailoverMaxDataLossLimit: a.LocalAdgAutoFailoverMaxDataLossLimit, + LocalDisasterRecoveryType: a.LocalDisasterRecoveryType, + LocalStandbyDb: a.LocalStandbyDb, + LongTermBackupSchedule: a.LongTermBackupSchedule, + MemoryPerOracleComputeUnitInGbs: a.MemoryPerOracleComputeUnitInGbs, + NcharacterSet: a.NcharacterSet, + NextLongTermBackupTimeStamp: a.NextLongTermBackupTimeStamp, + OciURL: a.OciURL, + Ocid: a.Ocid, + OpenMode: a.OpenMode, + OperationsInsightsStatus: a.OperationsInsightsStatus, + PeerDbID: a.PeerDbID, + PeerDbIDs: a.PeerDbIDs, + PermissionLevel: a.PermissionLevel, + PrivateEndpoint: a.PrivateEndpoint, + PrivateEndpointIP: a.PrivateEndpointIP, + PrivateEndpointLabel: a.PrivateEndpointLabel, + ProvisionableCpus: a.ProvisionableCpus, + ProvisioningState: a.ProvisioningState, + RemoteDisasterRecoveryConfiguration: a.RemoteDisasterRecoveryConfiguration, + Role: a.Role, + SQLWebDeveloperURL: a.SQLWebDeveloperURL, + ScheduledOperations: a.ScheduledOperations, + ServiceConsoleURL: a.ServiceConsoleURL, + SubnetID: a.SubnetID, + SupportedRegionsToCloneTo: a.SupportedRegionsToCloneTo, + TimeCreated: a.TimeCreated, + TimeDataGuardRoleChanged: a.TimeDataGuardRoleChanged, + TimeDeletionOfFreeAutonomousDatabase: a.TimeDeletionOfFreeAutonomousDatabase, + TimeDisasterRecoveryRoleChanged: a.TimeDisasterRecoveryRoleChanged, + TimeLocalDataGuardEnabled: a.TimeLocalDataGuardEnabled, + TimeMaintenanceBegin: a.TimeMaintenanceBegin, + TimeMaintenanceEnd: a.TimeMaintenanceEnd, + TimeOfLastFailover: a.TimeOfLastFailover, + TimeOfLastRefresh: a.TimeOfLastRefresh, + TimeOfLastRefreshPoint: a.TimeOfLastRefreshPoint, + TimeOfLastSwitchover: a.TimeOfLastSwitchover, + TimeReclamationOfFreeAutonomousDatabase: a.TimeReclamationOfFreeAutonomousDatabase, + UsedDataStorageSizeInGbs: a.UsedDataStorageSizeInGbs, + UsedDataStorageSizeInTbs: a.UsedDataStorageSizeInTbs, + VnetID: a.VnetID, + WhitelistedIPs: a.WhitelistedIPs, + } +} + +// AutonomousDatabaseListResult - The response of a AutonomousDatabase list operation. +type AutonomousDatabaseListResult struct { + // REQUIRED; The AutonomousDatabase items on this page + Value []*AutonomousDatabase + + // The link to the next page of items + NextLink *string +} + +// AutonomousDatabaseNationalCharacterSets resource definition +type AutonomousDatabaseNationalCharacterSet struct { + // The resource-specific properties for this resource. + Properties *AutonomousDatabaseNationalCharacterSetProperties + + // READ-ONLY; AutonomousDatabaseNationalCharacterSets 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 +} + +// AutonomousDatabaseNationalCharacterSetListResult - The response of a AutonomousDatabaseNationalCharacterSet list operation. +type AutonomousDatabaseNationalCharacterSetListResult struct { + // REQUIRED; The AutonomousDatabaseNationalCharacterSet items on this page + Value []*AutonomousDatabaseNationalCharacterSet + + // The link to the next page of items + NextLink *string +} + +// AutonomousDatabaseNationalCharacterSetProperties - AutonomousDatabaseNationalCharacterSet resource model +type AutonomousDatabaseNationalCharacterSetProperties struct { + // REQUIRED; The Oracle Autonomous Database supported national character sets. + CharacterSet *string +} + +// AutonomousDatabaseProperties - Autonomous Database resource model. +type AutonomousDatabaseProperties struct { + // CONSTANT; Database type to be created. + // Field has constant value DataBaseTypeRegular, any specified value is ignored. + DataBaseType *DataBaseType + + // Admin password. + AdminPassword *string + + // Autonomous Database ID + AutonomousDatabaseID *string + + // The maintenance schedule type of the Autonomous Database Serverless. + AutonomousMaintenanceScheduleType *AutonomousMaintenanceScheduleType + + // Retention period, in days, for long-term backups + BackupRetentionPeriodInDays *int32 + + // The number of CPU cores to be made available to the database. + CPUCoreCount *int32 + + // The character set for the autonomous database. + CharacterSet *string + + // The compute amount (CPUs) available to the database. + ComputeCount *float32 + + // The compute model of the Autonomous Database. + ComputeModel *ComputeModel + + // Customer Contacts. + CustomerContacts []*CustomerContact + + // The size, in gigabytes, of the data volume that will be created and attached to the database. + DataStorageSizeInGbs *int32 + + // The quantity of data in the database, in terabytes. + DataStorageSizeInTbs *int32 + + // The Oracle Database Edition that applies to the Autonomous databases. + DatabaseEdition *DatabaseEditionType + + // A valid Oracle Database version for Autonomous Database. + DbVersion *string + + // The Autonomous Database workload type + DbWorkload *WorkloadType + + // The user-friendly name for the Autonomous Database. + DisplayName *string + + // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. + IsAutoScalingEnabled *bool + + // Indicates if auto scaling is enabled for the Autonomous Database storage. + IsAutoScalingForStorageEnabled *bool + + // Indicates whether the Autonomous Database has local or called in-region Data Guard enabled. + IsLocalDataGuardEnabled *bool + + // Specifies if the Autonomous Database requires mTLS connections. + IsMtlsConnectionRequired *bool + + // Specifies if the Autonomous Database preview version is being provisioned. + IsPreviewVersionWithServiceTermsAccepted *bool + + // The Oracle license model that applies to the Oracle Autonomous Database. The default is LICENSE_INCLUDED. + LicenseModel *LicenseModel + + // Parameter that allows users to select an acceptable maximum data loss limit in seconds, up to which Automatic Failover + // will be triggered when necessary for a Local Autonomous Data Guard + LocalAdgAutoFailoverMaxDataLossLimit *int32 + + // Details for the long-term backup schedule. + LongTermBackupSchedule *LongTermBackUpScheduleDetails + + // The character set for the Autonomous Database. + NcharacterSet *string + + // Indicates the Autonomous Database mode. + OpenMode *OpenModeType + + // The Azure resource ID of the Disaster Recovery peer database, which is located in a different region from the current peer + // database. + PeerDbID *string + + // The Autonomous Database permission level. + PermissionLevel *PermissionLevelType + + // The private endpoint Ip address for the resource. + PrivateEndpointIP *string + + // The resource's private endpoint label. + PrivateEndpointLabel *string + + // The Data Guard role of the Autonomous Container Database or Autonomous Database, if Autonomous Data Guard is enabled. + Role *RoleType + + // The list of scheduled operations. + ScheduledOperations *ScheduledOperationsType + + // Client subnet + SubnetID *string + + // VNET for network connectivity + VnetID *string + + // The client IP access control list (ACL). This is an array of CIDR notations and/or IP addresses. Values should be separate + // strings, separated by commas. Example: ['1.1.1.1','1.1.1.0/24','1.1.2.25'] + WhitelistedIPs []*string + + // READ-ONLY; The current amount of storage in use for user and system data, in terabytes (TB). + ActualUsedDataStorageSizeInTbs *float64 + + // READ-ONLY; The amount of storage currently allocated for the database tables and billed for, rounded up. + AllocatedStorageSizeInTbs *float64 + + // READ-ONLY; Information about Oracle APEX Application Development. + ApexDetails *ApexDetailsType + + // READ-ONLY; List of Oracle Database versions available for a database upgrade. If there are no version upgrades available, + // this list is empty. + AvailableUpgradeVersions []*string + + // READ-ONLY; The connection string used to connect to the Autonomous Database. + ConnectionStrings *ConnectionStringType + + // READ-ONLY; The URLs for accessing Oracle Application Express (APEX) and SQL Developer Web with a browser from a Compute + // instance within your VCN or that has a direct connection to your VCN. + ConnectionUrls *ConnectionURLType + + // READ-ONLY; Status of the Data Safe registration for this Autonomous Database. + DataSafeStatus *DataSafeStatusType + + // READ-ONLY; Indicates the number of seconds of data loss for a Data Guard failover. + FailedDataRecoveryInSeconds *int32 + + // READ-ONLY; The area assigned to In-Memory tables in Autonomous Database. + InMemoryAreaInGbs *int32 + + // READ-ONLY; Indicates if the Autonomous Database version is a preview version. + IsPreview *bool + + // READ-ONLY; Indicates whether the Autonomous Database has Cross Region Data Guard enabled. + IsRemoteDataGuardEnabled *bool + + // READ-ONLY; Additional information about the current lifecycle state. + LifecycleDetails *string + + // READ-ONLY; Views lifecycleState + LifecycleState *AutonomousDatabaseLifecycleState + + // READ-ONLY; Indicates the local disaster recovery (DR) type of the Autonomous Database Serverless instance.Autonomous Data + // Guard (ADG) DR type provides business critical DR with a faster recovery time objective (RTO) during failover or switchover.Backup-based + // DR type provides lower cost DR with a slower RTO during failover or switchover. + LocalDisasterRecoveryType *DisasterRecoveryType + + // READ-ONLY; Local Autonomous Disaster Recovery standby database details. + LocalStandbyDb *AutonomousDatabaseStandbySummary + + // READ-ONLY; The amount of memory (in GBs) enabled per ECPU or OCPU. + MemoryPerOracleComputeUnitInGbs *int32 + + // READ-ONLY; The date and time when the next long-term backup would be created. + NextLongTermBackupTimeStamp *time.Time + + // READ-ONLY; HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + OciURL *string + + // READ-ONLY; Database ocid + Ocid *string + + // READ-ONLY; Status of Operations Insights for this Autonomous Database. + OperationsInsightsStatus *OperationsInsightsStatusType + + // READ-ONLY; The list of Azure resource IDs of standby databases located in Autonomous Data Guard remote regions that are + // associated with the source database. Note that for Autonomous Database Serverless instances, standby databases located + // in the same region as the source primary database do not have Azure IDs. + PeerDbIDs []*string + + // READ-ONLY; The private endpoint for the resource. + PrivateEndpoint *string + + // READ-ONLY; An array of CPU values that an Autonomous Database can be scaled to. + ProvisionableCpus []*int32 + + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *AzureResourceProvisioningState + + // READ-ONLY; Indicates remote disaster recovery configuration + RemoteDisasterRecoveryConfiguration *DisasterRecoveryConfigurationDetails + + // READ-ONLY; The SQL Web Developer URL for the Oracle Autonomous Database. + SQLWebDeveloperURL *string + + // READ-ONLY; The URL of the Service Console for the Autonomous Database. + ServiceConsoleURL *string + + // READ-ONLY; The list of regions that support the creation of an Autonomous Database clone or an Autonomous Data Guard standby + // database. + SupportedRegionsToCloneTo []*string + + // READ-ONLY; The date and time that the database was created. + TimeCreated *time.Time + + // READ-ONLY; The date and time the Autonomous Data Guard role was switched for the Autonomous Database. + TimeDataGuardRoleChanged *string + + // READ-ONLY; The date and time the Always Free database will be automatically deleted because of inactivity. + TimeDeletionOfFreeAutonomousDatabase *string + + // READ-ONLY; The date and time the Disaster Recovery role was switched for the standby Autonomous Database. + TimeDisasterRecoveryRoleChanged *time.Time + + // READ-ONLY; The date and time that Autonomous Data Guard was enabled for an Autonomous Database where the standby was provisioned + // in the same region as the primary database. + TimeLocalDataGuardEnabled *string + + // READ-ONLY; The date and time when maintenance will begin. + TimeMaintenanceBegin *time.Time + + // READ-ONLY; The date and time when maintenance will end. + TimeMaintenanceEnd *time.Time + + // READ-ONLY; The timestamp of the last failover operation. + TimeOfLastFailover *string + + // READ-ONLY; The date and time when last refresh happened. + TimeOfLastRefresh *string + + // READ-ONLY; The refresh point timestamp (UTC). + TimeOfLastRefreshPoint *string + + // READ-ONLY; The timestamp of the last switchover operation for the Autonomous Database. + TimeOfLastSwitchover *string + + // READ-ONLY; The date and time the Always Free database will be stopped because of inactivity. + TimeReclamationOfFreeAutonomousDatabase *string + + // READ-ONLY; The storage space consumed by Autonomous Database in GBs. + UsedDataStorageSizeInGbs *int32 + + // READ-ONLY; The amount of storage that has been used, in terabytes. + UsedDataStorageSizeInTbs *int32 +} + +// GetAutonomousDatabaseBaseProperties implements the AutonomousDatabaseBasePropertiesClassification interface for type AutonomousDatabaseProperties. +func (a *AutonomousDatabaseProperties) GetAutonomousDatabaseBaseProperties() *AutonomousDatabaseBaseProperties { + return &AutonomousDatabaseBaseProperties{ + ActualUsedDataStorageSizeInTbs: a.ActualUsedDataStorageSizeInTbs, + AdminPassword: a.AdminPassword, + AllocatedStorageSizeInTbs: a.AllocatedStorageSizeInTbs, + ApexDetails: a.ApexDetails, + AutonomousDatabaseID: a.AutonomousDatabaseID, + AutonomousMaintenanceScheduleType: a.AutonomousMaintenanceScheduleType, + AvailableUpgradeVersions: a.AvailableUpgradeVersions, + BackupRetentionPeriodInDays: a.BackupRetentionPeriodInDays, + CPUCoreCount: a.CPUCoreCount, + CharacterSet: a.CharacterSet, + ComputeCount: a.ComputeCount, + ComputeModel: a.ComputeModel, + ConnectionStrings: a.ConnectionStrings, + ConnectionUrls: a.ConnectionUrls, + CustomerContacts: a.CustomerContacts, + DataBaseType: a.DataBaseType, + DataSafeStatus: a.DataSafeStatus, + DataStorageSizeInGbs: a.DataStorageSizeInGbs, + DataStorageSizeInTbs: a.DataStorageSizeInTbs, + DatabaseEdition: a.DatabaseEdition, + DbVersion: a.DbVersion, + DbWorkload: a.DbWorkload, + DisplayName: a.DisplayName, + FailedDataRecoveryInSeconds: a.FailedDataRecoveryInSeconds, + InMemoryAreaInGbs: a.InMemoryAreaInGbs, + IsAutoScalingEnabled: a.IsAutoScalingEnabled, + IsAutoScalingForStorageEnabled: a.IsAutoScalingForStorageEnabled, + IsLocalDataGuardEnabled: a.IsLocalDataGuardEnabled, + IsMtlsConnectionRequired: a.IsMtlsConnectionRequired, + IsPreview: a.IsPreview, + IsPreviewVersionWithServiceTermsAccepted: a.IsPreviewVersionWithServiceTermsAccepted, + IsRemoteDataGuardEnabled: a.IsRemoteDataGuardEnabled, + LicenseModel: a.LicenseModel, + LifecycleDetails: a.LifecycleDetails, + LifecycleState: a.LifecycleState, + LocalAdgAutoFailoverMaxDataLossLimit: a.LocalAdgAutoFailoverMaxDataLossLimit, + LocalDisasterRecoveryType: a.LocalDisasterRecoveryType, + LocalStandbyDb: a.LocalStandbyDb, + LongTermBackupSchedule: a.LongTermBackupSchedule, + MemoryPerOracleComputeUnitInGbs: a.MemoryPerOracleComputeUnitInGbs, + NcharacterSet: a.NcharacterSet, + NextLongTermBackupTimeStamp: a.NextLongTermBackupTimeStamp, + OciURL: a.OciURL, + Ocid: a.Ocid, + OpenMode: a.OpenMode, + OperationsInsightsStatus: a.OperationsInsightsStatus, + PeerDbID: a.PeerDbID, + PeerDbIDs: a.PeerDbIDs, + PermissionLevel: a.PermissionLevel, + PrivateEndpoint: a.PrivateEndpoint, + PrivateEndpointIP: a.PrivateEndpointIP, + PrivateEndpointLabel: a.PrivateEndpointLabel, + ProvisionableCpus: a.ProvisionableCpus, + ProvisioningState: a.ProvisioningState, + RemoteDisasterRecoveryConfiguration: a.RemoteDisasterRecoveryConfiguration, + Role: a.Role, + SQLWebDeveloperURL: a.SQLWebDeveloperURL, + ScheduledOperations: a.ScheduledOperations, + ServiceConsoleURL: a.ServiceConsoleURL, + SubnetID: a.SubnetID, + SupportedRegionsToCloneTo: a.SupportedRegionsToCloneTo, + TimeCreated: a.TimeCreated, + TimeDataGuardRoleChanged: a.TimeDataGuardRoleChanged, + TimeDeletionOfFreeAutonomousDatabase: a.TimeDeletionOfFreeAutonomousDatabase, + TimeDisasterRecoveryRoleChanged: a.TimeDisasterRecoveryRoleChanged, + TimeLocalDataGuardEnabled: a.TimeLocalDataGuardEnabled, + TimeMaintenanceBegin: a.TimeMaintenanceBegin, + TimeMaintenanceEnd: a.TimeMaintenanceEnd, + TimeOfLastFailover: a.TimeOfLastFailover, + TimeOfLastRefresh: a.TimeOfLastRefresh, + TimeOfLastRefreshPoint: a.TimeOfLastRefreshPoint, + TimeOfLastSwitchover: a.TimeOfLastSwitchover, + TimeReclamationOfFreeAutonomousDatabase: a.TimeReclamationOfFreeAutonomousDatabase, + UsedDataStorageSizeInGbs: a.UsedDataStorageSizeInGbs, + UsedDataStorageSizeInTbs: a.UsedDataStorageSizeInTbs, + VnetID: a.VnetID, + WhitelistedIPs: a.WhitelistedIPs, + } +} + +// AutonomousDatabaseStandbySummary - Autonomous Disaster Recovery standby database details. +type AutonomousDatabaseStandbySummary struct { + // The amount of time, in seconds, that the data of the standby database lags the data of the primary database. Can be used + // to determine the potential data loss in the event of a failover. + LagTimeInSeconds *int32 + + // Additional information about the current lifecycle state. + LifecycleDetails *string + + // The current state of the Autonomous Database. + LifecycleState *AutonomousDatabaseLifecycleState + + // The date and time the Autonomous Data Guard role was switched for the standby Autonomous Database. + TimeDataGuardRoleChanged *string + + // The date and time the Disaster Recovery role was switched for the standby Autonomous Database. + TimeDisasterRecoveryRoleChanged *string +} + +// AutonomousDatabaseUpdate - The type used for update operations of the AutonomousDatabase. +type AutonomousDatabaseUpdate struct { + // The resource-specific properties for this resource. + Properties *AutonomousDatabaseUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// AutonomousDatabaseUpdateProperties - The updatable properties of the AutonomousDatabase. +type AutonomousDatabaseUpdateProperties struct { + // Admin password. + AdminPassword *string + + // The maintenance schedule type of the Autonomous Database Serverless. + AutonomousMaintenanceScheduleType *AutonomousMaintenanceScheduleType + + // Retention period, in days, for long-term backups + BackupRetentionPeriodInDays *int32 + + // The number of CPU cores to be made available to the database. + CPUCoreCount *int32 + + // The compute amount (CPUs) available to the database. + ComputeCount *float32 + + // Customer Contacts. + CustomerContacts []*CustomerContact + + // The size, in gigabytes, of the data volume that will be created and attached to the database. + DataStorageSizeInGbs *int32 + + // The quantity of data in the database, in terabytes. + DataStorageSizeInTbs *int32 + + // The Oracle Database Edition that applies to the Autonomous databases. + DatabaseEdition *DatabaseEditionType + + // The user-friendly name for the Autonomous Database. + DisplayName *string + + // Indicates if auto scaling is enabled for the Autonomous Database CPU core count. + IsAutoScalingEnabled *bool + + // Indicates if auto scaling is enabled for the Autonomous Database storage. + IsAutoScalingForStorageEnabled *bool + + // Indicates whether the Autonomous Database has local or called in-region Data Guard enabled. + IsLocalDataGuardEnabled *bool + + // Specifies if the Autonomous Database requires mTLS connections. + IsMtlsConnectionRequired *bool + + // The Oracle license model that applies to the Oracle Autonomous Database. The default is LICENSE_INCLUDED. + LicenseModel *LicenseModel + + // Parameter that allows users to select an acceptable maximum data loss limit in seconds, up to which Automatic Failover + // will be triggered when necessary for a Local Autonomous Data Guard + LocalAdgAutoFailoverMaxDataLossLimit *int32 + + // Details for the long-term backup schedule. + LongTermBackupSchedule *LongTermBackUpScheduleDetails + + // Indicates the Autonomous Database mode. + OpenMode *OpenModeType + + // The Azure resource ID of the Disaster Recovery peer database, which is located in a different region from the current peer + // database. + PeerDbID *string + + // The Autonomous Database permission level. + PermissionLevel *PermissionLevelType + + // The Data Guard role of the Autonomous Container Database or Autonomous Database, if Autonomous Data Guard is enabled. + Role *RoleType + + // The list of scheduled operations. + ScheduledOperations *ScheduledOperationsType + + // The client IP access control list (ACL). This is an array of CIDR notations and/or IP addresses. Values should be separate + // strings, separated by commas. Example: ['1.1.1.1','1.1.1.0/24','1.1.2.25'] + WhitelistedIPs []*string +} + +// AutonomousDatabaseWalletFile - Autonomous Database Wallet File resource model. +type AutonomousDatabaseWalletFile struct { + // REQUIRED; The base64 encoded wallet files + WalletFiles *string +} + +// AutonomousDbVersion resource definition +type AutonomousDbVersion struct { + // The resource-specific properties for this resource. + Properties *AutonomousDbVersionProperties + + // READ-ONLY; AutonomousDbVersion 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 +} + +// AutonomousDbVersionListResult - The response of a AutonomousDbVersion list operation. +type AutonomousDbVersionListResult struct { + // REQUIRED; The AutonomousDbVersion items on this page + Value []*AutonomousDbVersion + + // The link to the next page of items + NextLink *string +} + +// AutonomousDbVersionProperties - AutonomousDbVersion resource model +type AutonomousDbVersionProperties struct { + // REQUIRED; Supported Autonomous Db versions. + Version *string + + // The Autonomous Database workload type + DbWorkload *WorkloadType + + // True if this version of the Oracle Database software's default is free. + IsDefaultForFree *bool + + // True if this version of the Oracle Database software's default is paid. + IsDefaultForPaid *bool + + // True if this version of the Oracle Database software can be used for Always-Free Autonomous Databases. + IsFreeTierEnabled *bool + + // True if this version of the Oracle Database software has payments enabled. + IsPaidEnabled *bool +} + +// AzureSubscriptions - Azure Subscriptions model +type AzureSubscriptions struct { + // REQUIRED; Azure Subscription Ids to be updated + AzureSubscriptionIDs []*string +} + +// CloudExadataInfrastructure resource definition +type CloudExadataInfrastructure struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // REQUIRED; CloudExadataInfrastructure zones + Zones []*string + + // The resource-specific properties for this resource. + Properties *CloudExadataInfrastructureProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; CloudExadataInfrastructure 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 +} + +// CloudExadataInfrastructureListResult - The response of a CloudExadataInfrastructure list operation. +type CloudExadataInfrastructureListResult struct { + // REQUIRED; The CloudExadataInfrastructure items on this page + Value []*CloudExadataInfrastructure + + // The link to the next page of items + NextLink *string +} + +// CloudExadataInfrastructureProperties - CloudExadataInfrastructure resource model +type CloudExadataInfrastructureProperties struct { + // REQUIRED; The name for the Exadata infrastructure. + DisplayName *string + + // REQUIRED; The model name of the cloud Exadata infrastructure resource. + Shape *string + + // The number of compute servers for the cloud Exadata infrastructure. + ComputeCount *int32 + + // The list of customer email addresses that receive information from Oracle about the specified OCI Database service resource. + // Oracle uses these email addresses to send notifications about planned and unplanned software maintenance updates, information + // about system hardware, and other information needed by administrators. Up to 10 email addresses can be added to the customer + // contacts for a cloud Exadata infrastructure instance. + CustomerContacts []*CustomerContact + + // The database server model type of the cloud Exadata infrastructure resource. + DatabaseServerType *string + + // maintenanceWindow property + MaintenanceWindow *MaintenanceWindow + + // The number of storage servers for the cloud Exadata infrastructure. + StorageCount *int32 + + // The storage server model type of the cloud Exadata infrastructure resource. + StorageServerType *string + + // READ-ONLY; The requested number of additional storage servers activated for the Exadata infrastructure. + ActivatedStorageCount *int32 + + // READ-ONLY; The requested number of additional storage servers for the Exadata infrastructure. + AdditionalStorageCount *int32 + + // READ-ONLY; The available storage can be allocated to the cloud Exadata infrastructure resource, in gigabytes (GB). + AvailableStorageSizeInGbs *int32 + + // READ-ONLY; The total number of CPU cores allocated. + CPUCount *int32 + + // READ-ONLY; The compute model of the Exadata Infrastructure + ComputeModel *ComputeModel + + // READ-ONLY; The quantity of data in the database, in terabytes. + DataStorageSizeInTbs *float64 + + // READ-ONLY; The local node storage to be allocated in GBs. + DbNodeStorageSizeInGbs *int32 + + // READ-ONLY; The software version of the database servers (dom0) in the Exadata infrastructure. + DbServerVersion *string + + // READ-ONLY; Defined file system configurations + DefinedFileSystemConfiguration []*DefinedFileSystemConfiguration + + // READ-ONLY; The estimated total time required in minutes for all patching operations (database server, storage server, and + // network switch patching). + EstimatedPatchingTime *EstimatedPatchingTime + + // READ-ONLY; The OCID of the last maintenance run. + LastMaintenanceRunID *string + + // READ-ONLY; Additional information about the current lifecycle state. + LifecycleDetails *string + + // READ-ONLY; CloudExadataInfrastructure lifecycle state + LifecycleState *CloudExadataInfrastructureLifecycleState + + // READ-ONLY; The total number of CPU cores available. + MaxCPUCount *int32 + + // READ-ONLY; The total available DATA disk group size. + MaxDataStorageInTbs *float64 + + // READ-ONLY; The total local node storage available in GBs. + MaxDbNodeStorageSizeInGbs *int32 + + // READ-ONLY; The total memory available in GBs. + MaxMemoryInGbs *int32 + + // READ-ONLY; The memory allocated in GBs. + MemorySizeInGbs *int32 + + // READ-ONLY; Monthly Db Server version + MonthlyDbServerVersion *string + + // READ-ONLY; Monthly Storage Server version + MonthlyStorageServerVersion *string + + // READ-ONLY; The OCID of the next maintenance run. + NextMaintenanceRunID *string + + // READ-ONLY; HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + OciURL *string + + // READ-ONLY; Exadata infra ocid + Ocid *string + + // READ-ONLY; CloudExadataInfrastructure provisioning state + ProvisioningState *AzureResourceProvisioningState + + // READ-ONLY; The software version of the storage servers (cells) in the Exadata infrastructure. + StorageServerVersion *string + + // READ-ONLY; The date and time the cloud Exadata infrastructure resource was created. + TimeCreated *string + + // READ-ONLY; The total storage allocated to the cloud Exadata infrastructure resource, in gigabytes (GB). + TotalStorageSizeInGbs *int32 +} + +// CloudExadataInfrastructureUpdate - The type used for update operations of the CloudExadataInfrastructure. +type CloudExadataInfrastructureUpdate struct { + // The resource-specific properties for this resource. + Properties *CloudExadataInfrastructureUpdateProperties + + // Resource tags. + Tags map[string]*string + + // CloudExadataInfrastructure zones + Zones []*string +} + +// CloudExadataInfrastructureUpdateProperties - The updatable properties of the CloudExadataInfrastructure. +type CloudExadataInfrastructureUpdateProperties struct { + // The number of compute servers for the cloud Exadata infrastructure. + ComputeCount *int32 + + // The list of customer email addresses that receive information from Oracle about the specified OCI Database service resource. + // Oracle uses these email addresses to send notifications about planned and unplanned software maintenance updates, information + // about system hardware, and other information needed by administrators. Up to 10 email addresses can be added to the customer + // contacts for a cloud Exadata infrastructure instance. + CustomerContacts []*CustomerContact + + // The name for the Exadata infrastructure. + DisplayName *string + + // maintenanceWindow property + MaintenanceWindow *MaintenanceWindow + + // The number of storage servers for the cloud Exadata infrastructure. + StorageCount *int32 +} + +// CloudVMCluster - CloudVmCluster resource definition +type CloudVMCluster struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // The resource-specific properties for this resource. + Properties *CloudVMClusterProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; CloudVmCluster 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 +} + +// CloudVMClusterListResult - The response of a CloudVmCluster list operation. +type CloudVMClusterListResult struct { + // REQUIRED; The CloudVmCluster items on this page + Value []*CloudVMCluster + + // The link to the next page of items + NextLink *string +} + +// CloudVMClusterProperties - CloudVmCluster resource model +type CloudVMClusterProperties struct { + // REQUIRED; The number of CPU cores enabled on the cloud VM cluster. + CPUCoreCount *int32 + + // REQUIRED; Cloud Exadata Infrastructure ID + CloudExadataInfrastructureID *string + + // REQUIRED; Display Name + DisplayName *string + + // REQUIRED; Oracle Grid Infrastructure (GI) software version + GiVersion *string + + // REQUIRED; The hostname for the cloud VM cluster. + Hostname *string + + // REQUIRED; The public key portion of one or more key pairs used for SSH access to the cloud VM cluster. + SSHPublicKeys []*string + + // REQUIRED; Client subnet + SubnetID *string + + // REQUIRED; VNET for network connectivity + VnetID *string + + // Client OCI backup subnet CIDR, default is 192.168.252.0/22 + BackupSubnetCidr *string + + // The cluster name for cloud VM cluster. The cluster name must begin with an alphabetic character, and may contain hyphens + // (-). Underscores (_) are not permitted. The cluster name can be no longer than 11 characters and is not case sensitive. + ClusterName *string + + // The list of compute servers to be added to the cloud VM cluster. + ComputeNodes []*string + + // Indicates user preferences for the various diagnostic collection options for the VM cluster/Cloud VM cluster/VMBM DBCS. + DataCollectionOptions *DataCollectionOptions + + // The percentage assigned to DATA storage (user data and database files). The remaining percentage is assigned to RECO storage + // (database redo logs, archive logs, and recovery manager backups). Accepted values are 35, 40, 60 and 80. The default is + // 80 percent assigned to DATA storage. See [Storage Configuration](/Content/Database/Concepts/exaoverview.htm#Exadata) in + // the Exadata documentation for details on the impact of the configuration settings on storage. + DataStoragePercentage *int32 + + // The data disk group size to be allocated in TBs. + DataStorageSizeInTbs *float64 + + // The local node storage to be allocated in GBs. + DbNodeStorageSizeInGbs *int32 + + // The list of DB servers. + DbServers []*string + + // The domain name for the cloud VM cluster. + Domain *string + + // Array of mount path and size. + FileSystemConfigurationDetails []*FileSystemConfigurationDetails + + // If true, database backup on local Exadata storage is configured for the cloud VM cluster. If false, database backup on + // local Exadata storage is not available in the cloud VM cluster. + IsLocalBackupEnabled *bool + + // If true, sparse disk group is configured for the cloud VM cluster. If false, sparse disk group is not created. + IsSparseDiskgroupEnabled *bool + + // The Oracle license model that applies to the cloud VM cluster. The default is LICENSE_INCLUDED. + LicenseModel *LicenseModel + + // The memory to be allocated in GBs. + MemorySizeInGbs *int32 + + // CIDR blocks for additional NSG ingress rules. The VNET CIDRs used to provision the VM Cluster will be added by default. + NsgCidrs []*NsgCidr + + // The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal place is allowed for the fractional part. + OcpuCount *float32 + + // The TCP Single Client Access Name (SCAN) port. The default port is 1521. + ScanListenerPortTCP *int32 + + // The TCPS Single Client Access Name (SCAN) port. The default port is 2484. + ScanListenerPortTCPSSL *int32 + + // The data disk group size to be allocated in GBs per VM. + StorageSizeInGbs *int32 + + // Operating system version of the image. + SystemVersion *string + + // The time zone of the cloud VM cluster. For details, see [Exadata Infrastructure Time Zones](/Content/Database/References/timezones.htm). + TimeZone *string + + // The OCID of the zone the cloud VM cluster is associated with. + ZoneID *string + + // READ-ONLY; Cluster compartmentId + CompartmentID *string + + // READ-ONLY; The compute model of the VM Cluster. + ComputeModel *ComputeModel + + // READ-ONLY; The type of redundancy configured for the cloud Vm cluster. NORMAL is 2-way redundancy. HIGH is 3-way redundancy. + DiskRedundancy *DiskRedundancy + + // READ-ONLY; iormConfigCache details for cloud VM cluster. + IormConfigCache *ExadataIormConfig + + // READ-ONLY; The OCID of the last maintenance update history entry. + LastUpdateHistoryEntryID *string + + // READ-ONLY; Additional information about the current lifecycle state. + LifecycleDetails *string + + // READ-ONLY; CloudVmCluster lifecycle state + LifecycleState *CloudVMClusterLifecycleState + + // READ-ONLY; The port number configured for the listener on the cloud VM cluster. + ListenerPort *int64 + + // READ-ONLY; The number of nodes in the cloud VM cluster. + NodeCount *int32 + + // READ-ONLY; HTTPS link to OCI Network Security Group exposed to Azure Customer via the Azure Interface. + NsgURL *string + + // READ-ONLY; HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + OciURL *string + + // READ-ONLY; Cloud VM Cluster ocid + Ocid *string + + // READ-ONLY; CloudVmCluster provisioning state + ProvisioningState *AzureResourceProvisioningState + + // READ-ONLY; The FQDN of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster. + ScanDNSName *string + + // READ-ONLY; The OCID of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster. + ScanDNSRecordID *string + + // READ-ONLY; The Single Client Access Name (SCAN) IP addresses associated with the cloud VM cluster. SCAN IP addresses are + // typically used for load balancing and are not assigned to any interface. Oracle Clusterware directs the requests to the + // appropriate nodes in the cluster. **Note:** For a single-node DB system, this list is empty. + ScanIPIDs []*string + + // READ-ONLY; The model name of the Exadata hardware running the cloud VM cluster. + Shape *string + + // READ-ONLY; Cluster subnet ocid + SubnetOcid *string + + // READ-ONLY; The date and time that the cloud VM cluster was created. + TimeCreated *time.Time + + // READ-ONLY; The virtual IP (VIP) addresses associated with the cloud VM cluster. The Cluster Ready Services (CRS) creates + // and maintains one VIP address for each node in the Exadata Cloud Service instance to enable failover. If one node fails, + // the VIP is reassigned to another active node in the cluster. **Note:** For a single-node DB system, this list is empty. + VipIDs []*string +} + +// CloudVMClusterUpdate - The type used for update operations of the CloudVmCluster. +type CloudVMClusterUpdate struct { + // The resource-specific properties for this resource. + Properties *CloudVMClusterUpdateProperties + + // Resource tags. + Tags map[string]*string +} + +// CloudVMClusterUpdateProperties - The updatable properties of the CloudVmCluster. +type CloudVMClusterUpdateProperties struct { + // The number of CPU cores enabled on the cloud VM cluster. + CPUCoreCount *int32 + + // The list of compute servers to be added to the cloud VM cluster. + ComputeNodes []*string + + // Indicates user preferences for the various diagnostic collection options for the VM cluster/Cloud VM cluster/VMBM DBCS. + DataCollectionOptions *DataCollectionOptions + + // The data disk group size to be allocated in TBs. + DataStorageSizeInTbs *float64 + + // The local node storage to be allocated in GBs. + DbNodeStorageSizeInGbs *int32 + + // Display Name + DisplayName *string + + // Array of mount path and size. + FileSystemConfigurationDetails []*FileSystemConfigurationDetails + + // The Oracle license model that applies to the cloud VM cluster. The default is LICENSE_INCLUDED. + LicenseModel *LicenseModel + + // The memory to be allocated in GBs. + MemorySizeInGbs *int32 + + // The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal place is allowed for the fractional part. + OcpuCount *float32 + + // The public key portion of one or more key pairs used for SSH access to the cloud VM cluster. + SSHPublicKeys []*string + + // The data disk group size to be allocated in GBs per VM. + StorageSizeInGbs *int32 +} + +// ConnectionStringType - Connection strings to connect to an Oracle Autonomous Database. +type ConnectionStringType struct { + // Returns all connection strings that can be used to connect to the Autonomous Database. + AllConnectionStrings *AllConnectionStringType + + // The database service provides the least level of resources to each SQL statement, but supports the most number of concurrent + // SQL statements. + Dedicated *string + + // The High database service provides the highest level of resources to each SQL statement resulting in the highest performance, + // but supports the fewest number of concurrent SQL statements. + High *string + + // The Low database service provides the least level of resources to each SQL statement, but supports the most number of concurrent + // SQL statements. + Low *string + + // The Medium database service provides a lower level of resources to each SQL statement potentially resulting a lower level + // of performance, but supports more concurrent SQL statements. + Medium *string + + // A list of connection string profiles to allow clients to group, filter and select connection string values based on structured + // metadata. + Profiles []*ProfileType +} + +// ConnectionURLType - The URLs for accessing Oracle Application Express (APEX) and SQL Developer Web with a browser from +// a Compute instance within your VCN or that has a direct connection to your VCN. +type ConnectionURLType struct { + // Oracle Application Express (APEX) URL. + ApexURL *string - // REQUIRED; The model name of the cloud Exadata infrastructure resource. - Shape *string + // The URL of the Database Transforms for the Autonomous Database. + DatabaseTransformsURL *string - // The number of compute servers for the cloud Exadata infrastructure. - ComputeCount *int32 + // The URL of the Graph Studio for the Autonomous Database. + GraphStudioURL *string - // The list of customer email addresses that receive information from Oracle about the specified OCI Database service resource. - // Oracle uses these email addresses to send notifications about planned and - // unplanned software maintenance updates, information about system hardware, and other information needed by administrators. - // Up to 10 email addresses can be added to the customer contacts for a cloud - // Exadata infrastructure instance. - CustomerContacts []*CustomerContact + // The URL of the Oracle Machine Learning (OML) Notebook for the Autonomous Database. + MachineLearningNotebookURL *string - // maintenanceWindow property - MaintenanceWindow *MaintenanceWindow + // The URL of the MongoDB API for the Autonomous Database. + MongoDbURL *string - // The number of storage servers for the cloud Exadata infrastructure. - StorageCount *int32 + // The Oracle REST Data Services (ORDS) URL of the Web Access for the Autonomous Database. + OrdsURL *string - // READ-ONLY; The requested number of additional storage servers activated for the Exadata infrastructure. - ActivatedStorageCount *int32 + // Oracle SQL Developer Web URL. + SQLDevWebURL *string +} - // READ-ONLY; The requested number of additional storage servers for the Exadata infrastructure. - AdditionalStorageCount *int32 +// CustomerContact resource properties +type CustomerContact struct { + // REQUIRED; The email address used by Oracle to send notifications regarding databases and infrastructure. + Email *string +} - // READ-ONLY; The available storage can be allocated to the cloud Exadata infrastructure resource, in gigabytes (GB). - AvailableStorageSizeInGbs *int32 +// DNSPrivateView - DnsPrivateView resource definition +type DNSPrivateView struct { + // The resource-specific properties for this resource. + Properties *DNSPrivateViewProperties - // READ-ONLY; The total number of CPU cores allocated. - CPUCount *int32 + // READ-ONLY; DnsPrivateView OCID + Name *string - // READ-ONLY; The quantity of data in the database, in terabytes. - DataStorageSizeInTbs *float64 + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; The local node storage to be allocated in GBs. - DbNodeStorageSizeInGbs *int32 + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; The software version of the database servers (dom0) in the Exadata infrastructure. - DbServerVersion *string + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} - // READ-ONLY; The estimated total time required in minutes for all patching operations (database server, storage server, and - // network switch patching). - EstimatedPatchingTime *EstimatedPatchingTime +// DNSPrivateViewListResult - The response of a DnsPrivateView list operation. +type DNSPrivateViewListResult struct { + // REQUIRED; The DnsPrivateView items on this page + Value []*DNSPrivateView - // READ-ONLY; The OCID of the last maintenance run. - LastMaintenanceRunID *string + // The link to the next page of items + NextLink *string +} - // READ-ONLY; Additional information about the current lifecycle state. - LifecycleDetails *string +// DNSPrivateViewProperties - Views resource model +type DNSPrivateViewProperties struct { + // REQUIRED; The display name of the view resource + DisplayName *string - // READ-ONLY; CloudExadataInfrastructure lifecycle state - LifecycleState *CloudExadataInfrastructureLifecycleState + // REQUIRED; A Boolean flag indicating whether or not parts of the resource are unable to be explicitly managed. + IsProtected *bool - // READ-ONLY; The total number of CPU cores available. - MaxCPUCount *int32 + // REQUIRED; Views lifecycleState + LifecycleState *DNSPrivateViewsLifecycleState - // READ-ONLY; The total available DATA disk group size. - MaxDataStorageInTbs *float64 + // REQUIRED; The OCID of the view + Ocid *string - // READ-ONLY; The total local node storage available in GBs. - MaxDbNodeStorageSizeInGbs *int32 + // REQUIRED; The canonical absolute URL of the resource. + Self *string - // READ-ONLY; The total memory available in GBs. - MaxMemoryInGbs *int32 + // REQUIRED; views timeCreated + TimeCreated *time.Time - // READ-ONLY; The memory allocated in GBs. - MemorySizeInGbs *int32 + // REQUIRED; views timeCreated + TimeUpdated *time.Time - // READ-ONLY; Monthly Db Server version - MonthlyDbServerVersion *string + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *ResourceProvisioningState +} - // READ-ONLY; Monthly Storage Server version - MonthlyStorageServerVersion *string +// DNSPrivateZone - DnsPrivateZone resource definition +type DNSPrivateZone struct { + // The resource-specific properties for this resource. + Properties *DNSPrivateZoneProperties - // READ-ONLY; The OCID of the next maintenance run. - NextMaintenanceRunID *string + // READ-ONLY; DnsPrivateZone name + Name *string - // READ-ONLY; HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. - OciURL *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; Exadata infra ocid + // 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 +} + +// DNSPrivateZoneListResult - The response of a DnsPrivateZone list operation. +type DNSPrivateZoneListResult struct { + // REQUIRED; The DnsPrivateZone items on this page + Value []*DNSPrivateZone + + // The link to the next page of items + NextLink *string +} + +// DNSPrivateZoneProperties - Zones resource model +type DNSPrivateZoneProperties struct { + // REQUIRED; A Boolean flag indicating whether or not parts of the resource are unable to be explicitly managed. + IsProtected *bool + + // REQUIRED; Zones lifecycleState + LifecycleState *DNSPrivateZonesLifecycleState + + // REQUIRED; The OCID of the Zone Ocid *string - // READ-ONLY; CloudExadataInfrastructure provisioning state + // REQUIRED; The canonical absolute URL of the resource. + Self *string + + // REQUIRED; The current serial of the zone. As seen in the zone's SOA record. + Serial *int32 + + // REQUIRED; Zones timeCreated + TimeCreated *time.Time + + // REQUIRED; Version is the never-repeating, totally-orderable, version of the zone, from which the serial field of the zone's + // SOA record is derived. + Version *string + + // REQUIRED; The type of the zone. Must be either PRIMARY or SECONDARY. SECONDARY is only supported for GLOBAL zones. + ZoneType *ZoneType + + // The OCID of the private view containing the zone. This value will be null for zones in the global DNS, which are publicly + // resolvable and not part of a private view. + ViewID *string + + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *ResourceProvisioningState +} + +// DataCollectionOptions resource properties +type DataCollectionOptions struct { + // Indicates whether diagnostic collection is enabled for the VM cluster/Cloud VM cluster/VMBM DBCS. + IsDiagnosticsEventsEnabled *bool + + // Indicates whether health monitoring is enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. + IsHealthMonitoringEnabled *bool + + // Indicates whether incident logs and trace collection are enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. + IsIncidentLogsEnabled *bool +} + +// DayOfWeek resource properties +type DayOfWeek struct { + // REQUIRED; Name of the day of the week. + Name *DayOfWeekName +} + +// DbActionResponse - ExascaleDbNode action response +type DbActionResponse struct { + // ExascaleDbNode provisioning state ProvisioningState *AzureResourceProvisioningState +} - // READ-ONLY; The software version of the storage servers (cells) in the Exadata infrastructure. - StorageServerVersion *string +// DbIormConfig for cloud vm cluster +type DbIormConfig struct { + // The database name. For the default DbPlan, the dbName is default. + DbName *string - // READ-ONLY; The date and time the cloud Exadata infrastructure resource was created. - TimeCreated *string + // The flash cache limit for this database. This value is internally configured based on the share value assigned to the database. + FlashCacheLimit *string - // READ-ONLY; The total storage allocated to the cloud Exadata infrastructure resource, in gigabytes (GB). - TotalStorageSizeInGbs *int32 + // The relative priority of this database. + Share *int32 } -// CloudExadataInfrastructureUpdate - The type used for update operations of the CloudExadataInfrastructure. -type CloudExadataInfrastructureUpdate struct { - // The updatable properties of the CloudExadataInfrastructure. - Properties *CloudExadataInfrastructureUpdateProperties +// DbNode - The DbNode resource belonging to vmCluster +type DbNode struct { + // The resource-specific properties for this resource. + Properties *DbNodeProperties - // Resource tags. - Tags map[string]*string + // READ-ONLY; DbNode OCID. + Name *string - // CloudExadataInfrastructure zones - Zones []*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 +} + +// DbNodeAction - DbNode action object +type DbNodeAction struct { + // REQUIRED; Db action + Action *DbNodeActionEnum +} + +// DbNodeDetails - Details of the ExaCS Db node. Applies to Exadata Database Service on Exascale Infrastructure only. +type DbNodeDetails struct { + // REQUIRED; Exascale DbNode Azure Resource ID + DbNodeID *string +} + +// DbNodeListResult - The response of a DbNode list operation. +type DbNodeListResult struct { + // REQUIRED; The DbNode items on this page + Value []*DbNode + + // The link to the next page of items + NextLink *string } -// CloudExadataInfrastructureUpdateProperties - The updatable properties of the CloudExadataInfrastructure. -type CloudExadataInfrastructureUpdateProperties struct { - // The number of compute servers for the cloud Exadata infrastructure. - ComputeCount *int32 +// DbNodeProperties - The properties of DbNodeResource +type DbNodeProperties struct { + // REQUIRED; The OCID of the DB system. + DbSystemID *string + + // REQUIRED; The current state of the database node. + LifecycleState *DbNodeProvisioningState + + // REQUIRED; DbNode OCID + Ocid *string + + // REQUIRED; The date and time that the database node was created. + TimeCreated *time.Time + + // REQUIRED; The OCID of the VNIC. + VnicID *string + + // Additional information about the planned maintenance. + AdditionalDetails *string + + // The OCID of the backup IP address associated with the database node. + BackupIPID *string + + // The OCID of the second backup VNIC. + BackupVnic2ID *string + + // The OCID of the backup VNIC. + BackupVnicID *string + + // The number of CPU cores enabled on the Db node. + CPUCoreCount *int32 + + // The allocated local node storage in GBs on the Db node. + DbNodeStorageSizeInGbs *int32 + + // The OCID of the Exacc Db server associated with the database node. + DbServerID *string + + // The name of the Fault Domain the instance is contained in. + FaultDomain *string + + // The OCID of the host IP address associated with the database node. + HostIPID *string + + // The host name for the database node. + Hostname *string + + // Lifecycle details of Db Node. + LifecycleDetails *string + + // The type of database node maintenance. + MaintenanceType *DbNodeMaintenanceType + + // The allocated memory in GBs on the Db node. + MemorySizeInGbs *int32 + + // The size (in GB) of the block storage volume allocation for the DB system. This attribute applies only for virtual machine + // DB systems. + SoftwareStorageSizeInGb *int32 - // The list of customer email addresses that receive information from Oracle about the specified OCI Database service resource. - // Oracle uses these email addresses to send notifications about planned and - // unplanned software maintenance updates, information about system hardware, and other information needed by administrators. - // Up to 10 email addresses can be added to the customer contacts for a cloud - // Exadata infrastructure instance. - CustomerContacts []*CustomerContact + // End date and time of maintenance window. + TimeMaintenanceWindowEnd *time.Time - // The name for the Exadata infrastructure. - DisplayName *string + // Start date and time of maintenance window. + TimeMaintenanceWindowStart *time.Time - // maintenanceWindow property - MaintenanceWindow *MaintenanceWindow + // The OCID of the second VNIC. + Vnic2ID *string - // The number of storage servers for the cloud Exadata infrastructure. - StorageCount *int32 + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *ResourceProvisioningState } -// CloudVMCluster - CloudVmCluster resource definition -type CloudVMCluster struct { - // REQUIRED; The geo-location where the resource lives - Location *string - +// DbServer resource model +type DbServer struct { // The resource-specific properties for this resource. - Properties *CloudVMClusterProperties + Properties *DbServerProperties - // Resource tags. - Tags map[string]*string + // READ-ONLY; DbServer OCID. + Name *string - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the resource - Name *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData @@ -1512,288 +2769,285 @@ type CloudVMCluster struct { Type *string } -// CloudVMClusterListResult - The response of a CloudVmCluster list operation. -type CloudVMClusterListResult struct { - // REQUIRED; The CloudVmCluster items on this page - Value []*CloudVMCluster +// DbServerListResult - The response of a DbServer list operation. +type DbServerListResult struct { + // REQUIRED; The DbServer items on this page + Value []*DbServer // The link to the next page of items NextLink *string } -// CloudVMClusterProperties - CloudVmCluster resource model -type CloudVMClusterProperties struct { - // REQUIRED; The number of CPU cores enabled on the cloud VM cluster. - CPUCoreCount *int32 - - // REQUIRED; Cloud Exadata Infrastructure ID - CloudExadataInfrastructureID *string - - // REQUIRED; Display Name - DisplayName *string - - // REQUIRED; Oracle Grid Infrastructure (GI) software version - GiVersion *string - - // REQUIRED; The hostname for the cloud VM cluster. - Hostname *string +// DbServerPatchingDetails - DbServer Patching Properties +type DbServerPatchingDetails struct { + // READ-ONLY; Estimated Patch Duration + EstimatedPatchDuration *int32 - // REQUIRED; The public key portion of one or more key pairs used for SSH access to the cloud VM cluster. - SSHPublicKeys []*string + // READ-ONLY; Patching Status + PatchingStatus *DbServerPatchingStatus - // REQUIRED; Client subnet - SubnetID *string + // READ-ONLY; Time Patching Ended + TimePatchingEnded *time.Time - // REQUIRED; VNET for network connectivity - VnetID *string + // READ-ONLY; Time Patching Started + TimePatchingStarted *time.Time +} - // Client OCI backup subnet CIDR, default is 192.168.252.0/22 - BackupSubnetCidr *string +// DbServerProperties - DbServer resource properties +type DbServerProperties struct { + // READ-ONLY; The list of OCIDs of the Autonomous VM Clusters associated with the Db server. + AutonomousVMClusterIDs []*string - // The cluster name for cloud VM cluster. The cluster name must begin with an alphabetic character, and may contain hyphens - // (-). Underscores (_) are not permitted. The cluster name can be no longer than - // 11 characters and is not case sensitive. - ClusterName *string + // READ-ONLY; The list of OCIDs of the Autonomous Virtual Machines associated with the Db server. + AutonomousVirtualMachineIDs []*string - // The list of compute servers to be added to the cloud VM cluster. - ComputeNodes []*string + // READ-ONLY; The number of CPU cores enabled on the Db server. + CPUCoreCount *int32 - // Indicates user preferences for the various diagnostic collection options for the VM cluster/Cloud VM cluster/VMBM DBCS. - DataCollectionOptions *DataCollectionOptions + // READ-ONLY; The OCID of the compartment. + CompartmentID *string - // The percentage assigned to DATA storage (user data and database files). The remaining percentage is assigned to RECO storage - // (database redo logs, archive logs, and recovery manager backups). Accepted - // values are 35, 40, 60 and 80. The default is 80 percent assigned to DATA storage. See Storage Configuration [/Content/Database/Concepts/exaoverview.htm#Exadata] - // in the Exadata documentation for - // details on the impact of the configuration settings on storage. - DataStoragePercentage *int32 + // READ-ONLY; The compute model of the Exadata Infrastructure + ComputeModel *ComputeModel - // The data disk group size to be allocated in TBs. - DataStorageSizeInTbs *float64 + // READ-ONLY; The OCID of the Db nodes associated with the Db server. + DbNodeIDs []*string - // The local node storage to be allocated in GBs. + // READ-ONLY; The allocated local node storage in GBs on the Db server. DbNodeStorageSizeInGbs *int32 - // The list of DB servers. - DbServers []*string - - // The domain name for the cloud VM cluster. - Domain *string + // READ-ONLY; dbServerPatching details of the Db server. + DbServerPatchingDetails *DbServerPatchingDetails - // If true, database backup on local Exadata storage is configured for the cloud VM cluster. If false, database backup on - // local Exadata storage is not available in the cloud VM cluster. - IsLocalBackupEnabled *bool + // READ-ONLY; The name for the Db Server. + DisplayName *string - // If true, sparse disk group is configured for the cloud VM cluster. If false, sparse disk group is not created. - IsSparseDiskgroupEnabled *bool + // READ-ONLY; The OCID of the Exadata infrastructure. + ExadataInfrastructureID *string - // The Oracle license model that applies to the cloud VM cluster. The default is LICENSE_INCLUDED. - LicenseModel *LicenseModel + // READ-ONLY; Lifecycle details of dbServer. + LifecycleDetails *string - // The memory to be allocated in GBs. - MemorySizeInGbs *int32 + // READ-ONLY; DbServer provisioning state. + LifecycleState *DbServerProvisioningState - // CIDR blocks for additional NSG ingress rules. The VNET CIDRs used to provision the VM Cluster will be added by default. - NsgCidrs []*NsgCidr + // READ-ONLY; The total number of CPU cores available. + MaxCPUCount *int32 - // The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal place is allowed for the fractional part. - OcpuCount *float32 + // READ-ONLY; The total max dbNode storage in GBs. + MaxDbNodeStorageInGbs *int32 - // The TCP Single Client Access Name (SCAN) port. The default port is 1521. - ScanListenerPortTCP *int32 + // READ-ONLY; The total memory available in GBs. + MaxMemoryInGbs *int32 - // The TCPS Single Client Access Name (SCAN) port. The default port is 2484. - ScanListenerPortTCPSSL *int32 + // READ-ONLY; The total memory size in GBs. + MemorySizeInGbs *int32 - // The data disk group size to be allocated in GBs per VM. - StorageSizeInGbs *int32 + // READ-ONLY; Db server name. + Ocid *string - // Operating system version of the image. - SystemVersion *string + // READ-ONLY; Azure resource provisioning state. + ProvisioningState *ResourceProvisioningState - // The time zone of the cloud VM cluster. For details, see Exadata Infrastructure Time Zones [/Content/Database/References/timezones.htm]. - TimeZone *string + // READ-ONLY; The shape of the Db server. The shape determines the amount of CPU, storage, and memory resources available. + Shape *string - // The OCID of the zone the cloud VM cluster is associated with. - ZoneID *string + // READ-ONLY; The date and time that the Db Server was created. + TimeCreated *time.Time - // READ-ONLY; Cluster compartmentId - CompartmentID *string + // READ-ONLY; The OCID of the VM Clusters associated with the Db server. + VMClusterIDs []*string +} - // READ-ONLY; The type of redundancy configured for the cloud Vm cluster. NORMAL is 2-way redundancy. HIGH is 3-way redundancy. - DiskRedundancy *DiskRedundancy +// DbSystemShape resource definition +type DbSystemShape struct { + // The resource-specific properties for this resource. + Properties *DbSystemShapeProperties - // READ-ONLY; iormConfigCache details for cloud VM cluster. - IormConfigCache *ExadataIormConfig + // READ-ONLY; DbSystemShape name + Name *string - // READ-ONLY; The OCID of the last maintenance update history entry. - LastUpdateHistoryEntryID *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // READ-ONLY; Additional information about the current lifecycle state. - LifecycleDetails *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // READ-ONLY; CloudVmCluster lifecycle state - LifecycleState *CloudVMClusterLifecycleState + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} - // READ-ONLY; The port number configured for the listener on the cloud VM cluster. - ListenerPort *int64 +// DbSystemShapeListResult - The response of a DbSystemShape list operation. +type DbSystemShapeListResult struct { + // REQUIRED; The DbSystemShape items on this page + Value []*DbSystemShape - // READ-ONLY; The number of nodes in the cloud VM cluster. - NodeCount *int32 + // The link to the next page of items + NextLink *string +} - // READ-ONLY; HTTPS link to OCI Network Security Group exposed to Azure Customer via the Azure Interface. - NsgURL *string +// DbSystemShapeProperties - DbSystemShape resource model +type DbSystemShapeProperties struct { + // REQUIRED; The maximum number of CPU cores that can be enabled on the DB system for this shape. + AvailableCoreCount *int32 - // READ-ONLY; HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. - OciURL *string + // REQUIRED; The shape used for the DB system. + ShapeName *string - // READ-ONLY; Cloud VM Cluster ocid - Ocid *string + // Indicates if the shape supports database and storage server types + AreServerTypesSupported *bool - // READ-ONLY; CloudVmCluster provisioning state - ProvisioningState *AzureResourceProvisioningState + // The maximum number of CPU cores per database node that can be enabled for this shape. Only applicable to the flex Exadata + // shape and ExaCC Elastic shapes. + AvailableCoreCountPerNode *int32 - // READ-ONLY; The FQDN of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster. - ScanDNSName *string + // The maximum DATA storage that can be enabled for this shape. + AvailableDataStorageInTbs *int32 - // READ-ONLY; The OCID of the DNS record for the SCAN IP addresses that are associated with the cloud VM cluster. - ScanDNSRecordID *string + // The maximum data storage available per storage server for this shape. Only applicable to ExaCC Elastic shapes. + AvailableDataStoragePerServerInTbs *float64 - // READ-ONLY; The Single Client Access Name (SCAN) IP addresses associated with the cloud VM cluster. SCAN IP addresses are - // typically used for load balancing and are not assigned to any interface. Oracle - // Clusterware directs the requests to the appropriate nodes in the cluster. Note: For a single-node DB system, this list - // is empty. - ScanIPIDs []*string + // The maximum Db Node storage available per database node for this shape. Only applicable to ExaCC Elastic shapes. + AvailableDbNodePerNodeInGbs *int32 - // READ-ONLY; The model name of the Exadata hardware running the cloud VM cluster. - Shape *string + // The maximum Db Node storage that can be enabled for this shape. + AvailableDbNodeStorageInGbs *int32 - // READ-ONLY; Cluster subnet ocid - SubnetOcid *string + // The maximum memory that can be enabled for this shape. + AvailableMemoryInGbs *int32 - // READ-ONLY; The date and time that the cloud VM cluster was created. - TimeCreated *time.Time + // The maximum memory available per database node for this shape. Only applicable to ExaCC Elastic shapes. + AvailableMemoryPerNodeInGbs *int32 - // READ-ONLY; The virtual IP (VIP) addresses associated with the cloud VM cluster. The Cluster Ready Services (CRS) creates - // and maintains one VIP address for each node in the Exadata Cloud Service instance to - // enable failover. If one node fails, the VIP is reassigned to another active node in the cluster. Note: For a single-node - // DB system, this list is empty. - VipIDs []*string -} + // The compute model of the Exadata Infrastructure + ComputeModel *ComputeModel -// CloudVMClusterUpdate - The type used for update operations of the CloudVmCluster. -type CloudVMClusterUpdate struct { - // The updatable properties of the CloudVmCluster. - Properties *CloudVMClusterUpdateProperties + // The discrete number by which the CPU core count for this shape can be increased or decreased. + CoreCountIncrement *int32 - // Resource tags. - Tags map[string]*string -} + // The display name of the shape used for the DB system + DisplayName *string -// CloudVMClusterUpdateProperties - The updatable properties of the CloudVmCluster. -type CloudVMClusterUpdateProperties struct { - // The number of CPU cores enabled on the cloud VM cluster. - CPUCoreCount *int32 + // The maximum number of Exadata storage servers available for the Exadata infrastructure. + MaxStorageCount *int32 - // The list of compute servers to be added to the cloud VM cluster. - ComputeNodes []*string + // The maximum number of database nodes available for this shape. + MaximumNodeCount *int32 - // Indicates user preferences for the various diagnostic collection options for the VM cluster/Cloud VM cluster/VMBM DBCS. - DataCollectionOptions *DataCollectionOptions + // The minimum number of CPU cores that can be enabled per node for this shape. + MinCoreCountPerNode *int32 - // The data disk group size to be allocated in TBs. - DataStorageSizeInTbs *float64 + // The minimum data storage that need be allocated for this shape. + MinDataStorageInTbs *int32 - // The local node storage to be allocated in GBs. - DbNodeStorageSizeInGbs *int32 + // The minimum Db Node storage that need be allocated per node for this shape. + MinDbNodeStoragePerNodeInGbs *int32 - // Display Name - DisplayName *string + // The minimum memory that need be allocated per node for this shape. + MinMemoryPerNodeInGbs *int32 - // The Oracle license model that applies to the cloud VM cluster. The default is LICENSE_INCLUDED. - LicenseModel *LicenseModel + // The minimum number of Exadata storage servers available for the Exadata infrastructure. + MinStorageCount *int32 - // The memory to be allocated in GBs. - MemorySizeInGbs *int32 + // The minimum number of CPU cores that can be enabled on the DB system for this shape. + MinimumCoreCount *int32 - // The number of OCPU cores to enable on the cloud VM cluster. Only 1 decimal place is allowed for the fractional part. - OcpuCount *float32 + // The minimum number of database nodes available for this shape. + MinimumNodeCount *int32 - // The public key portion of one or more key pairs used for SSH access to the cloud VM cluster. - SSHPublicKeys []*string + // The runtime minimum number of CPU cores that can be enabled on the DB system for this shape. + RuntimeMinimumCoreCount *int32 - // The data disk group size to be allocated in GBs per VM. - StorageSizeInGbs *int32 + // The family of the shape used for the DB system. + ShapeFamily *string } -// ConnectionStringType - Connection strings to connect to an Oracle Autonomous Database. -type ConnectionStringType struct { - // Returns all connection strings that can be used to connect to the Autonomous Database. - AllConnectionStrings *AllConnectionStringType +// DefinedFileSystemConfiguration - Predefined configurations for the file system +type DefinedFileSystemConfiguration struct { + // Checks if the data can be backed up + IsBackupPartition *bool - // The database service provides the least level of resources to each SQL statement, but supports the most number of concurrent - // SQL statements. - Dedicated *string + // Checks if the mount path is resizable + IsResizable *bool - // The High database service provides the highest level of resources to each SQL statement resulting in the highest performance, - // but supports the fewest number of concurrent SQL statements. - High *string + // Minimum size of mount path in Gb + MinSizeGb *int32 - // The Low database service provides the least level of resources to each SQL statement, but supports the most number of concurrent - // SQL statements. - Low *string + // Mount path for the file system + MountPoint *string +} - // The Medium database service provides a lower level of resources to each SQL statement potentially resulting a lower level - // of performance, but supports more concurrent SQL statements. - Medium *string +// DisasterRecoveryConfigurationDetails - Configurations of a Disaster Recovery Details +type DisasterRecoveryConfigurationDetails struct { + // Indicates the disaster recovery (DR) type of the Autonomous Database Serverless instance. Autonomous Data Guard (ADG) DR + // type provides business critical DR with a faster recovery time objective (RTO) during failover or switchover. Backup-based + // DR type provides lower cost DR with a slower RTO during failover or switchover. + DisasterRecoveryType *DisasterRecoveryType - // A list of connection string profiles to allow clients to group, filter and select connection string values based on structured - // metadata. - Profiles []*ProfileType + // If true, 7 days worth of backups are replicated across regions for Cross-Region ADB or Backup-Based DR between Primary + // and Standby. If false, the backups taken on the Primary are not replicated to the Standby database. + IsReplicateAutomaticBackups *bool + + // Indicates if user wants to convert to a snapshot standby. For example, true would set a standby database to snapshot standby + // database. False would set a snapshot standby database back to regular standby database. + IsSnapshotStandby *bool + + // Time and date stored as an RFC 3339 formatted timestamp string. For example, 2022-01-01T12:00:00.000Z would set a limit + // for the snapshot standby to be converted back to a cross-region standby database. + TimeSnapshotStandbyEnabledTill *time.Time } -// ConnectionURLType - The URLs for accessing Oracle Application Express (APEX) and SQL Developer Web with a browser from -// a Compute instance within your VCN or that has a direct connection to your VCN. -type ConnectionURLType struct { - // Oracle Application Express (APEX) URL. - ApexURL *string +// EstimatedPatchingTime - The estimated total time required in minutes for all patching operations (database server, storage +// server, and network switch patching). +type EstimatedPatchingTime struct { + // READ-ONLY; The estimated time required in minutes for database server patching. + EstimatedDbServerPatchingTime *int32 - // The URL of the Database Transforms for the Autonomous Database. - DatabaseTransformsURL *string + // READ-ONLY; The estimated time required in minutes for network switch patching. + EstimatedNetworkSwitchesPatchingTime *int32 - // The URL of the Graph Studio for the Autonomous Database. - GraphStudioURL *string + // READ-ONLY; The estimated time required in minutes for storage server patching. + EstimatedStorageServerPatchingTime *int32 - // The URL of the Oracle Machine Learning (OML) Notebook for the Autonomous Database. - MachineLearningNotebookURL *string + // READ-ONLY; The estimated total time required in minutes for all patching operations. + TotalEstimatedPatchingTime *int32 +} - // The URL of the MongoDB API for the Autonomous Database. - MongoDbURL *string +// ExadataIormConfig for cloud vm cluster +type ExadataIormConfig struct { + // An array of IORM settings for all the database in the Exadata DB system. + DbPlans []*DbIormConfig - // The Oracle REST Data Services (ORDS) URL of the Web Access for the Autonomous Database. - OrdsURL *string + // Additional information about the current lifecycleState. + LifecycleDetails *string - // Oracle SQL Developer Web URL. - SQLDevWebURL *string -} + // The current state of IORM configuration for the Exadata DB system. + LifecycleState *IormLifecycleState -// CustomerContact resource properties -type CustomerContact struct { - // REQUIRED; The email address used by Oracle to send notifications regarding databases and infrastructure. - Email *string + // The current value for the IORM objective. The default is AUTO. + Objective *Objective } -// DNSPrivateView - DnsPrivateView resource definition -type DNSPrivateView struct { +// ExadbVMCluster - ExadbVmCluster resource definition +type ExadbVMCluster struct { + // REQUIRED; The geo-location where the resource lives + Location *string + // The resource-specific properties for this resource. - Properties *DNSPrivateViewProperties + Properties *ExadbVMClusterProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string + // Resource tags. + Tags map[string]*string - // READ-ONLY; The name of the resource + // The availability zones. + Zones []*string + + // READ-ONLY; The name of the ExadbVmCluster 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 @@ -1801,151 +3055,191 @@ type DNSPrivateView struct { Type *string } -// DNSPrivateViewListResult - The response of a DnsPrivateView list operation. -type DNSPrivateViewListResult struct { - // REQUIRED; The DnsPrivateView items on this page - Value []*DNSPrivateView +// ExadbVMClusterListResult - The response of a ExadbVmCluster list operation. +type ExadbVMClusterListResult struct { + // REQUIRED; The ExadbVmCluster items on this page + Value []*ExadbVMCluster // The link to the next page of items NextLink *string } -// DNSPrivateViewProperties - Views resource model -type DNSPrivateViewProperties struct { - // READ-ONLY; A Boolean flag indicating whether or not parts of the resource are unable to be explicitly managed. - IsProtected *bool +// ExadbVMClusterProperties - ExadbVmCluster resource model +type ExadbVMClusterProperties struct { + // REQUIRED; Display Name + DisplayName *string - // READ-ONLY; The OCID of the view - Ocid *string + // REQUIRED; The number of ECPUs to enable for an Exadata VM cluster on Exascale Infrastructure. + EnabledEcpuCount *int32 - // READ-ONLY; The canonical absolute URL of the resource. - Self *string + // REQUIRED; The Azure Resource ID of the Exadata Database Storage Vault. + ExascaleDbStorageVaultID *string - // READ-ONLY; views timeCreated - TimeCreated *time.Time + // REQUIRED; The hostname for the Exadata VM cluster on Exascale Infrastructure. + Hostname *string - // READ-ONLY; views timeCreated - TimeUpdated *time.Time + // REQUIRED; The number of nodes in the Exadata VM cluster on Exascale Infrastructure. + NodeCount *int32 - // READ-ONLY; The display name of the view resource - DisplayName *string + // REQUIRED; The public key portion of one or more key pairs used for SSH access to the Exadata VM cluster on Exascale Infrastructure. + SSHPublicKeys []*string - // READ-ONLY; Views lifecycleState - LifecycleState *DNSPrivateViewsLifecycleState + // REQUIRED; The shape of the Exadata VM cluster on Exascale Infrastructure resource + Shape *string - // READ-ONLY; Azure resource provisioning state. - ProvisioningState *ResourceProvisioningState -} + // REQUIRED; Client subnet + SubnetID *string -// DNSPrivateZone - DnsPrivateZone resource definition -type DNSPrivateZone struct { - // The resource-specific properties for this resource. - Properties *DNSPrivateZoneProperties + // REQUIRED; The number of Total ECPUs for an Exadata VM cluster on Exascale Infrastructure. + TotalEcpuCount *int32 - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string + // REQUIRED; Filesystem storage details. + VMFileSystemStorage *ExadbVMClusterStorageDetails - // READ-ONLY; The name of the resource - Name *string + // REQUIRED; VNET for network connectivity + VnetID *string - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData + // Client OCI backup subnet CIDR, default is 192.168.252.0/22 + BackupSubnetCidr *string - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} + // The cluster name for Exadata VM cluster on Exascale Infrastructure. The cluster name must begin with an alphabetic character, + // and may contain hyphens (-). Underscores (_) are not permitted. The cluster name can be no longer than 11 characters and + // is not case sensitive. + ClusterName *string -// DNSPrivateZoneListResult - The response of a DnsPrivateZone list operation. -type DNSPrivateZoneListResult struct { - // REQUIRED; The DnsPrivateZone items on this page - Value []*DNSPrivateZone + // Indicates user preferences for the various diagnostic collection options for the VM cluster/Cloud VM cluster/VMBM DBCS. + DataCollectionOptions *DataCollectionOptions - // The link to the next page of items - NextLink *string -} + // A domain name used for the Exadata VM cluster on Exascale Infrastructure + Domain *string -// DNSPrivateZoneProperties - Zones resource model -type DNSPrivateZoneProperties struct { - // READ-ONLY; A Boolean flag indicating whether or not parts of the resource are unable to be explicitly managed. - IsProtected *bool + // Grid Setup will be done using this Grid Image OCID. Can be obtained using giMinorVersions API + GridImageOcid *string - // READ-ONLY; The OCID of the Zone - Ocid *string + // The Oracle license model that applies to the Exadata VM cluster on Exascale Infrastructure. The default is LICENSE_INCLUDED. + LicenseModel *LicenseModel - // READ-ONLY; The canonical absolute URL of the resource. - Self *string + // CIDR blocks for additional NSG ingress rules. The VNET CIDRs used to provision the VM Cluster will be added by default. + NsgCidrs []*NsgCidr - // READ-ONLY; The current serial of the zone. As seen in the zone's SOA record. - Serial *int32 + // The OCID of the zone the Exadata VM cluster on Exascale Infrastructure is associated with. + PrivateZoneOcid *string - // READ-ONLY; Zones timeCreated - TimeCreated *time.Time + // The TCP Single Client Access Name (SCAN) port. The default port is 1521. + ScanListenerPortTCP *int32 - // READ-ONLY; Version is the never-repeating, totally-orderable, version of the zone, from which the serial field of the zone's - // SOA record is derived. - Version *string + // The TCPS Single Client Access Name (SCAN) port. The default port is 2484. + ScanListenerPortTCPSSL *int32 - // READ-ONLY; The type of the zone. Must be either PRIMARY or SECONDARY. SECONDARY is only supported for GLOBAL zones. - ZoneType *ZoneType + // Operating system version of the image. + SystemVersion *string - // READ-ONLY; Zones lifecycleState - LifecycleState *DNSPrivateZonesLifecycleState + // The time zone of the Exadata VM cluster on Exascale Infrastructure. For details, see [Exadata Infrastructure Time Zones](/Content/Database/References/timezones.htm). + TimeZone *string - // READ-ONLY; Azure resource provisioning state. - ProvisioningState *ResourceProvisioningState + // READ-ONLY; Cluster backup subnet ocid + BackupSubnetOcid *string - // READ-ONLY; The OCID of the private view containing the zone. This value will be null for zones in the global DNS, which - // are publicly resolvable and not part of a private view. - ViewID *string -} + // READ-ONLY; Oracle Grid Infrastructure (GI) software version + GiVersion *string -// DataCollectionOptions resource properties -type DataCollectionOptions struct { - // Indicates whether diagnostic collection is enabled for the VM cluster/Cloud VM cluster/VMBM DBCS. - IsDiagnosticsEventsEnabled *bool + // READ-ONLY; The type of Grid Image + GridImageType *GridImageType - // Indicates whether health monitoring is enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. - IsHealthMonitoringEnabled *bool + // READ-ONLY; iormConfigCache details for Exadata VM cluster on Exascale Infrastructure. + IormConfigCache *ExadataIormConfig - // Indicates whether incident logs and trace collection are enabled for the VM cluster / Cloud VM cluster / VMBM DBCS. - IsIncidentLogsEnabled *bool -} + // READ-ONLY; Additional information about the current lifecycle state. + LifecycleDetails *string -// DayOfWeek resource properties -type DayOfWeek struct { - // REQUIRED; Name of the day of the week. - Name *DayOfWeekName + // READ-ONLY; CloudVmCluster lifecycle state + LifecycleState *ExadbVMClusterLifecycleState + + // READ-ONLY; The port number configured for the listener on the Exadata VM cluster on Exascale Infrastructure. + ListenerPort *int32 + + // READ-ONLY; The memory that you want to be allocated in GBs. Memory is calculated based on 11 GB per VM core reserved. + MemorySizeInGbs *int32 + + // READ-ONLY; HTTPS link to OCI Network Security Group exposed to Azure Customer via the Azure Interface. + NsgURL *string + + // READ-ONLY; HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + OciURL *string + + // READ-ONLY; ExadbVmCluster ocid + Ocid *string + + // READ-ONLY; Exadata VM cluster on Exascale Infrastructure provisioning state + ProvisioningState *AzureResourceProvisioningState + + // READ-ONLY; The FQDN of the DNS record for the SCAN IP addresses that are associated with the Exadata VM cluster on Exascale + // Infrastructure. + ScanDNSName *string + + // READ-ONLY; The OCID of the DNS record for the SCAN IP addresses that are associated with the Exadata VM cluster on Exascale + // Infrastructure. + ScanDNSRecordID *string + + // READ-ONLY; The Single Client Access Name (SCAN) IP addresses associated with the Exadata VM cluster on Exascale Infrastructure. + // SCAN IP addresses are typically used for load balancing and are not assigned to any interface. Oracle Clusterware directs + // the requests to the appropriate nodes in the cluster. **Note:** For a single-node DB system, this list is empty. + ScanIPIDs []*string + + // READ-ONLY; Snapshot filesystem storage details. + SnapshotFileSystemStorage *ExadbVMClusterStorageDetails + + // READ-ONLY; Cluster subnet ocid + SubnetOcid *string + + // READ-ONLY; Total file system storage details. + TotalFileSystemStorage *ExadbVMClusterStorageDetails + + // READ-ONLY; The virtual IP (VIP) addresses associated with the Exadata VM cluster on Exascale Infrastructure. The Cluster + // Ready Services (CRS) creates and maintains one VIP address for each node in the Exadata Cloud Service instance to enable + // failover. If one node fails, the VIP is reassigned to another active node in the cluster. **Note:** For a single-node DB + // system, this list is empty. + VipIDs []*string + + // READ-ONLY; The OCID of the zone the Exadata VM cluster on Exascale Infrastructure is associated with. + ZoneOcid *string } -// DayOfWeekUpdate - DayOfWeek resource properties -type DayOfWeekUpdate struct { - // Name of the day of the week. - Name *DayOfWeekName +// ExadbVMClusterStorageDetails - Storage Details on the Exadata VM cluster. +type ExadbVMClusterStorageDetails struct { + // REQUIRED; Total Capacity + TotalSizeInGbs *int32 } -// DbIormConfig for cloud vm cluster -type DbIormConfig struct { - // The database name. For the default DbPlan, the dbName is default. - DbName *string +// ExadbVMClusterUpdate - The type used for update operations of the ExadbVmCluster. +type ExadbVMClusterUpdate struct { + // The resource-specific properties for this resource. + Properties *ExadbVMClusterUpdateProperties - // The flash cache limit for this database. This value is internally configured based on the share value assigned to the database. - FlashCacheLimit *string + // Resource tags. + Tags map[string]*string - // The relative priority of this database. - Share *int32 + // The availability zones. + Zones []*string } -// DbNode - The DbNode resource belonging to vmCluster -type DbNode struct { - // The resource-specific properties for this resource. - Properties *DbNodeProperties +// ExadbVMClusterUpdateProperties - The updatable properties of the ExadbVmCluster. +type ExadbVMClusterUpdateProperties struct { + // The number of nodes in the Exadata VM cluster on Exascale Infrastructure. + NodeCount *int32 +} - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string +// ExascaleDbNode - The DbNode resource belonging to ExadbVmCluster +type ExascaleDbNode struct { + // The resource-specific properties for this resource. + Properties *ExascaleDbNodeProperties - // READ-ONLY; The name of the resource + // READ-ONLY; The name of the ExascaleDbNode 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 @@ -1953,105 +3247,93 @@ type DbNode struct { Type *string } -// DbNodeAction - DbNode action object -type DbNodeAction struct { - // REQUIRED; Db action - Action *DbNodeActionEnum -} - -// DbNodeListResult - The response of a DbNode list operation. -type DbNodeListResult struct { - // REQUIRED; The DbNode items on this page - Value []*DbNode +// ExascaleDbNodeListResult - The response of a ExascaleDbNode list operation. +type ExascaleDbNodeListResult struct { + // REQUIRED; The ExascaleDbNode items on this page + Value []*ExascaleDbNode // The link to the next page of items NextLink *string } -// DbNodeProperties - The properties of DbNodeResource -type DbNodeProperties struct { - // READ-ONLY; The OCID of the DB system. - DbSystemID *string - - // READ-ONLY; DbNode OCID - Ocid *string - - // READ-ONLY; Additional information about the planned maintenance. - AdditionalDetails *string - - // READ-ONLY; The OCID of the backup IP address associated with the database node. - BackupIPID *string - - // READ-ONLY; The OCID of the second backup VNIC. - BackupVnic2ID *string +// ExascaleDbNodeProperties - The properties of DbNodeResource +type ExascaleDbNodeProperties struct { + // REQUIRED; DbNode OCID + Ocid *string - // READ-ONLY; The OCID of the backup VNIC. - BackupVnicID *string + // Additional information about the planned maintenance. + AdditionalDetails *string - // READ-ONLY; The number of CPU cores enabled on the Db node. + // The number of CPU cores enabled on the Db node. CPUCoreCount *int32 - // READ-ONLY; The allocated local node storage in GBs on the Db node. + // The allocated local node storage in GBs on the Db node. DbNodeStorageSizeInGbs *int32 - // READ-ONLY; The OCID of the Exacc Db server associated with the database node. - DbServerID *string - - // READ-ONLY; The name of the Fault Domain the instance is contained in. + // The name of the Fault Domain the instance is contained in. FaultDomain *string - // READ-ONLY; The OCID of the host IP address associated with the database node. - HostIPID *string - - // READ-ONLY; The host name for the database node. + // The host name for the database node. Hostname *string - // READ-ONLY; Lifecycle details of Db Node. - LifecycleDetails *string - - // READ-ONLY; The current state of the database node. + // The current state of the database node. LifecycleState *DbNodeProvisioningState - // READ-ONLY; The type of database node maintenance. - MaintenanceType *DbNodeMaintenanceType + // The type of database node maintenance. + MaintenanceType *string - // READ-ONLY; The allocated memory in GBs on the Db node. + // The allocated memory in GBs on the Db node. MemorySizeInGbs *int32 - // READ-ONLY; Azure resource provisioning state. - ProvisioningState *ResourceProvisioningState - - // READ-ONLY; The size (in GB) of the block storage volume allocation for the DB system. This attribute applies only for virtual - // machine DB systems. + // The size (in GB) of the block storage volume allocation for the DB system. This attribute applies only for virtual machine + // DB systems. SoftwareStorageSizeInGb *int32 - // READ-ONLY; The date and time that the database node was created. - TimeCreated *time.Time - - // READ-ONLY; End date and time of maintenance window. + // End date and time of maintenance window. TimeMaintenanceWindowEnd *time.Time - // READ-ONLY; Start date and time of maintenance window. + // Start date and time of maintenance window. TimeMaintenanceWindowStart *time.Time - // READ-ONLY; The OCID of the second VNIC. - Vnic2ID *string + // The total number of CPU cores reserved on the Db node. + TotalCPUCoreCount *int32 +} - // READ-ONLY; The OCID of the VNIC. - VnicID *string +// ExascaleDbStorageDetails - Exadata Database Storage Details +type ExascaleDbStorageDetails struct { + // Available Capacity + AvailableSizeInGbs *int32 + + // Total Capacity + TotalSizeInGbs *int32 } -// DbServer resource model -type DbServer struct { +// ExascaleDbStorageInputDetails - Create exadata Database Storage Details model +type ExascaleDbStorageInputDetails struct { + // REQUIRED; Total Capacity + TotalSizeInGbs *int32 +} + +// ExascaleDbStorageVault resource definition +type ExascaleDbStorageVault struct { + // REQUIRED; The geo-location where the resource lives + Location *string + // The resource-specific properties for this resource. - Properties *DbServerProperties + Properties *ExascaleDbStorageVaultProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string + // Resource tags. + Tags map[string]*string + + // The availability zones. + Zones []*string - // READ-ONLY; The name of the resource + // READ-ONLY; The name of the ExascaleDbStorageVault 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 @@ -2059,104 +3341,80 @@ type DbServer struct { Type *string } -// DbServerListResult - The response of a DbServer list operation. -type DbServerListResult struct { - // REQUIRED; The DbServer items on this page - Value []*DbServer +// ExascaleDbStorageVaultListResult - The response of a ExascaleDbStorageVault list operation. +type ExascaleDbStorageVaultListResult struct { + // REQUIRED; The ExascaleDbStorageVault items on this page + Value []*ExascaleDbStorageVault // The link to the next page of items NextLink *string } -// DbServerPatchingDetails - DbServer Patching Properties -type DbServerPatchingDetails struct { - // READ-ONLY; Estimated Patch Duration - EstimatedPatchDuration *int32 - - // READ-ONLY; Patching Status - PatchingStatus *DbServerPatchingStatus - - // READ-ONLY; Time Patching Ended - TimePatchingEnded *time.Time - - // READ-ONLY; Time Patching Started - TimePatchingStarted *time.Time -} - -// DbServerProperties - DbServer resource properties -type DbServerProperties struct { - // READ-ONLY; The list of OCIDs of the Autonomous VM Clusters associated with the Db server. - AutonomousVMClusterIDs []*string - - // READ-ONLY; The list of OCIDs of the Autonomous Virtual Machines associated with the Db server. - AutonomousVirtualMachineIDs []*string - - // READ-ONLY; The number of CPU cores enabled on the Db server. - CPUCoreCount *int32 - - // READ-ONLY; The OCID of the compartment. - CompartmentID *string +// ExascaleDbStorageVaultProperties - ExascaleDbStorageVault resource model +type ExascaleDbStorageVaultProperties struct { + // REQUIRED; The user-friendly name for the Exadata Database Storage Vault. The name does not need to be unique. + DisplayName *string - // READ-ONLY; The OCID of the Db nodes associated with the Db server. - DbNodeIDs []*string + // REQUIRED; Create exadata Database Storage Details + HighCapacityDatabaseStorageInput *ExascaleDbStorageInputDetails - // READ-ONLY; The allocated local node storage in GBs on the Db server. - DbNodeStorageSizeInGbs *int32 + // The size of additional Flash Cache in percentage of High Capacity database storage. + AdditionalFlashCacheInPercent *int32 - // READ-ONLY; dbServerPatching details of the Db server. - DbServerPatchingDetails *DbServerPatchingDetails + // Exadata Database Storage Vault description. + Description *string - // READ-ONLY; The name for the Db Server. - DisplayName *string + // The time zone that you want to use for the Exadata Database Storage Vault + TimeZone *string - // READ-ONLY; The OCID of the Exadata infrastructure. - ExadataInfrastructureID *string + // READ-ONLY; Response exadata Database Storage Details + HighCapacityDatabaseStorage *ExascaleDbStorageDetails - // READ-ONLY; Lifecycle details of dbServer. + // READ-ONLY; Additional information about the current lifecycle state. LifecycleDetails *string - // READ-ONLY; DbServer provisioning state. - LifecycleState *DbServerProvisioningState - - // READ-ONLY; The total number of CPU cores available. - MaxCPUCount *int32 - - // READ-ONLY; The total max dbNode storage in GBs. - MaxDbNodeStorageInGbs *int32 - - // READ-ONLY; The total memory available in GBs. - MaxMemoryInGbs *int32 + // READ-ONLY; Exadata Database Storage Vault lifecycle state + LifecycleState *ExascaleDbStorageVaultLifecycleState - // READ-ONLY; The total memory size in GBs. - MemorySizeInGbs *int32 + // READ-ONLY; HTTPS link to OCI resources exposed to Azure Customer via Azure Interface. + OciURL *string - // READ-ONLY; Db server name. + // READ-ONLY; The OCID of the Exadata Database Storage Vault. Ocid *string - // READ-ONLY; Azure resource provisioning state. - ProvisioningState *ResourceProvisioningState + // READ-ONLY; Exadata Database Storage Vault provisioning state + ProvisioningState *AzureResourceProvisioningState - // READ-ONLY; The shape of the Db server. The shape determines the amount of CPU, storage, and memory resources available. - Shape *string + // READ-ONLY; The number of Exadata VM clusters used the Exadata Database Storage Vault. + VMClusterCount *int32 +} - // READ-ONLY; The date and time that the Db Server was created. - TimeCreated *time.Time +// ExascaleDbStorageVaultTagsUpdate - The type used for updating tags in ExascaleDbStorageVault resources. +type ExascaleDbStorageVaultTagsUpdate struct { + // Resource tags. + Tags map[string]*string +} - // READ-ONLY; The OCID of the VM Clusters associated with the Db server. - VMClusterIDs []*string +// FileSystemConfigurationDetails - File configuration options +type FileSystemConfigurationDetails struct { + // Size of the VM + FileSystemSizeGb *int32 + + // Mount path + MountPoint *string } -// DbSystemShape resource definition -type DbSystemShape struct { +// FlexComponent Resource Definition +type FlexComponent struct { // The resource-specific properties for this resource. - Properties *DbSystemShapeProperties - - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string + Properties *FlexComponentProperties - // READ-ONLY; The name of the resource + // READ-ONLY; The name of the FlexComponent 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 @@ -2164,120 +3422,94 @@ type DbSystemShape struct { Type *string } -// DbSystemShapeListResult - The response of a DbSystemShape list operation. -type DbSystemShapeListResult struct { - // REQUIRED; The DbSystemShape items on this page - Value []*DbSystemShape +// FlexComponentListResult - The response of a FlexComponent list operation. +type FlexComponentListResult struct { + // REQUIRED; The FlexComponent items on this page + Value []*FlexComponent // The link to the next page of items NextLink *string } -// DbSystemShapeProperties - DbSystemShape resource model -type DbSystemShapeProperties struct { - // READ-ONLY; The maximum number of CPU cores that can be enabled on the DB system for this shape. +// FlexComponentProperties - FlexComponent resource model +type FlexComponentProperties struct { + // READ-ONLY; The maximum number of CPU cores that can be enabled on the DB Server for this Flex Component. AvailableCoreCount *int32 - // READ-ONLY; The maximum number of CPU cores per database node that can be enabled for this shape. Only applicable to the - // flex Exadata shape and ExaCC Elastic shapes. - AvailableCoreCountPerNode *int32 - - // READ-ONLY; The maximum DATA storage that can be enabled for this shape. - AvailableDataStorageInTbs *int32 - - // READ-ONLY; The maximum data storage available per storage server for this shape. Only applicable to ExaCC Elastic shapes. - AvailableDataStoragePerServerInTbs *float64 - - // READ-ONLY; The maximum Db Node storage available per database node for this shape. Only applicable to ExaCC Elastic shapes. - AvailableDbNodePerNodeInGbs *int32 + // READ-ONLY; The maximum storage that can be enabled on the Storage Server for this Flex Component. + AvailableDbStorageInGbs *int32 - // READ-ONLY; The maximum Db Node storage that can be enabled for this shape. - AvailableDbNodeStorageInGbs *int32 + // READ-ONLY; The maximum local storage that can be enabled on the DB Server for this Flex Component. + AvailableLocalStorageInGbs *int32 - // READ-ONLY; The maximum memory that can be enabled for this shape. + // READ-ONLY; The maximum memory size that can be enabled on the DB Server for this Flex Component. AvailableMemoryInGbs *int32 - // READ-ONLY; The maximum memory available per database node for this shape. Only applicable to ExaCC Elastic shapes. - AvailableMemoryPerNodeInGbs *int32 - - // READ-ONLY; The discrete number by which the CPU core count for this shape can be increased or decreased. - CoreCountIncrement *int32 - - // READ-ONLY; The maximum number of Exadata storage servers available for the Exadata infrastructure. - MaxStorageCount *int32 - - // READ-ONLY; The maximum number of database nodes available for this shape. - MaximumNodeCount *int32 - - // READ-ONLY; The minimum number of CPU cores that can be enabled per node for this shape. - MinCoreCountPerNode *int32 - - // READ-ONLY; The minimum data storage that need be allocated for this shape. - MinDataStorageInTbs *int32 - - // READ-ONLY; The minimum Db Node storage that need be allocated per node for this shape. - MinDbNodeStoragePerNodeInGbs *int32 + // READ-ONLY; The compute model of the DB Server for this Flex Component. + ComputeModel *string - // READ-ONLY; The minimum memory that need be allocated per node for this shape. - MinMemoryPerNodeInGbs *int32 + // READ-ONLY; The description summary for this Flex Component. + DescriptionSummary *string - // READ-ONLY; The minimum number of Exadata storage servers available for the Exadata infrastructure. - MinStorageCount *int32 + // READ-ONLY; The hardware type of the DB (Compute) or Storage (Cell) Server for this Flex Component. + HardwareType *HardwareType - // READ-ONLY; The minimum number of CPU cores that can be enabled on the DB system for this shape. + // READ-ONLY; The minimum number of CPU cores that can be enabled on the DB Server for this Flex Component. MinimumCoreCount *int32 - // READ-ONLY; The minimum number of database nodes available for this shape. - MinimumNodeCount *int32 - - // READ-ONLY; The runtime minimum number of CPU cores that can be enabled on the DB system for this shape. + // READ-ONLY; The runtime minimum number of CPU cores that can be enabled for this Flex Component. RuntimeMinimumCoreCount *int32 - // READ-ONLY; The family of the shape used for the DB system. - ShapeFamily *string + // READ-ONLY; The name of the DB system shape for this Flex Component. + Shape *string } -// EstimatedPatchingTime - The estimated total time required in minutes for all patching operations (database server, storage -// server, and network switch patching). -type EstimatedPatchingTime struct { - // READ-ONLY; The estimated time required in minutes for database server patching. - EstimatedDbServerPatchingTime *int32 - - // READ-ONLY; The estimated time required in minutes for network switch patching. - EstimatedNetworkSwitchesPatchingTime *int32 +// GenerateAutonomousDatabaseWalletDetails - Autonomous Database Generate Wallet resource model. +type GenerateAutonomousDatabaseWalletDetails struct { + // REQUIRED; The password to encrypt the keys inside the wallet + Password *string - // READ-ONLY; The estimated time required in minutes for storage server patching. - EstimatedStorageServerPatchingTime *int32 + // The type of wallet to generate. + GenerateType *GenerateType - // READ-ONLY; The estimated total time required in minutes for all patching operations. - TotalEstimatedPatchingTime *int32 + // True when requesting regional connection strings in PDB connect info, applicable to cross-region DG only. + IsRegional *bool } -// ExadataIormConfig for cloud vm cluster -type ExadataIormConfig struct { - // An array of IORM settings for all the database in the Exadata DB system. - DbPlans []*DbIormConfig +// GiMinorVersion - The Oracle Grid Infrastructure (GI) minor version resource definition. +type GiMinorVersion struct { + // The resource-specific properties for this resource. + Properties *GiMinorVersionProperties - // Additional information about the current lifecycleState. - LifecycleDetails *string + // READ-ONLY; The name of the GiMinorVersion + Name *string - // The current state of IORM configuration for the Exadata DB system. - LifecycleState *IormLifecycleState + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // The current value for the IORM objective. The default is AUTO. - Objective *Objective + // 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 } -// GenerateAutonomousDatabaseWalletDetails - Autonomous Database Generate Wallet resource model. -type GenerateAutonomousDatabaseWalletDetails struct { - // REQUIRED; The password to encrypt the keys inside the wallet - Password *string +// GiMinorVersionListResult - The response of a GiMinorVersion list operation. +type GiMinorVersionListResult struct { + // REQUIRED; The GiMinorVersion items on this page + Value []*GiMinorVersion - // The type of wallet to generate. - GenerateType *GenerateType + // The link to the next page of items + NextLink *string +} - // True when requesting regional connection strings in PDB connect info, applicable to cross-region DG only. - IsRegional *bool +// GiMinorVersionProperties - The Oracle Grid Infrastructure (GI) minor version properties +type GiMinorVersionProperties struct { + // REQUIRED; A valid Oracle Grid Infrastructure (GI) software version. + Version *string + + // Grid Infrastructure Image Id + GridImageOcid *string } // GiVersion resource definition @@ -2285,12 +3517,12 @@ type GiVersion struct { // The resource-specific properties for this resource. Properties *GiVersionProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; GiVersion 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 @@ -2309,13 +3541,13 @@ type GiVersionListResult struct { // GiVersionProperties - GiVersion resource model type GiVersionProperties struct { - // READ-ONLY; A valid Oracle Grid Infrastructure (GI) software version. + // REQUIRED; A valid Oracle Grid Infrastructure (GI) software version. Version *string } // LongTermBackUpScheduleDetails - Details for the long-term backup schedule. type LongTermBackUpScheduleDetails struct { - // Indicates if the long-term backup schedule should be deleted. The default value is FALSE. + // Indicates if the long-term backup schedule should be deleted. The default value is `FALSE`. IsDisabled *bool // The frequency of the long-term backup schedule @@ -2339,9 +3571,9 @@ type MaintenanceWindow struct { DaysOfWeek []*DayOfWeek // The window of hours during the day when maintenance should be performed. The window is a 4 hour slot. Valid values are - // - 0 - represents time slot 0:00 - 3:59 UTC - 4 - represents time slot 4:00 - 7:59 - // UTC - 8 - represents time slot 8:00 - 11:59 UTC - 12 - represents time slot 12:00 - 15:59 UTC - 16 - represents time slot - // 16:00 - 19:59 UTC - 20 - represents time slot 20:00 - 23:59 UTC + // - 0 - represents time slot 0:00 - 3:59 UTC - 4 - represents time slot 4:00 - 7:59 UTC - 8 - represents time slot 8:00 - + // 11:59 UTC - 12 - represents time slot 12:00 - 15:59 UTC - 16 - represents time slot 16:00 - 19:59 UTC - 20 - represents + // time slot 20:00 - 23:59 UTC HoursOfDay []*int32 // If true, enables the configuration of a custom action timeout (waiting period) between database server patching operations. @@ -2364,12 +3596,11 @@ type MaintenanceWindow struct { Preference *Preference // Weeks during the month when maintenance should be performed. Weeks start on the 1st, 8th, 15th, and 22nd days of the month, - // and have a duration of 7 days. Weeks start and end based on calendar dates, - // not days of the week. For example, to allow maintenance during the 2nd week of the month (from the 8th day to the 14th - // day of the month), use the value 2. Maintenance cannot be scheduled for the fifth - // week of months that contain more than 28 days. Note that this parameter works in conjunction with the daysOfWeek and hoursOfDay - // parameters to allow you to specify specific days of the week and hours - // that maintenance will be performed. + // and have a duration of 7 days. Weeks start and end based on calendar dates, not days of the week. For example, to allow + // maintenance during the 2nd week of the month (from the 8th day to the 14th day of the month), use the value 2. Maintenance + // cannot be scheduled for the fifth week of months that contain more than 28 days. Note that this parameter works in conjunction + // with the daysOfWeek and hoursOfDay parameters to allow you to specify specific days of the week and hours that maintenance + // will be performed. WeeksOfMonth []*int32 } @@ -2388,16 +3619,18 @@ type NsgCidr struct { DestinationPortRange *PortRange } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API Operation +// +// Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + // 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", @@ -2409,7 +3642,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 @@ -2430,11 +3663,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 } // OracleSubscription resource definition @@ -2445,12 +3678,12 @@ type OracleSubscription struct { // The resource-specific properties for this resource. Properties *OracleSubscriptionProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; OracleSubscription 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 @@ -2478,12 +3711,21 @@ type OracleSubscriptionProperties struct { // Term Unit. P1Y, P3Y, etc, see Durations https://en.wikipedia.org/wiki/ISO_8601 TermUnit *string + // READ-ONLY; State of the add Azure subscription operation on Oracle subscription + AddSubscriptionOperationState *AddSubscriptionOperationState + + // READ-ONLY; Azure subscriptions to be added + AzureSubscriptionIDs []*string + // READ-ONLY; Cloud Account Id CloudAccountID *string // READ-ONLY; Cloud Account provisioning state. CloudAccountState *CloudAccountProvisioningState + // READ-ONLY; Status details of the last operation on Oracle subscription + LastOperationStatusDetail *string + // READ-ONLY; OracleSubscriptionProvisioningState provisioning state ProvisioningState *OracleSubscriptionProvisioningState @@ -2496,7 +3738,7 @@ type OracleSubscriptionUpdate struct { // Details of the resource plan. Plan *PlanUpdate - // The updatable properties of the OracleSubscription. + // The resource-specific properties for this resource. Properties *OracleSubscriptionUpdateProperties } @@ -2511,9 +3753,15 @@ type OracleSubscriptionUpdateProperties struct { // PeerDbDetails - PeerDb Details type PeerDbDetails struct { - // The database OCID of the Disaster Recovery peer database, which is located in a different region from the current peer + // The Azure resource ID of the Disaster Recovery peer database, which is located in a different region from the current peer // database. PeerDbID *string + + // The location of the Disaster Recovery peer database. + PeerDbLocation *string + + // Ocid of the Disaster Recovery peer database, which is located in a different region from the current peer database. + PeerDbOcid *string } // Plan for the resource. @@ -2623,51 +3871,19 @@ type ProfileType struct { TLSAuthentication *TLSAuthenticationType } +// RemoveVirtualMachineFromExadbVMClusterDetails - Details of removing Virtual Machines from the Exadata VM cluster on Exascale +// Infrastructure. Applies to Exadata Database Service on Exascale Infrastructure only. +type RemoveVirtualMachineFromExadbVMClusterDetails struct { + // REQUIRED; The list of ExaCS DB nodes for the Exadata VM cluster on Exascale Infrastructure to be removed. + DbNodes []*DbNodeDetails +} + // RestoreAutonomousDatabaseDetails - Details to restore an Oracle Autonomous Database. type RestoreAutonomousDatabaseDetails struct { // REQUIRED; The time to restore the database to. Timestamp *time.Time } -// SaasSubscriptionDetails - SaaS Subscription Details model -type SaasSubscriptionDetails struct { - // READ-ONLY; Purchased SaaS subscription ID - ID *string - - // READ-ONLY; AutoRenew flag - IsAutoRenew *bool - - // READ-ONLY; FreeTrial flag - IsFreeTrial *bool - - // READ-ONLY; Purchased offer ID - OfferID *string - - // READ-ONLY; Purchased offer's plan ID - PlanID *string - - // READ-ONLY; Publisher ID - PublisherID *string - - // READ-ONLY; Purchaser Email ID - PurchaserEmailID *string - - // READ-ONLY; Purchaser Tenant ID - PurchaserTenantID *string - - // READ-ONLY; Indicates the status of the Subscription. - SaasSubscriptionStatus *string - - // READ-ONLY; SaaS subscription name - SubscriptionName *string - - // READ-ONLY; Purchase Term Unit - TermUnit *string - - // READ-ONLY; Creation Date and Time - TimeCreated *time.Time -} - // ScheduledOperationsType - The list of scheduled operations. type ScheduledOperationsType struct { // REQUIRED; Day of week @@ -2680,18 +3896,6 @@ type ScheduledOperationsType struct { ScheduledStopTime *string } -// ScheduledOperationsTypeUpdate - The list of scheduled operations. -type ScheduledOperationsTypeUpdate struct { - // Day of week - DayOfWeek *DayOfWeekUpdate - - // auto start time. value must be of ISO-8601 format HH:mm - ScheduledStartTime *string - - // auto stop time. value must be of ISO-8601 format HH:mm - ScheduledStopTime *string -} - // SystemData - Metadata pertaining to creation and last modification of the resource. type SystemData struct { // The timestamp of resource creation (UTC). @@ -2718,12 +3922,12 @@ type SystemVersion struct { // The resource-specific properties for this resource. Properties *SystemVersionProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; SystemVersion 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 @@ -2742,7 +3946,7 @@ type SystemVersionListResult struct { // SystemVersionProperties - System Version Resource model type SystemVersionProperties struct { - // READ-ONLY; A valid Oracle System Version + // REQUIRED; A valid Oracle System Version SystemVersion *string } @@ -2751,12 +3955,12 @@ type VirtualNetworkAddress struct { // The resource-specific properties for this resource. Properties *VirtualNetworkAddressProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" - ID *string - - // READ-ONLY; The name of the resource + // READ-ONLY; Virtual IP address hostname. 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 diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/models_serde.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/models_serde.go index 3c239e9ac5d9..ac8c1fbec959 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/models_serde.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/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 armoracledatabase @@ -15,37 +11,6 @@ import ( "reflect" ) -// MarshalJSON implements the json.Marshaller interface for type ActivationLinks. -func (a ActivationLinks) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "existingCloudAccountActivationLink", a.ExistingCloudAccountActivationLink) - populate(objectMap, "newCloudAccountActivationLink", a.NewCloudAccountActivationLink) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActivationLinks. -func (a *ActivationLinks) UnmarshalJSON(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 "existingCloudAccountActivationLink": - err = unpopulate(val, "ExistingCloudAccountActivationLink", &a.ExistingCloudAccountActivationLink) - delete(rawMsg, key) - case "newCloudAccountActivationLink": - err = unpopulate(val, "NewCloudAccountActivationLink", &a.NewCloudAccountActivationLink) - 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 AddRemoveDbNode. func (a AddRemoveDbNode) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -351,60 +316,6 @@ func (a *AutonomousDatabaseBackupProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseBackupUpdate. -func (a AutonomousDatabaseBackupUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseBackupUpdate. -func (a *AutonomousDatabaseBackupUpdate) UnmarshalJSON(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 "properties": - err = unpopulate(val, "Properties", &a.Properties) - 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 AutonomousDatabaseBackupUpdateProperties. -func (a AutonomousDatabaseBackupUpdateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "retentionPeriodInDays", a.RetentionPeriodInDays) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseBackupUpdateProperties. -func (a *AutonomousDatabaseBackupUpdateProperties) UnmarshalJSON(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 "retentionPeriodInDays": - err = unpopulate(val, "RetentionPeriodInDays", &a.RetentionPeriodInDays) - 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 AutonomousDatabaseBaseProperties. func (a AutonomousDatabaseBaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -423,7 +334,7 @@ func (a AutonomousDatabaseBaseProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "connectionStrings", a.ConnectionStrings) populate(objectMap, "connectionUrls", a.ConnectionUrls) populate(objectMap, "customerContacts", a.CustomerContacts) - objectMap["dataBaseType"] = a.DataBaseType + populate(objectMap, "dataBaseType", a.DataBaseType) populate(objectMap, "dataSafeStatus", a.DataSafeStatus) populate(objectMap, "dataStorageSizeInGbs", a.DataStorageSizeInGbs) populate(objectMap, "dataStorageSizeInTbs", a.DataStorageSizeInTbs) @@ -462,6 +373,7 @@ func (a AutonomousDatabaseBaseProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "privateEndpointLabel", a.PrivateEndpointLabel) populate(objectMap, "provisionableCpus", a.ProvisionableCpus) populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "remoteDisasterRecoveryConfiguration", a.RemoteDisasterRecoveryConfiguration) populate(objectMap, "role", a.Role) populate(objectMap, "sqlWebDeveloperUrl", a.SQLWebDeveloperURL) populate(objectMap, "scheduledOperations", a.ScheduledOperations) @@ -471,6 +383,7 @@ func (a AutonomousDatabaseBaseProperties) MarshalJSON() ([]byte, error) { populateDateTimeRFC3339(objectMap, "timeCreated", a.TimeCreated) populate(objectMap, "timeDataGuardRoleChanged", a.TimeDataGuardRoleChanged) populate(objectMap, "timeDeletionOfFreeAutonomousDatabase", a.TimeDeletionOfFreeAutonomousDatabase) + populateDateTimeRFC3339(objectMap, "timeDisasterRecoveryRoleChanged", a.TimeDisasterRecoveryRoleChanged) populate(objectMap, "timeLocalDataGuardEnabled", a.TimeLocalDataGuardEnabled) populateDateTimeRFC3339(objectMap, "timeMaintenanceBegin", a.TimeMaintenanceBegin) populateDateTimeRFC3339(objectMap, "timeMaintenanceEnd", a.TimeMaintenanceEnd) @@ -657,6 +570,9 @@ func (a *AutonomousDatabaseBaseProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) delete(rawMsg, key) + case "remoteDisasterRecoveryConfiguration": + err = unpopulate(val, "RemoteDisasterRecoveryConfiguration", &a.RemoteDisasterRecoveryConfiguration) + delete(rawMsg, key) case "role": err = unpopulate(val, "Role", &a.Role) delete(rawMsg, key) @@ -684,6 +600,9 @@ func (a *AutonomousDatabaseBaseProperties) UnmarshalJSON(data []byte) error { case "timeDeletionOfFreeAutonomousDatabase": err = unpopulate(val, "TimeDeletionOfFreeAutonomousDatabase", &a.TimeDeletionOfFreeAutonomousDatabase) delete(rawMsg, key) + case "timeDisasterRecoveryRoleChanged": + err = unpopulateDateTimeRFC3339(val, "TimeDisasterRecoveryRoleChanged", &a.TimeDisasterRecoveryRoleChanged) + delete(rawMsg, key) case "timeLocalDataGuardEnabled": err = unpopulate(val, "TimeLocalDataGuardEnabled", &a.TimeLocalDataGuardEnabled) delete(rawMsg, key) @@ -891,6 +810,7 @@ func (a AutonomousDatabaseCloneProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "refreshableModel", a.RefreshableModel) populate(objectMap, "refreshableStatus", a.RefreshableStatus) + populate(objectMap, "remoteDisasterRecoveryConfiguration", a.RemoteDisasterRecoveryConfiguration) populate(objectMap, "role", a.Role) populate(objectMap, "sqlWebDeveloperUrl", a.SQLWebDeveloperURL) populate(objectMap, "scheduledOperations", a.ScheduledOperations) @@ -902,6 +822,7 @@ func (a AutonomousDatabaseCloneProperties) MarshalJSON() ([]byte, error) { populateDateTimeRFC3339(objectMap, "timeCreated", a.TimeCreated) populate(objectMap, "timeDataGuardRoleChanged", a.TimeDataGuardRoleChanged) populate(objectMap, "timeDeletionOfFreeAutonomousDatabase", a.TimeDeletionOfFreeAutonomousDatabase) + populateDateTimeRFC3339(objectMap, "timeDisasterRecoveryRoleChanged", a.TimeDisasterRecoveryRoleChanged) populate(objectMap, "timeLocalDataGuardEnabled", a.TimeLocalDataGuardEnabled) populateDateTimeRFC3339(objectMap, "timeMaintenanceBegin", a.TimeMaintenanceBegin) populateDateTimeRFC3339(objectMap, "timeMaintenanceEnd", a.TimeMaintenanceEnd) @@ -1104,6 +1025,9 @@ func (a *AutonomousDatabaseCloneProperties) UnmarshalJSON(data []byte) error { case "refreshableStatus": err = unpopulate(val, "RefreshableStatus", &a.RefreshableStatus) delete(rawMsg, key) + case "remoteDisasterRecoveryConfiguration": + err = unpopulate(val, "RemoteDisasterRecoveryConfiguration", &a.RemoteDisasterRecoveryConfiguration) + delete(rawMsg, key) case "role": err = unpopulate(val, "Role", &a.Role) delete(rawMsg, key) @@ -1137,6 +1061,9 @@ func (a *AutonomousDatabaseCloneProperties) UnmarshalJSON(data []byte) error { case "timeDeletionOfFreeAutonomousDatabase": err = unpopulate(val, "TimeDeletionOfFreeAutonomousDatabase", &a.TimeDeletionOfFreeAutonomousDatabase) delete(rawMsg, key) + case "timeDisasterRecoveryRoleChanged": + err = unpopulateDateTimeRFC3339(val, "TimeDisasterRecoveryRoleChanged", &a.TimeDisasterRecoveryRoleChanged) + delete(rawMsg, key) case "timeLocalDataGuardEnabled": err = unpopulate(val, "TimeLocalDataGuardEnabled", &a.TimeLocalDataGuardEnabled) delete(rawMsg, key) @@ -1184,140 +1111,8 @@ func (a *AutonomousDatabaseCloneProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseListResult. -func (a AutonomousDatabaseListResult) 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 AutonomousDatabaseListResult. -func (a *AutonomousDatabaseListResult) UnmarshalJSON(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 AutonomousDatabaseNationalCharacterSet. -func (a AutonomousDatabaseNationalCharacterSet) 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 AutonomousDatabaseNationalCharacterSet. -func (a *AutonomousDatabaseNationalCharacterSet) UnmarshalJSON(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 AutonomousDatabaseNationalCharacterSetListResult. -func (a AutonomousDatabaseNationalCharacterSetListResult) 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 AutonomousDatabaseNationalCharacterSetListResult. -func (a *AutonomousDatabaseNationalCharacterSetListResult) UnmarshalJSON(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 AutonomousDatabaseNationalCharacterSetProperties. -func (a AutonomousDatabaseNationalCharacterSetProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "characterSet", a.CharacterSet) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseNationalCharacterSetProperties. -func (a *AutonomousDatabaseNationalCharacterSetProperties) UnmarshalJSON(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 "characterSet": - err = unpopulate(val, "CharacterSet", &a.CharacterSet) - 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 AutonomousDatabaseProperties. -func (a AutonomousDatabaseProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseCrossRegionDisasterRecoveryProperties. +func (a AutonomousDatabaseCrossRegionDisasterRecoveryProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "actualUsedDataStorageSizeInTbs", a.ActualUsedDataStorageSizeInTbs) populate(objectMap, "adminPassword", a.AdminPassword) @@ -1334,7 +1129,7 @@ func (a AutonomousDatabaseProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "connectionStrings", a.ConnectionStrings) populate(objectMap, "connectionUrls", a.ConnectionUrls) populate(objectMap, "customerContacts", a.CustomerContacts) - objectMap["dataBaseType"] = DataBaseTypeRegular + objectMap["dataBaseType"] = DataBaseTypeCrossRegionDisasterRecovery populate(objectMap, "dataSafeStatus", a.DataSafeStatus) populate(objectMap, "dataStorageSizeInGbs", a.DataStorageSizeInGbs) populate(objectMap, "dataStorageSizeInTbs", a.DataStorageSizeInTbs) @@ -1351,6 +1146,7 @@ func (a AutonomousDatabaseProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "isPreview", a.IsPreview) populate(objectMap, "isPreviewVersionWithServiceTermsAccepted", a.IsPreviewVersionWithServiceTermsAccepted) populate(objectMap, "isRemoteDataGuardEnabled", a.IsRemoteDataGuardEnabled) + populate(objectMap, "isReplicateAutomaticBackups", a.IsReplicateAutomaticBackups) populate(objectMap, "licenseModel", a.LicenseModel) populate(objectMap, "lifecycleDetails", a.LifecycleDetails) populate(objectMap, "lifecycleState", a.LifecycleState) @@ -1373,15 +1169,22 @@ func (a AutonomousDatabaseProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "privateEndpointLabel", a.PrivateEndpointLabel) populate(objectMap, "provisionableCpus", a.ProvisionableCpus) populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "remoteDisasterRecoveryConfiguration", a.RemoteDisasterRecoveryConfiguration) + populate(objectMap, "remoteDisasterRecoveryType", a.RemoteDisasterRecoveryType) populate(objectMap, "role", a.Role) populate(objectMap, "sqlWebDeveloperUrl", a.SQLWebDeveloperURL) populate(objectMap, "scheduledOperations", a.ScheduledOperations) populate(objectMap, "serviceConsoleUrl", a.ServiceConsoleURL) + objectMap["source"] = SourceTypeCrossRegionDisasterRecovery + populate(objectMap, "sourceId", a.SourceID) + populate(objectMap, "sourceLocation", a.SourceLocation) + populate(objectMap, "sourceOcid", a.SourceOcid) populate(objectMap, "subnetId", a.SubnetID) populate(objectMap, "supportedRegionsToCloneTo", a.SupportedRegionsToCloneTo) populateDateTimeRFC3339(objectMap, "timeCreated", a.TimeCreated) populate(objectMap, "timeDataGuardRoleChanged", a.TimeDataGuardRoleChanged) populate(objectMap, "timeDeletionOfFreeAutonomousDatabase", a.TimeDeletionOfFreeAutonomousDatabase) + populateDateTimeRFC3339(objectMap, "timeDisasterRecoveryRoleChanged", a.TimeDisasterRecoveryRoleChanged) populate(objectMap, "timeLocalDataGuardEnabled", a.TimeLocalDataGuardEnabled) populateDateTimeRFC3339(objectMap, "timeMaintenanceBegin", a.TimeMaintenanceBegin) populateDateTimeRFC3339(objectMap, "timeMaintenanceEnd", a.TimeMaintenanceEnd) @@ -1397,8 +1200,8 @@ func (a AutonomousDatabaseProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseProperties. -func (a *AutonomousDatabaseProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseCrossRegionDisasterRecoveryProperties. +func (a *AutonomousDatabaseCrossRegionDisasterRecoveryProperties) UnmarshalJSON(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) @@ -1502,6 +1305,9 @@ func (a *AutonomousDatabaseProperties) UnmarshalJSON(data []byte) error { case "isRemoteDataGuardEnabled": err = unpopulate(val, "IsRemoteDataGuardEnabled", &a.IsRemoteDataGuardEnabled) delete(rawMsg, key) + case "isReplicateAutomaticBackups": + err = unpopulate(val, "IsReplicateAutomaticBackups", &a.IsReplicateAutomaticBackups) + delete(rawMsg, key) case "licenseModel": err = unpopulate(val, "LicenseModel", &a.LicenseModel) delete(rawMsg, key) @@ -1568,6 +1374,12 @@ func (a *AutonomousDatabaseProperties) UnmarshalJSON(data []byte) error { case "provisioningState": err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) delete(rawMsg, key) + case "remoteDisasterRecoveryConfiguration": + err = unpopulate(val, "RemoteDisasterRecoveryConfiguration", &a.RemoteDisasterRecoveryConfiguration) + delete(rawMsg, key) + case "remoteDisasterRecoveryType": + err = unpopulate(val, "RemoteDisasterRecoveryType", &a.RemoteDisasterRecoveryType) + delete(rawMsg, key) case "role": err = unpopulate(val, "Role", &a.Role) delete(rawMsg, key) @@ -1580,6 +1392,18 @@ func (a *AutonomousDatabaseProperties) UnmarshalJSON(data []byte) error { case "serviceConsoleUrl": err = unpopulate(val, "ServiceConsoleURL", &a.ServiceConsoleURL) delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &a.Source) + delete(rawMsg, key) + case "sourceId": + err = unpopulate(val, "SourceID", &a.SourceID) + delete(rawMsg, key) + case "sourceLocation": + err = unpopulate(val, "SourceLocation", &a.SourceLocation) + delete(rawMsg, key) + case "sourceOcid": + err = unpopulate(val, "SourceOcid", &a.SourceOcid) + delete(rawMsg, key) case "subnetId": err = unpopulate(val, "SubnetID", &a.SubnetID) delete(rawMsg, key) @@ -1595,6 +1419,9 @@ func (a *AutonomousDatabaseProperties) UnmarshalJSON(data []byte) error { case "timeDeletionOfFreeAutonomousDatabase": err = unpopulate(val, "TimeDeletionOfFreeAutonomousDatabase", &a.TimeDeletionOfFreeAutonomousDatabase) delete(rawMsg, key) + case "timeDisasterRecoveryRoleChanged": + err = unpopulateDateTimeRFC3339(val, "TimeDisasterRecoveryRoleChanged", &a.TimeDisasterRecoveryRoleChanged) + delete(rawMsg, key) case "timeLocalDataGuardEnabled": err = unpopulate(val, "TimeLocalDataGuardEnabled", &a.TimeLocalDataGuardEnabled) delete(rawMsg, key) @@ -1639,111 +1466,96 @@ func (a *AutonomousDatabaseProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseStandbySummary. -func (a AutonomousDatabaseStandbySummary) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "lagTimeInSeconds", a.LagTimeInSeconds) - populate(objectMap, "lifecycleDetails", a.LifecycleDetails) - populate(objectMap, "lifecycleState", a.LifecycleState) - populate(objectMap, "timeDataGuardRoleChanged", a.TimeDataGuardRoleChanged) - populate(objectMap, "timeDisasterRecoveryRoleChanged", a.TimeDisasterRecoveryRoleChanged) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseStandbySummary. -func (a *AutonomousDatabaseStandbySummary) UnmarshalJSON(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 "lagTimeInSeconds": - err = unpopulate(val, "LagTimeInSeconds", &a.LagTimeInSeconds) - delete(rawMsg, key) - case "lifecycleDetails": - err = unpopulate(val, "LifecycleDetails", &a.LifecycleDetails) - delete(rawMsg, key) - case "lifecycleState": - err = unpopulate(val, "LifecycleState", &a.LifecycleState) - delete(rawMsg, key) - case "timeDataGuardRoleChanged": - err = unpopulate(val, "TimeDataGuardRoleChanged", &a.TimeDataGuardRoleChanged) - delete(rawMsg, key) - case "timeDisasterRecoveryRoleChanged": - err = unpopulate(val, "TimeDisasterRecoveryRoleChanged", &a.TimeDisasterRecoveryRoleChanged) - 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 AutonomousDatabaseUpdate. -func (a AutonomousDatabaseUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseUpdate. -func (a *AutonomousDatabaseUpdate) UnmarshalJSON(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 "properties": - err = unpopulate(val, "Properties", &a.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &a.Tags) - 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 AutonomousDatabaseUpdateProperties. -func (a AutonomousDatabaseUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseFromBackupTimestampProperties. +func (a AutonomousDatabaseFromBackupTimestampProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "actualUsedDataStorageSizeInTbs", a.ActualUsedDataStorageSizeInTbs) populate(objectMap, "adminPassword", a.AdminPassword) + populate(objectMap, "allocatedStorageSizeInTbs", a.AllocatedStorageSizeInTbs) + populate(objectMap, "apexDetails", a.ApexDetails) + populate(objectMap, "autonomousDatabaseId", a.AutonomousDatabaseID) populate(objectMap, "autonomousMaintenanceScheduleType", a.AutonomousMaintenanceScheduleType) + populate(objectMap, "availableUpgradeVersions", a.AvailableUpgradeVersions) populate(objectMap, "backupRetentionPeriodInDays", a.BackupRetentionPeriodInDays) populate(objectMap, "cpuCoreCount", a.CPUCoreCount) + populate(objectMap, "characterSet", a.CharacterSet) + populate(objectMap, "cloneType", a.CloneType) populate(objectMap, "computeCount", a.ComputeCount) + populate(objectMap, "computeModel", a.ComputeModel) + populate(objectMap, "connectionStrings", a.ConnectionStrings) + populate(objectMap, "connectionUrls", a.ConnectionUrls) populate(objectMap, "customerContacts", a.CustomerContacts) + objectMap["dataBaseType"] = DataBaseTypeCloneFromBackupTimestamp + populate(objectMap, "dataSafeStatus", a.DataSafeStatus) populate(objectMap, "dataStorageSizeInGbs", a.DataStorageSizeInGbs) populate(objectMap, "dataStorageSizeInTbs", a.DataStorageSizeInTbs) populate(objectMap, "databaseEdition", a.DatabaseEdition) + populate(objectMap, "dbVersion", a.DbVersion) + populate(objectMap, "dbWorkload", a.DbWorkload) populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "failedDataRecoveryInSeconds", a.FailedDataRecoveryInSeconds) + populate(objectMap, "inMemoryAreaInGbs", a.InMemoryAreaInGbs) populate(objectMap, "isAutoScalingEnabled", a.IsAutoScalingEnabled) populate(objectMap, "isAutoScalingForStorageEnabled", a.IsAutoScalingForStorageEnabled) populate(objectMap, "isLocalDataGuardEnabled", a.IsLocalDataGuardEnabled) populate(objectMap, "isMtlsConnectionRequired", a.IsMtlsConnectionRequired) + populate(objectMap, "isPreview", a.IsPreview) + populate(objectMap, "isPreviewVersionWithServiceTermsAccepted", a.IsPreviewVersionWithServiceTermsAccepted) + populate(objectMap, "isRemoteDataGuardEnabled", a.IsRemoteDataGuardEnabled) populate(objectMap, "licenseModel", a.LicenseModel) + populate(objectMap, "lifecycleDetails", a.LifecycleDetails) + populate(objectMap, "lifecycleState", a.LifecycleState) populate(objectMap, "localAdgAutoFailoverMaxDataLossLimit", a.LocalAdgAutoFailoverMaxDataLossLimit) + populate(objectMap, "localDisasterRecoveryType", a.LocalDisasterRecoveryType) + populate(objectMap, "localStandbyDb", a.LocalStandbyDb) populate(objectMap, "longTermBackupSchedule", a.LongTermBackupSchedule) + populate(objectMap, "memoryPerOracleComputeUnitInGbs", a.MemoryPerOracleComputeUnitInGbs) + populate(objectMap, "ncharacterSet", a.NcharacterSet) + populateDateTimeRFC3339(objectMap, "nextLongTermBackupTimeStamp", a.NextLongTermBackupTimeStamp) + populate(objectMap, "ociUrl", a.OciURL) + populate(objectMap, "ocid", a.Ocid) populate(objectMap, "openMode", a.OpenMode) + populate(objectMap, "operationsInsightsStatus", a.OperationsInsightsStatus) populate(objectMap, "peerDbId", a.PeerDbID) + populate(objectMap, "peerDbIds", a.PeerDbIDs) populate(objectMap, "permissionLevel", a.PermissionLevel) + populate(objectMap, "privateEndpoint", a.PrivateEndpoint) + populate(objectMap, "privateEndpointIp", a.PrivateEndpointIP) + populate(objectMap, "privateEndpointLabel", a.PrivateEndpointLabel) + populate(objectMap, "provisionableCpus", a.ProvisionableCpus) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "remoteDisasterRecoveryConfiguration", a.RemoteDisasterRecoveryConfiguration) populate(objectMap, "role", a.Role) + populate(objectMap, "sqlWebDeveloperUrl", a.SQLWebDeveloperURL) populate(objectMap, "scheduledOperations", a.ScheduledOperations) + populate(objectMap, "serviceConsoleUrl", a.ServiceConsoleURL) + objectMap["source"] = SourceTypeBackupFromTimestamp + populate(objectMap, "sourceId", a.SourceID) + populate(objectMap, "subnetId", a.SubnetID) + populate(objectMap, "supportedRegionsToCloneTo", a.SupportedRegionsToCloneTo) + populateDateTimeRFC3339(objectMap, "timeCreated", a.TimeCreated) + populate(objectMap, "timeDataGuardRoleChanged", a.TimeDataGuardRoleChanged) + populate(objectMap, "timeDeletionOfFreeAutonomousDatabase", a.TimeDeletionOfFreeAutonomousDatabase) + populateDateTimeRFC3339(objectMap, "timeDisasterRecoveryRoleChanged", a.TimeDisasterRecoveryRoleChanged) + populate(objectMap, "timeLocalDataGuardEnabled", a.TimeLocalDataGuardEnabled) + populateDateTimeRFC3339(objectMap, "timeMaintenanceBegin", a.TimeMaintenanceBegin) + populateDateTimeRFC3339(objectMap, "timeMaintenanceEnd", a.TimeMaintenanceEnd) + populate(objectMap, "timeOfLastFailover", a.TimeOfLastFailover) + populate(objectMap, "timeOfLastRefresh", a.TimeOfLastRefresh) + populate(objectMap, "timeOfLastRefreshPoint", a.TimeOfLastRefreshPoint) + populate(objectMap, "timeOfLastSwitchover", a.TimeOfLastSwitchover) + populate(objectMap, "timeReclamationOfFreeAutonomousDatabase", a.TimeReclamationOfFreeAutonomousDatabase) + populateDateTimeRFC3339(objectMap, "timestamp", a.Timestamp) + populate(objectMap, "useLatestAvailableBackupTimeStamp", a.UseLatestAvailableBackupTimeStamp) + populate(objectMap, "usedDataStorageSizeInGbs", a.UsedDataStorageSizeInGbs) + populate(objectMap, "usedDataStorageSizeInTbs", a.UsedDataStorageSizeInTbs) + populate(objectMap, "vnetId", a.VnetID) populate(objectMap, "whitelistedIps", a.WhitelistedIPs) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseUpdateProperties. -func (a *AutonomousDatabaseUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseFromBackupTimestampProperties. +func (a *AutonomousDatabaseFromBackupTimestampProperties) UnmarshalJSON(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) @@ -1751,24 +1563,60 @@ func (a *AutonomousDatabaseUpdateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "actualUsedDataStorageSizeInTbs": + err = unpopulate(val, "ActualUsedDataStorageSizeInTbs", &a.ActualUsedDataStorageSizeInTbs) + delete(rawMsg, key) case "adminPassword": err = unpopulate(val, "AdminPassword", &a.AdminPassword) delete(rawMsg, key) + case "allocatedStorageSizeInTbs": + err = unpopulate(val, "AllocatedStorageSizeInTbs", &a.AllocatedStorageSizeInTbs) + delete(rawMsg, key) + case "apexDetails": + err = unpopulate(val, "ApexDetails", &a.ApexDetails) + delete(rawMsg, key) + case "autonomousDatabaseId": + err = unpopulate(val, "AutonomousDatabaseID", &a.AutonomousDatabaseID) + delete(rawMsg, key) case "autonomousMaintenanceScheduleType": err = unpopulate(val, "AutonomousMaintenanceScheduleType", &a.AutonomousMaintenanceScheduleType) delete(rawMsg, key) + case "availableUpgradeVersions": + err = unpopulate(val, "AvailableUpgradeVersions", &a.AvailableUpgradeVersions) + delete(rawMsg, key) case "backupRetentionPeriodInDays": err = unpopulate(val, "BackupRetentionPeriodInDays", &a.BackupRetentionPeriodInDays) delete(rawMsg, key) case "cpuCoreCount": err = unpopulate(val, "CPUCoreCount", &a.CPUCoreCount) delete(rawMsg, key) + case "characterSet": + err = unpopulate(val, "CharacterSet", &a.CharacterSet) + delete(rawMsg, key) + case "cloneType": + err = unpopulate(val, "CloneType", &a.CloneType) + delete(rawMsg, key) case "computeCount": err = unpopulate(val, "ComputeCount", &a.ComputeCount) delete(rawMsg, key) + case "computeModel": + err = unpopulate(val, "ComputeModel", &a.ComputeModel) + delete(rawMsg, key) + case "connectionStrings": + err = unpopulate(val, "ConnectionStrings", &a.ConnectionStrings) + delete(rawMsg, key) + case "connectionUrls": + err = unpopulate(val, "ConnectionUrls", &a.ConnectionUrls) + delete(rawMsg, key) case "customerContacts": err = unpopulate(val, "CustomerContacts", &a.CustomerContacts) delete(rawMsg, key) + case "dataBaseType": + err = unpopulate(val, "DataBaseType", &a.DataBaseType) + delete(rawMsg, key) + case "dataSafeStatus": + err = unpopulate(val, "DataSafeStatus", &a.DataSafeStatus) + delete(rawMsg, key) case "dataStorageSizeInGbs": err = unpopulate(val, "DataStorageSizeInGbs", &a.DataStorageSizeInGbs) delete(rawMsg, key) @@ -1778,9 +1626,21 @@ func (a *AutonomousDatabaseUpdateProperties) UnmarshalJSON(data []byte) error { case "databaseEdition": err = unpopulate(val, "DatabaseEdition", &a.DatabaseEdition) delete(rawMsg, key) + case "dbVersion": + err = unpopulate(val, "DbVersion", &a.DbVersion) + delete(rawMsg, key) + case "dbWorkload": + err = unpopulate(val, "DbWorkload", &a.DbWorkload) + delete(rawMsg, key) case "displayName": err = unpopulate(val, "DisplayName", &a.DisplayName) delete(rawMsg, key) + case "failedDataRecoveryInSeconds": + err = unpopulate(val, "FailedDataRecoveryInSeconds", &a.FailedDataRecoveryInSeconds) + delete(rawMsg, key) + case "inMemoryAreaInGbs": + err = unpopulate(val, "InMemoryAreaInGbs", &a.InMemoryAreaInGbs) + delete(rawMsg, key) case "isAutoScalingEnabled": err = unpopulate(val, "IsAutoScalingEnabled", &a.IsAutoScalingEnabled) delete(rawMsg, key) @@ -1793,102 +1653,161 @@ func (a *AutonomousDatabaseUpdateProperties) UnmarshalJSON(data []byte) error { case "isMtlsConnectionRequired": err = unpopulate(val, "IsMtlsConnectionRequired", &a.IsMtlsConnectionRequired) delete(rawMsg, key) + case "isPreview": + err = unpopulate(val, "IsPreview", &a.IsPreview) + delete(rawMsg, key) + case "isPreviewVersionWithServiceTermsAccepted": + err = unpopulate(val, "IsPreviewVersionWithServiceTermsAccepted", &a.IsPreviewVersionWithServiceTermsAccepted) + delete(rawMsg, key) + case "isRemoteDataGuardEnabled": + err = unpopulate(val, "IsRemoteDataGuardEnabled", &a.IsRemoteDataGuardEnabled) + delete(rawMsg, key) case "licenseModel": err = unpopulate(val, "LicenseModel", &a.LicenseModel) delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &a.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &a.LifecycleState) + delete(rawMsg, key) case "localAdgAutoFailoverMaxDataLossLimit": err = unpopulate(val, "LocalAdgAutoFailoverMaxDataLossLimit", &a.LocalAdgAutoFailoverMaxDataLossLimit) delete(rawMsg, key) + case "localDisasterRecoveryType": + err = unpopulate(val, "LocalDisasterRecoveryType", &a.LocalDisasterRecoveryType) + delete(rawMsg, key) + case "localStandbyDb": + err = unpopulate(val, "LocalStandbyDb", &a.LocalStandbyDb) + delete(rawMsg, key) case "longTermBackupSchedule": err = unpopulate(val, "LongTermBackupSchedule", &a.LongTermBackupSchedule) delete(rawMsg, key) + case "memoryPerOracleComputeUnitInGbs": + err = unpopulate(val, "MemoryPerOracleComputeUnitInGbs", &a.MemoryPerOracleComputeUnitInGbs) + delete(rawMsg, key) + case "ncharacterSet": + err = unpopulate(val, "NcharacterSet", &a.NcharacterSet) + delete(rawMsg, key) + case "nextLongTermBackupTimeStamp": + err = unpopulateDateTimeRFC3339(val, "NextLongTermBackupTimeStamp", &a.NextLongTermBackupTimeStamp) + delete(rawMsg, key) + case "ociUrl": + err = unpopulate(val, "OciURL", &a.OciURL) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &a.Ocid) + delete(rawMsg, key) case "openMode": err = unpopulate(val, "OpenMode", &a.OpenMode) delete(rawMsg, key) + case "operationsInsightsStatus": + err = unpopulate(val, "OperationsInsightsStatus", &a.OperationsInsightsStatus) + delete(rawMsg, key) case "peerDbId": err = unpopulate(val, "PeerDbID", &a.PeerDbID) delete(rawMsg, key) + case "peerDbIds": + err = unpopulate(val, "PeerDbIDs", &a.PeerDbIDs) + delete(rawMsg, key) case "permissionLevel": err = unpopulate(val, "PermissionLevel", &a.PermissionLevel) delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &a.PrivateEndpoint) + delete(rawMsg, key) + case "privateEndpointIp": + err = unpopulate(val, "PrivateEndpointIP", &a.PrivateEndpointIP) + delete(rawMsg, key) + case "privateEndpointLabel": + err = unpopulate(val, "PrivateEndpointLabel", &a.PrivateEndpointLabel) + delete(rawMsg, key) + case "provisionableCpus": + err = unpopulate(val, "ProvisionableCpus", &a.ProvisionableCpus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "remoteDisasterRecoveryConfiguration": + err = unpopulate(val, "RemoteDisasterRecoveryConfiguration", &a.RemoteDisasterRecoveryConfiguration) + delete(rawMsg, key) case "role": err = unpopulate(val, "Role", &a.Role) delete(rawMsg, key) + case "sqlWebDeveloperUrl": + err = unpopulate(val, "SQLWebDeveloperURL", &a.SQLWebDeveloperURL) + delete(rawMsg, key) case "scheduledOperations": err = unpopulate(val, "ScheduledOperations", &a.ScheduledOperations) delete(rawMsg, key) - case "whitelistedIps": - err = unpopulate(val, "WhitelistedIPs", &a.WhitelistedIPs) + case "serviceConsoleUrl": + err = unpopulate(val, "ServiceConsoleURL", &a.ServiceConsoleURL) 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 AutonomousDatabaseWalletFile. -func (a AutonomousDatabaseWalletFile) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "walletFiles", a.WalletFiles) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseWalletFile. -func (a *AutonomousDatabaseWalletFile) UnmarshalJSON(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 "walletFiles": - err = unpopulate(val, "WalletFiles", &a.WalletFiles) + case "source": + err = unpopulate(val, "Source", &a.Source) 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 AutonomousDbVersion. -func (a AutonomousDbVersion) 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 AutonomousDbVersion. -func (a *AutonomousDbVersion) UnmarshalJSON(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) + case "sourceId": + err = unpopulate(val, "SourceID", &a.SourceID) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &a.Name) + case "subnetId": + err = unpopulate(val, "SubnetID", &a.SubnetID) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &a.Properties) + case "supportedRegionsToCloneTo": + err = unpopulate(val, "SupportedRegionsToCloneTo", &a.SupportedRegionsToCloneTo) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &a.SystemData) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &a.TimeCreated) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &a.Type) + case "timeDataGuardRoleChanged": + err = unpopulate(val, "TimeDataGuardRoleChanged", &a.TimeDataGuardRoleChanged) + delete(rawMsg, key) + case "timeDeletionOfFreeAutonomousDatabase": + err = unpopulate(val, "TimeDeletionOfFreeAutonomousDatabase", &a.TimeDeletionOfFreeAutonomousDatabase) + delete(rawMsg, key) + case "timeDisasterRecoveryRoleChanged": + err = unpopulateDateTimeRFC3339(val, "TimeDisasterRecoveryRoleChanged", &a.TimeDisasterRecoveryRoleChanged) + delete(rawMsg, key) + case "timeLocalDataGuardEnabled": + err = unpopulate(val, "TimeLocalDataGuardEnabled", &a.TimeLocalDataGuardEnabled) + delete(rawMsg, key) + case "timeMaintenanceBegin": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceBegin", &a.TimeMaintenanceBegin) + delete(rawMsg, key) + case "timeMaintenanceEnd": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceEnd", &a.TimeMaintenanceEnd) + delete(rawMsg, key) + case "timeOfLastFailover": + err = unpopulate(val, "TimeOfLastFailover", &a.TimeOfLastFailover) + delete(rawMsg, key) + case "timeOfLastRefresh": + err = unpopulate(val, "TimeOfLastRefresh", &a.TimeOfLastRefresh) + delete(rawMsg, key) + case "timeOfLastRefreshPoint": + err = unpopulate(val, "TimeOfLastRefreshPoint", &a.TimeOfLastRefreshPoint) + delete(rawMsg, key) + case "timeOfLastSwitchover": + err = unpopulate(val, "TimeOfLastSwitchover", &a.TimeOfLastSwitchover) + delete(rawMsg, key) + case "timeReclamationOfFreeAutonomousDatabase": + err = unpopulate(val, "TimeReclamationOfFreeAutonomousDatabase", &a.TimeReclamationOfFreeAutonomousDatabase) + delete(rawMsg, key) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &a.Timestamp) + delete(rawMsg, key) + case "useLatestAvailableBackupTimeStamp": + err = unpopulate(val, "UseLatestAvailableBackupTimeStamp", &a.UseLatestAvailableBackupTimeStamp) + delete(rawMsg, key) + case "usedDataStorageSizeInGbs": + err = unpopulate(val, "UsedDataStorageSizeInGbs", &a.UsedDataStorageSizeInGbs) + delete(rawMsg, key) + case "usedDataStorageSizeInTbs": + err = unpopulate(val, "UsedDataStorageSizeInTbs", &a.UsedDataStorageSizeInTbs) + delete(rawMsg, key) + case "vnetId": + err = unpopulate(val, "VnetID", &a.VnetID) + delete(rawMsg, key) + case "whitelistedIps": + err = unpopulate(val, "WhitelistedIPs", &a.WhitelistedIPs) delete(rawMsg, key) } if err != nil { @@ -1898,16 +1817,16 @@ func (a *AutonomousDbVersion) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AutonomousDbVersionListResult. -func (a AutonomousDbVersionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseListResult. +func (a AutonomousDatabaseListResult) 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 AutonomousDbVersionListResult. -func (a *AutonomousDbVersionListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseListResult. +func (a *AutonomousDatabaseListResult) UnmarshalJSON(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) @@ -1929,20 +1848,19 @@ func (a *AutonomousDbVersionListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AutonomousDbVersionProperties. -func (a AutonomousDbVersionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseNationalCharacterSet. +func (a AutonomousDatabaseNationalCharacterSet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dbWorkload", a.DbWorkload) - populate(objectMap, "isDefaultForFree", a.IsDefaultForFree) - populate(objectMap, "isDefaultForPaid", a.IsDefaultForPaid) - populate(objectMap, "isFreeTierEnabled", a.IsFreeTierEnabled) - populate(objectMap, "isPaidEnabled", a.IsPaidEnabled) - populate(objectMap, "version", a.Version) + 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 AutonomousDbVersionProperties. -func (a *AutonomousDbVersionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseNationalCharacterSet. +func (a *AutonomousDatabaseNationalCharacterSet) UnmarshalJSON(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) @@ -1950,23 +1868,20 @@ func (a *AutonomousDbVersionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "dbWorkload": - err = unpopulate(val, "DbWorkload", &a.DbWorkload) - delete(rawMsg, key) - case "isDefaultForFree": - err = unpopulate(val, "IsDefaultForFree", &a.IsDefaultForFree) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "isDefaultForPaid": - err = unpopulate(val, "IsDefaultForPaid", &a.IsDefaultForPaid) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "isFreeTierEnabled": - err = unpopulate(val, "IsFreeTierEnabled", &a.IsFreeTierEnabled) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) - case "isPaidEnabled": - err = unpopulate(val, "IsPaidEnabled", &a.IsPaidEnabled) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &a.Version) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -1976,881 +1891,2577 @@ func (a *AutonomousDbVersionProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudAccountDetails. -func (c CloudAccountDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cloudAccountHomeRegion", c.CloudAccountHomeRegion) - populate(objectMap, "cloudAccountName", c.CloudAccountName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudAccountDetails. -func (c *CloudAccountDetails) UnmarshalJSON(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 "cloudAccountHomeRegion": - err = unpopulate(val, "CloudAccountHomeRegion", &c.CloudAccountHomeRegion) - delete(rawMsg, key) - case "cloudAccountName": - err = unpopulate(val, "CloudAccountName", &c.CloudAccountName) - 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 CloudExadataInfrastructure. -func (c CloudExadataInfrastructure) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseNationalCharacterSetListResult. +func (a AutonomousDatabaseNationalCharacterSetListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "type", c.Type) - populate(objectMap, "zones", c.Zones) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructure. -func (c *CloudExadataInfrastructure) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseNationalCharacterSetListResult. +func (a *AutonomousDatabaseNationalCharacterSetListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &c.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &c.Tags) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) delete(rawMsg, key) - case "zones": - err = unpopulate(val, "Zones", &c.Zones) + case "value": + err = unpopulate(val, "Value", &a.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudExadataInfrastructureListResult. -func (c CloudExadataInfrastructureListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseNationalCharacterSetProperties. +func (a AutonomousDatabaseNationalCharacterSetProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "characterSet", a.CharacterSet) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructureListResult. -func (c *CloudExadataInfrastructureListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseNationalCharacterSetProperties. +func (a *AutonomousDatabaseNationalCharacterSetProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + case "characterSet": + err = unpopulate(val, "CharacterSet", &a.CharacterSet) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudExadataInfrastructureProperties. -func (c CloudExadataInfrastructureProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AutonomousDatabaseProperties. +func (a AutonomousDatabaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "activatedStorageCount", c.ActivatedStorageCount) - populate(objectMap, "additionalStorageCount", c.AdditionalStorageCount) - populate(objectMap, "availableStorageSizeInGbs", c.AvailableStorageSizeInGbs) - populate(objectMap, "cpuCount", c.CPUCount) - populate(objectMap, "computeCount", c.ComputeCount) - populate(objectMap, "customerContacts", c.CustomerContacts) - populate(objectMap, "dataStorageSizeInTbs", c.DataStorageSizeInTbs) - populate(objectMap, "dbNodeStorageSizeInGbs", c.DbNodeStorageSizeInGbs) - populate(objectMap, "dbServerVersion", c.DbServerVersion) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "estimatedPatchingTime", c.EstimatedPatchingTime) - populate(objectMap, "lastMaintenanceRunId", c.LastMaintenanceRunID) - populate(objectMap, "lifecycleDetails", c.LifecycleDetails) - populate(objectMap, "lifecycleState", c.LifecycleState) - populate(objectMap, "maintenanceWindow", c.MaintenanceWindow) - populate(objectMap, "maxCpuCount", c.MaxCPUCount) - populate(objectMap, "maxDataStorageInTbs", c.MaxDataStorageInTbs) - populate(objectMap, "maxDbNodeStorageSizeInGbs", c.MaxDbNodeStorageSizeInGbs) - populate(objectMap, "maxMemoryInGbs", c.MaxMemoryInGbs) - populate(objectMap, "memorySizeInGbs", c.MemorySizeInGbs) - populate(objectMap, "monthlyDbServerVersion", c.MonthlyDbServerVersion) - populate(objectMap, "monthlyStorageServerVersion", c.MonthlyStorageServerVersion) - populate(objectMap, "nextMaintenanceRunId", c.NextMaintenanceRunID) - populate(objectMap, "ociUrl", c.OciURL) - populate(objectMap, "ocid", c.Ocid) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "shape", c.Shape) - populate(objectMap, "storageCount", c.StorageCount) - populate(objectMap, "storageServerVersion", c.StorageServerVersion) - populate(objectMap, "timeCreated", c.TimeCreated) - populate(objectMap, "totalStorageSizeInGbs", c.TotalStorageSizeInGbs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructureProperties. -func (c *CloudExadataInfrastructureProperties) UnmarshalJSON(data []byte) error { + populate(objectMap, "actualUsedDataStorageSizeInTbs", a.ActualUsedDataStorageSizeInTbs) + populate(objectMap, "adminPassword", a.AdminPassword) + populate(objectMap, "allocatedStorageSizeInTbs", a.AllocatedStorageSizeInTbs) + populate(objectMap, "apexDetails", a.ApexDetails) + populate(objectMap, "autonomousDatabaseId", a.AutonomousDatabaseID) + populate(objectMap, "autonomousMaintenanceScheduleType", a.AutonomousMaintenanceScheduleType) + populate(objectMap, "availableUpgradeVersions", a.AvailableUpgradeVersions) + populate(objectMap, "backupRetentionPeriodInDays", a.BackupRetentionPeriodInDays) + populate(objectMap, "cpuCoreCount", a.CPUCoreCount) + populate(objectMap, "characterSet", a.CharacterSet) + populate(objectMap, "computeCount", a.ComputeCount) + populate(objectMap, "computeModel", a.ComputeModel) + populate(objectMap, "connectionStrings", a.ConnectionStrings) + populate(objectMap, "connectionUrls", a.ConnectionUrls) + populate(objectMap, "customerContacts", a.CustomerContacts) + objectMap["dataBaseType"] = DataBaseTypeRegular + populate(objectMap, "dataSafeStatus", a.DataSafeStatus) + populate(objectMap, "dataStorageSizeInGbs", a.DataStorageSizeInGbs) + populate(objectMap, "dataStorageSizeInTbs", a.DataStorageSizeInTbs) + populate(objectMap, "databaseEdition", a.DatabaseEdition) + populate(objectMap, "dbVersion", a.DbVersion) + populate(objectMap, "dbWorkload", a.DbWorkload) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "failedDataRecoveryInSeconds", a.FailedDataRecoveryInSeconds) + populate(objectMap, "inMemoryAreaInGbs", a.InMemoryAreaInGbs) + populate(objectMap, "isAutoScalingEnabled", a.IsAutoScalingEnabled) + populate(objectMap, "isAutoScalingForStorageEnabled", a.IsAutoScalingForStorageEnabled) + populate(objectMap, "isLocalDataGuardEnabled", a.IsLocalDataGuardEnabled) + populate(objectMap, "isMtlsConnectionRequired", a.IsMtlsConnectionRequired) + populate(objectMap, "isPreview", a.IsPreview) + populate(objectMap, "isPreviewVersionWithServiceTermsAccepted", a.IsPreviewVersionWithServiceTermsAccepted) + populate(objectMap, "isRemoteDataGuardEnabled", a.IsRemoteDataGuardEnabled) + populate(objectMap, "licenseModel", a.LicenseModel) + populate(objectMap, "lifecycleDetails", a.LifecycleDetails) + populate(objectMap, "lifecycleState", a.LifecycleState) + populate(objectMap, "localAdgAutoFailoverMaxDataLossLimit", a.LocalAdgAutoFailoverMaxDataLossLimit) + populate(objectMap, "localDisasterRecoveryType", a.LocalDisasterRecoveryType) + populate(objectMap, "localStandbyDb", a.LocalStandbyDb) + populate(objectMap, "longTermBackupSchedule", a.LongTermBackupSchedule) + populate(objectMap, "memoryPerOracleComputeUnitInGbs", a.MemoryPerOracleComputeUnitInGbs) + populate(objectMap, "ncharacterSet", a.NcharacterSet) + populateDateTimeRFC3339(objectMap, "nextLongTermBackupTimeStamp", a.NextLongTermBackupTimeStamp) + populate(objectMap, "ociUrl", a.OciURL) + populate(objectMap, "ocid", a.Ocid) + populate(objectMap, "openMode", a.OpenMode) + populate(objectMap, "operationsInsightsStatus", a.OperationsInsightsStatus) + populate(objectMap, "peerDbId", a.PeerDbID) + populate(objectMap, "peerDbIds", a.PeerDbIDs) + populate(objectMap, "permissionLevel", a.PermissionLevel) + populate(objectMap, "privateEndpoint", a.PrivateEndpoint) + populate(objectMap, "privateEndpointIp", a.PrivateEndpointIP) + populate(objectMap, "privateEndpointLabel", a.PrivateEndpointLabel) + populate(objectMap, "provisionableCpus", a.ProvisionableCpus) + populate(objectMap, "provisioningState", a.ProvisioningState) + populate(objectMap, "remoteDisasterRecoveryConfiguration", a.RemoteDisasterRecoveryConfiguration) + populate(objectMap, "role", a.Role) + populate(objectMap, "sqlWebDeveloperUrl", a.SQLWebDeveloperURL) + populate(objectMap, "scheduledOperations", a.ScheduledOperations) + populate(objectMap, "serviceConsoleUrl", a.ServiceConsoleURL) + populate(objectMap, "subnetId", a.SubnetID) + populate(objectMap, "supportedRegionsToCloneTo", a.SupportedRegionsToCloneTo) + populateDateTimeRFC3339(objectMap, "timeCreated", a.TimeCreated) + populate(objectMap, "timeDataGuardRoleChanged", a.TimeDataGuardRoleChanged) + populate(objectMap, "timeDeletionOfFreeAutonomousDatabase", a.TimeDeletionOfFreeAutonomousDatabase) + populateDateTimeRFC3339(objectMap, "timeDisasterRecoveryRoleChanged", a.TimeDisasterRecoveryRoleChanged) + populate(objectMap, "timeLocalDataGuardEnabled", a.TimeLocalDataGuardEnabled) + populateDateTimeRFC3339(objectMap, "timeMaintenanceBegin", a.TimeMaintenanceBegin) + populateDateTimeRFC3339(objectMap, "timeMaintenanceEnd", a.TimeMaintenanceEnd) + populate(objectMap, "timeOfLastFailover", a.TimeOfLastFailover) + populate(objectMap, "timeOfLastRefresh", a.TimeOfLastRefresh) + populate(objectMap, "timeOfLastRefreshPoint", a.TimeOfLastRefreshPoint) + populate(objectMap, "timeOfLastSwitchover", a.TimeOfLastSwitchover) + populate(objectMap, "timeReclamationOfFreeAutonomousDatabase", a.TimeReclamationOfFreeAutonomousDatabase) + populate(objectMap, "usedDataStorageSizeInGbs", a.UsedDataStorageSizeInGbs) + populate(objectMap, "usedDataStorageSizeInTbs", a.UsedDataStorageSizeInTbs) + populate(objectMap, "vnetId", a.VnetID) + populate(objectMap, "whitelistedIps", a.WhitelistedIPs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseProperties. +func (a *AutonomousDatabaseProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", a, err) } for key, val := range rawMsg { var err error switch key { - case "activatedStorageCount": - err = unpopulate(val, "ActivatedStorageCount", &c.ActivatedStorageCount) + case "actualUsedDataStorageSizeInTbs": + err = unpopulate(val, "ActualUsedDataStorageSizeInTbs", &a.ActualUsedDataStorageSizeInTbs) delete(rawMsg, key) - case "additionalStorageCount": - err = unpopulate(val, "AdditionalStorageCount", &c.AdditionalStorageCount) + case "adminPassword": + err = unpopulate(val, "AdminPassword", &a.AdminPassword) delete(rawMsg, key) - case "availableStorageSizeInGbs": - err = unpopulate(val, "AvailableStorageSizeInGbs", &c.AvailableStorageSizeInGbs) + case "allocatedStorageSizeInTbs": + err = unpopulate(val, "AllocatedStorageSizeInTbs", &a.AllocatedStorageSizeInTbs) delete(rawMsg, key) - case "cpuCount": - err = unpopulate(val, "CPUCount", &c.CPUCount) + case "apexDetails": + err = unpopulate(val, "ApexDetails", &a.ApexDetails) + delete(rawMsg, key) + case "autonomousDatabaseId": + err = unpopulate(val, "AutonomousDatabaseID", &a.AutonomousDatabaseID) + delete(rawMsg, key) + case "autonomousMaintenanceScheduleType": + err = unpopulate(val, "AutonomousMaintenanceScheduleType", &a.AutonomousMaintenanceScheduleType) + delete(rawMsg, key) + case "availableUpgradeVersions": + err = unpopulate(val, "AvailableUpgradeVersions", &a.AvailableUpgradeVersions) + delete(rawMsg, key) + case "backupRetentionPeriodInDays": + err = unpopulate(val, "BackupRetentionPeriodInDays", &a.BackupRetentionPeriodInDays) + delete(rawMsg, key) + case "cpuCoreCount": + err = unpopulate(val, "CPUCoreCount", &a.CPUCoreCount) + delete(rawMsg, key) + case "characterSet": + err = unpopulate(val, "CharacterSet", &a.CharacterSet) delete(rawMsg, key) case "computeCount": - err = unpopulate(val, "ComputeCount", &c.ComputeCount) + err = unpopulate(val, "ComputeCount", &a.ComputeCount) + delete(rawMsg, key) + case "computeModel": + err = unpopulate(val, "ComputeModel", &a.ComputeModel) + delete(rawMsg, key) + case "connectionStrings": + err = unpopulate(val, "ConnectionStrings", &a.ConnectionStrings) + delete(rawMsg, key) + case "connectionUrls": + err = unpopulate(val, "ConnectionUrls", &a.ConnectionUrls) delete(rawMsg, key) case "customerContacts": - err = unpopulate(val, "CustomerContacts", &c.CustomerContacts) + err = unpopulate(val, "CustomerContacts", &a.CustomerContacts) + delete(rawMsg, key) + case "dataBaseType": + err = unpopulate(val, "DataBaseType", &a.DataBaseType) + delete(rawMsg, key) + case "dataSafeStatus": + err = unpopulate(val, "DataSafeStatus", &a.DataSafeStatus) + delete(rawMsg, key) + case "dataStorageSizeInGbs": + err = unpopulate(val, "DataStorageSizeInGbs", &a.DataStorageSizeInGbs) delete(rawMsg, key) case "dataStorageSizeInTbs": - err = unpopulate(val, "DataStorageSizeInTbs", &c.DataStorageSizeInTbs) + err = unpopulate(val, "DataStorageSizeInTbs", &a.DataStorageSizeInTbs) delete(rawMsg, key) - case "dbNodeStorageSizeInGbs": - err = unpopulate(val, "DbNodeStorageSizeInGbs", &c.DbNodeStorageSizeInGbs) + case "databaseEdition": + err = unpopulate(val, "DatabaseEdition", &a.DatabaseEdition) delete(rawMsg, key) - case "dbServerVersion": - err = unpopulate(val, "DbServerVersion", &c.DbServerVersion) + case "dbVersion": + err = unpopulate(val, "DbVersion", &a.DbVersion) + delete(rawMsg, key) + case "dbWorkload": + err = unpopulate(val, "DbWorkload", &a.DbWorkload) delete(rawMsg, key) case "displayName": - err = unpopulate(val, "DisplayName", &c.DisplayName) + err = unpopulate(val, "DisplayName", &a.DisplayName) delete(rawMsg, key) - case "estimatedPatchingTime": - err = unpopulate(val, "EstimatedPatchingTime", &c.EstimatedPatchingTime) + case "failedDataRecoveryInSeconds": + err = unpopulate(val, "FailedDataRecoveryInSeconds", &a.FailedDataRecoveryInSeconds) delete(rawMsg, key) - case "lastMaintenanceRunId": - err = unpopulate(val, "LastMaintenanceRunID", &c.LastMaintenanceRunID) + case "inMemoryAreaInGbs": + err = unpopulate(val, "InMemoryAreaInGbs", &a.InMemoryAreaInGbs) delete(rawMsg, key) - case "lifecycleDetails": - err = unpopulate(val, "LifecycleDetails", &c.LifecycleDetails) + case "isAutoScalingEnabled": + err = unpopulate(val, "IsAutoScalingEnabled", &a.IsAutoScalingEnabled) delete(rawMsg, key) - case "lifecycleState": - err = unpopulate(val, "LifecycleState", &c.LifecycleState) + case "isAutoScalingForStorageEnabled": + err = unpopulate(val, "IsAutoScalingForStorageEnabled", &a.IsAutoScalingForStorageEnabled) delete(rawMsg, key) - case "maintenanceWindow": - err = unpopulate(val, "MaintenanceWindow", &c.MaintenanceWindow) + case "isLocalDataGuardEnabled": + err = unpopulate(val, "IsLocalDataGuardEnabled", &a.IsLocalDataGuardEnabled) delete(rawMsg, key) - case "maxCpuCount": - err = unpopulate(val, "MaxCPUCount", &c.MaxCPUCount) + case "isMtlsConnectionRequired": + err = unpopulate(val, "IsMtlsConnectionRequired", &a.IsMtlsConnectionRequired) delete(rawMsg, key) - case "maxDataStorageInTbs": - err = unpopulate(val, "MaxDataStorageInTbs", &c.MaxDataStorageInTbs) + case "isPreview": + err = unpopulate(val, "IsPreview", &a.IsPreview) delete(rawMsg, key) - case "maxDbNodeStorageSizeInGbs": - err = unpopulate(val, "MaxDbNodeStorageSizeInGbs", &c.MaxDbNodeStorageSizeInGbs) + case "isPreviewVersionWithServiceTermsAccepted": + err = unpopulate(val, "IsPreviewVersionWithServiceTermsAccepted", &a.IsPreviewVersionWithServiceTermsAccepted) delete(rawMsg, key) - case "maxMemoryInGbs": - err = unpopulate(val, "MaxMemoryInGbs", &c.MaxMemoryInGbs) + case "isRemoteDataGuardEnabled": + err = unpopulate(val, "IsRemoteDataGuardEnabled", &a.IsRemoteDataGuardEnabled) delete(rawMsg, key) - case "memorySizeInGbs": - err = unpopulate(val, "MemorySizeInGbs", &c.MemorySizeInGbs) + case "licenseModel": + err = unpopulate(val, "LicenseModel", &a.LicenseModel) delete(rawMsg, key) - case "monthlyDbServerVersion": - err = unpopulate(val, "MonthlyDbServerVersion", &c.MonthlyDbServerVersion) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &a.LifecycleDetails) delete(rawMsg, key) - case "monthlyStorageServerVersion": - err = unpopulate(val, "MonthlyStorageServerVersion", &c.MonthlyStorageServerVersion) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &a.LifecycleState) delete(rawMsg, key) - case "nextMaintenanceRunId": - err = unpopulate(val, "NextMaintenanceRunID", &c.NextMaintenanceRunID) + case "localAdgAutoFailoverMaxDataLossLimit": + err = unpopulate(val, "LocalAdgAutoFailoverMaxDataLossLimit", &a.LocalAdgAutoFailoverMaxDataLossLimit) + delete(rawMsg, key) + case "localDisasterRecoveryType": + err = unpopulate(val, "LocalDisasterRecoveryType", &a.LocalDisasterRecoveryType) + delete(rawMsg, key) + case "localStandbyDb": + err = unpopulate(val, "LocalStandbyDb", &a.LocalStandbyDb) + delete(rawMsg, key) + case "longTermBackupSchedule": + err = unpopulate(val, "LongTermBackupSchedule", &a.LongTermBackupSchedule) + delete(rawMsg, key) + case "memoryPerOracleComputeUnitInGbs": + err = unpopulate(val, "MemoryPerOracleComputeUnitInGbs", &a.MemoryPerOracleComputeUnitInGbs) + delete(rawMsg, key) + case "ncharacterSet": + err = unpopulate(val, "NcharacterSet", &a.NcharacterSet) + delete(rawMsg, key) + case "nextLongTermBackupTimeStamp": + err = unpopulateDateTimeRFC3339(val, "NextLongTermBackupTimeStamp", &a.NextLongTermBackupTimeStamp) delete(rawMsg, key) case "ociUrl": - err = unpopulate(val, "OciURL", &c.OciURL) + err = unpopulate(val, "OciURL", &a.OciURL) delete(rawMsg, key) case "ocid": - err = unpopulate(val, "Ocid", &c.Ocid) + err = unpopulate(val, "Ocid", &a.Ocid) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + case "openMode": + err = unpopulate(val, "OpenMode", &a.OpenMode) delete(rawMsg, key) - case "shape": - err = unpopulate(val, "Shape", &c.Shape) + case "operationsInsightsStatus": + err = unpopulate(val, "OperationsInsightsStatus", &a.OperationsInsightsStatus) delete(rawMsg, key) - case "storageCount": - err = unpopulate(val, "StorageCount", &c.StorageCount) + case "peerDbId": + err = unpopulate(val, "PeerDbID", &a.PeerDbID) delete(rawMsg, key) - case "storageServerVersion": - err = unpopulate(val, "StorageServerVersion", &c.StorageServerVersion) + case "peerDbIds": + err = unpopulate(val, "PeerDbIDs", &a.PeerDbIDs) + delete(rawMsg, key) + case "permissionLevel": + err = unpopulate(val, "PermissionLevel", &a.PermissionLevel) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &a.PrivateEndpoint) + delete(rawMsg, key) + case "privateEndpointIp": + err = unpopulate(val, "PrivateEndpointIP", &a.PrivateEndpointIP) + delete(rawMsg, key) + case "privateEndpointLabel": + err = unpopulate(val, "PrivateEndpointLabel", &a.PrivateEndpointLabel) + delete(rawMsg, key) + case "provisionableCpus": + err = unpopulate(val, "ProvisionableCpus", &a.ProvisionableCpus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &a.ProvisioningState) + delete(rawMsg, key) + case "remoteDisasterRecoveryConfiguration": + err = unpopulate(val, "RemoteDisasterRecoveryConfiguration", &a.RemoteDisasterRecoveryConfiguration) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &a.Role) + delete(rawMsg, key) + case "sqlWebDeveloperUrl": + err = unpopulate(val, "SQLWebDeveloperURL", &a.SQLWebDeveloperURL) + delete(rawMsg, key) + case "scheduledOperations": + err = unpopulate(val, "ScheduledOperations", &a.ScheduledOperations) + delete(rawMsg, key) + case "serviceConsoleUrl": + err = unpopulate(val, "ServiceConsoleURL", &a.ServiceConsoleURL) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &a.SubnetID) + delete(rawMsg, key) + case "supportedRegionsToCloneTo": + err = unpopulate(val, "SupportedRegionsToCloneTo", &a.SupportedRegionsToCloneTo) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &a.TimeCreated) + delete(rawMsg, key) + case "timeDataGuardRoleChanged": + err = unpopulate(val, "TimeDataGuardRoleChanged", &a.TimeDataGuardRoleChanged) + delete(rawMsg, key) + case "timeDeletionOfFreeAutonomousDatabase": + err = unpopulate(val, "TimeDeletionOfFreeAutonomousDatabase", &a.TimeDeletionOfFreeAutonomousDatabase) + delete(rawMsg, key) + case "timeDisasterRecoveryRoleChanged": + err = unpopulateDateTimeRFC3339(val, "TimeDisasterRecoveryRoleChanged", &a.TimeDisasterRecoveryRoleChanged) + delete(rawMsg, key) + case "timeLocalDataGuardEnabled": + err = unpopulate(val, "TimeLocalDataGuardEnabled", &a.TimeLocalDataGuardEnabled) + delete(rawMsg, key) + case "timeMaintenanceBegin": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceBegin", &a.TimeMaintenanceBegin) + delete(rawMsg, key) + case "timeMaintenanceEnd": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceEnd", &a.TimeMaintenanceEnd) + delete(rawMsg, key) + case "timeOfLastFailover": + err = unpopulate(val, "TimeOfLastFailover", &a.TimeOfLastFailover) + delete(rawMsg, key) + case "timeOfLastRefresh": + err = unpopulate(val, "TimeOfLastRefresh", &a.TimeOfLastRefresh) + delete(rawMsg, key) + case "timeOfLastRefreshPoint": + err = unpopulate(val, "TimeOfLastRefreshPoint", &a.TimeOfLastRefreshPoint) + delete(rawMsg, key) + case "timeOfLastSwitchover": + err = unpopulate(val, "TimeOfLastSwitchover", &a.TimeOfLastSwitchover) + delete(rawMsg, key) + case "timeReclamationOfFreeAutonomousDatabase": + err = unpopulate(val, "TimeReclamationOfFreeAutonomousDatabase", &a.TimeReclamationOfFreeAutonomousDatabase) + delete(rawMsg, key) + case "usedDataStorageSizeInGbs": + err = unpopulate(val, "UsedDataStorageSizeInGbs", &a.UsedDataStorageSizeInGbs) + delete(rawMsg, key) + case "usedDataStorageSizeInTbs": + err = unpopulate(val, "UsedDataStorageSizeInTbs", &a.UsedDataStorageSizeInTbs) + delete(rawMsg, key) + case "vnetId": + err = unpopulate(val, "VnetID", &a.VnetID) + delete(rawMsg, key) + case "whitelistedIps": + err = unpopulate(val, "WhitelistedIPs", &a.WhitelistedIPs) + 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 AutonomousDatabaseStandbySummary. +func (a AutonomousDatabaseStandbySummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "lagTimeInSeconds", a.LagTimeInSeconds) + populate(objectMap, "lifecycleDetails", a.LifecycleDetails) + populate(objectMap, "lifecycleState", a.LifecycleState) + populate(objectMap, "timeDataGuardRoleChanged", a.TimeDataGuardRoleChanged) + populate(objectMap, "timeDisasterRecoveryRoleChanged", a.TimeDisasterRecoveryRoleChanged) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseStandbySummary. +func (a *AutonomousDatabaseStandbySummary) UnmarshalJSON(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 "lagTimeInSeconds": + err = unpopulate(val, "LagTimeInSeconds", &a.LagTimeInSeconds) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &a.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &a.LifecycleState) + delete(rawMsg, key) + case "timeDataGuardRoleChanged": + err = unpopulate(val, "TimeDataGuardRoleChanged", &a.TimeDataGuardRoleChanged) + delete(rawMsg, key) + case "timeDisasterRecoveryRoleChanged": + err = unpopulate(val, "TimeDisasterRecoveryRoleChanged", &a.TimeDisasterRecoveryRoleChanged) + 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 AutonomousDatabaseUpdate. +func (a AutonomousDatabaseUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseUpdate. +func (a *AutonomousDatabaseUpdate) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &a.Tags) + 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 AutonomousDatabaseUpdateProperties. +func (a AutonomousDatabaseUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "adminPassword", a.AdminPassword) + populate(objectMap, "autonomousMaintenanceScheduleType", a.AutonomousMaintenanceScheduleType) + populate(objectMap, "backupRetentionPeriodInDays", a.BackupRetentionPeriodInDays) + populate(objectMap, "cpuCoreCount", a.CPUCoreCount) + populate(objectMap, "computeCount", a.ComputeCount) + populate(objectMap, "customerContacts", a.CustomerContacts) + populate(objectMap, "dataStorageSizeInGbs", a.DataStorageSizeInGbs) + populate(objectMap, "dataStorageSizeInTbs", a.DataStorageSizeInTbs) + populate(objectMap, "databaseEdition", a.DatabaseEdition) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "isAutoScalingEnabled", a.IsAutoScalingEnabled) + populate(objectMap, "isAutoScalingForStorageEnabled", a.IsAutoScalingForStorageEnabled) + populate(objectMap, "isLocalDataGuardEnabled", a.IsLocalDataGuardEnabled) + populate(objectMap, "isMtlsConnectionRequired", a.IsMtlsConnectionRequired) + populate(objectMap, "licenseModel", a.LicenseModel) + populate(objectMap, "localAdgAutoFailoverMaxDataLossLimit", a.LocalAdgAutoFailoverMaxDataLossLimit) + populate(objectMap, "longTermBackupSchedule", a.LongTermBackupSchedule) + populate(objectMap, "openMode", a.OpenMode) + populate(objectMap, "peerDbId", a.PeerDbID) + populate(objectMap, "permissionLevel", a.PermissionLevel) + populate(objectMap, "role", a.Role) + populate(objectMap, "scheduledOperations", a.ScheduledOperations) + populate(objectMap, "whitelistedIps", a.WhitelistedIPs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseUpdateProperties. +func (a *AutonomousDatabaseUpdateProperties) UnmarshalJSON(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 "adminPassword": + err = unpopulate(val, "AdminPassword", &a.AdminPassword) + delete(rawMsg, key) + case "autonomousMaintenanceScheduleType": + err = unpopulate(val, "AutonomousMaintenanceScheduleType", &a.AutonomousMaintenanceScheduleType) + delete(rawMsg, key) + case "backupRetentionPeriodInDays": + err = unpopulate(val, "BackupRetentionPeriodInDays", &a.BackupRetentionPeriodInDays) + delete(rawMsg, key) + case "cpuCoreCount": + err = unpopulate(val, "CPUCoreCount", &a.CPUCoreCount) + delete(rawMsg, key) + case "computeCount": + err = unpopulate(val, "ComputeCount", &a.ComputeCount) + delete(rawMsg, key) + case "customerContacts": + err = unpopulate(val, "CustomerContacts", &a.CustomerContacts) + delete(rawMsg, key) + case "dataStorageSizeInGbs": + err = unpopulate(val, "DataStorageSizeInGbs", &a.DataStorageSizeInGbs) + delete(rawMsg, key) + case "dataStorageSizeInTbs": + err = unpopulate(val, "DataStorageSizeInTbs", &a.DataStorageSizeInTbs) + delete(rawMsg, key) + case "databaseEdition": + err = unpopulate(val, "DatabaseEdition", &a.DatabaseEdition) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "isAutoScalingEnabled": + err = unpopulate(val, "IsAutoScalingEnabled", &a.IsAutoScalingEnabled) + delete(rawMsg, key) + case "isAutoScalingForStorageEnabled": + err = unpopulate(val, "IsAutoScalingForStorageEnabled", &a.IsAutoScalingForStorageEnabled) + delete(rawMsg, key) + case "isLocalDataGuardEnabled": + err = unpopulate(val, "IsLocalDataGuardEnabled", &a.IsLocalDataGuardEnabled) + delete(rawMsg, key) + case "isMtlsConnectionRequired": + err = unpopulate(val, "IsMtlsConnectionRequired", &a.IsMtlsConnectionRequired) + delete(rawMsg, key) + case "licenseModel": + err = unpopulate(val, "LicenseModel", &a.LicenseModel) + delete(rawMsg, key) + case "localAdgAutoFailoverMaxDataLossLimit": + err = unpopulate(val, "LocalAdgAutoFailoverMaxDataLossLimit", &a.LocalAdgAutoFailoverMaxDataLossLimit) + delete(rawMsg, key) + case "longTermBackupSchedule": + err = unpopulate(val, "LongTermBackupSchedule", &a.LongTermBackupSchedule) + delete(rawMsg, key) + case "openMode": + err = unpopulate(val, "OpenMode", &a.OpenMode) + delete(rawMsg, key) + case "peerDbId": + err = unpopulate(val, "PeerDbID", &a.PeerDbID) + delete(rawMsg, key) + case "permissionLevel": + err = unpopulate(val, "PermissionLevel", &a.PermissionLevel) + delete(rawMsg, key) + case "role": + err = unpopulate(val, "Role", &a.Role) + delete(rawMsg, key) + case "scheduledOperations": + err = unpopulate(val, "ScheduledOperations", &a.ScheduledOperations) + delete(rawMsg, key) + case "whitelistedIps": + err = unpopulate(val, "WhitelistedIPs", &a.WhitelistedIPs) + 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 AutonomousDatabaseWalletFile. +func (a AutonomousDatabaseWalletFile) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "walletFiles", a.WalletFiles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDatabaseWalletFile. +func (a *AutonomousDatabaseWalletFile) UnmarshalJSON(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 "walletFiles": + err = unpopulate(val, "WalletFiles", &a.WalletFiles) + 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 AutonomousDbVersion. +func (a AutonomousDbVersion) 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 AutonomousDbVersion. +func (a *AutonomousDbVersion) UnmarshalJSON(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 AutonomousDbVersionListResult. +func (a AutonomousDbVersionListResult) 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 AutonomousDbVersionListResult. +func (a *AutonomousDbVersionListResult) UnmarshalJSON(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 AutonomousDbVersionProperties. +func (a AutonomousDbVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dbWorkload", a.DbWorkload) + populate(objectMap, "isDefaultForFree", a.IsDefaultForFree) + populate(objectMap, "isDefaultForPaid", a.IsDefaultForPaid) + populate(objectMap, "isFreeTierEnabled", a.IsFreeTierEnabled) + populate(objectMap, "isPaidEnabled", a.IsPaidEnabled) + populate(objectMap, "version", a.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutonomousDbVersionProperties. +func (a *AutonomousDbVersionProperties) UnmarshalJSON(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 "dbWorkload": + err = unpopulate(val, "DbWorkload", &a.DbWorkload) + delete(rawMsg, key) + case "isDefaultForFree": + err = unpopulate(val, "IsDefaultForFree", &a.IsDefaultForFree) + delete(rawMsg, key) + case "isDefaultForPaid": + err = unpopulate(val, "IsDefaultForPaid", &a.IsDefaultForPaid) + delete(rawMsg, key) + case "isFreeTierEnabled": + err = unpopulate(val, "IsFreeTierEnabled", &a.IsFreeTierEnabled) + delete(rawMsg, key) + case "isPaidEnabled": + err = unpopulate(val, "IsPaidEnabled", &a.IsPaidEnabled) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &a.Version) + 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 AzureSubscriptions. +func (a AzureSubscriptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "azureSubscriptionIds", a.AzureSubscriptionIDs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureSubscriptions. +func (a *AzureSubscriptions) UnmarshalJSON(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 "azureSubscriptionIds": + err = unpopulate(val, "AzureSubscriptionIDs", &a.AzureSubscriptionIDs) + 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 CloudExadataInfrastructure. +func (c CloudExadataInfrastructure) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + populate(objectMap, "zones", c.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructure. +func (c *CloudExadataInfrastructure) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &c.Zones) + 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 CloudExadataInfrastructureListResult. +func (c CloudExadataInfrastructureListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructureListResult. +func (c *CloudExadataInfrastructureListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudExadataInfrastructureProperties. +func (c CloudExadataInfrastructureProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "activatedStorageCount", c.ActivatedStorageCount) + populate(objectMap, "additionalStorageCount", c.AdditionalStorageCount) + populate(objectMap, "availableStorageSizeInGbs", c.AvailableStorageSizeInGbs) + populate(objectMap, "cpuCount", c.CPUCount) + populate(objectMap, "computeCount", c.ComputeCount) + populate(objectMap, "computeModel", c.ComputeModel) + populate(objectMap, "customerContacts", c.CustomerContacts) + populate(objectMap, "dataStorageSizeInTbs", c.DataStorageSizeInTbs) + populate(objectMap, "databaseServerType", c.DatabaseServerType) + populate(objectMap, "dbNodeStorageSizeInGbs", c.DbNodeStorageSizeInGbs) + populate(objectMap, "dbServerVersion", c.DbServerVersion) + populate(objectMap, "definedFileSystemConfiguration", c.DefinedFileSystemConfiguration) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "estimatedPatchingTime", c.EstimatedPatchingTime) + populate(objectMap, "lastMaintenanceRunId", c.LastMaintenanceRunID) + populate(objectMap, "lifecycleDetails", c.LifecycleDetails) + populate(objectMap, "lifecycleState", c.LifecycleState) + populate(objectMap, "maintenanceWindow", c.MaintenanceWindow) + populate(objectMap, "maxCpuCount", c.MaxCPUCount) + populate(objectMap, "maxDataStorageInTbs", c.MaxDataStorageInTbs) + populate(objectMap, "maxDbNodeStorageSizeInGbs", c.MaxDbNodeStorageSizeInGbs) + populate(objectMap, "maxMemoryInGbs", c.MaxMemoryInGbs) + populate(objectMap, "memorySizeInGbs", c.MemorySizeInGbs) + populate(objectMap, "monthlyDbServerVersion", c.MonthlyDbServerVersion) + populate(objectMap, "monthlyStorageServerVersion", c.MonthlyStorageServerVersion) + populate(objectMap, "nextMaintenanceRunId", c.NextMaintenanceRunID) + populate(objectMap, "ociUrl", c.OciURL) + populate(objectMap, "ocid", c.Ocid) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "shape", c.Shape) + populate(objectMap, "storageCount", c.StorageCount) + populate(objectMap, "storageServerType", c.StorageServerType) + populate(objectMap, "storageServerVersion", c.StorageServerVersion) + populate(objectMap, "timeCreated", c.TimeCreated) + populate(objectMap, "totalStorageSizeInGbs", c.TotalStorageSizeInGbs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructureProperties. +func (c *CloudExadataInfrastructureProperties) UnmarshalJSON(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 "activatedStorageCount": + err = unpopulate(val, "ActivatedStorageCount", &c.ActivatedStorageCount) + delete(rawMsg, key) + case "additionalStorageCount": + err = unpopulate(val, "AdditionalStorageCount", &c.AdditionalStorageCount) + delete(rawMsg, key) + case "availableStorageSizeInGbs": + err = unpopulate(val, "AvailableStorageSizeInGbs", &c.AvailableStorageSizeInGbs) + delete(rawMsg, key) + case "cpuCount": + err = unpopulate(val, "CPUCount", &c.CPUCount) + delete(rawMsg, key) + case "computeCount": + err = unpopulate(val, "ComputeCount", &c.ComputeCount) + delete(rawMsg, key) + case "computeModel": + err = unpopulate(val, "ComputeModel", &c.ComputeModel) + delete(rawMsg, key) + case "customerContacts": + err = unpopulate(val, "CustomerContacts", &c.CustomerContacts) + delete(rawMsg, key) + case "dataStorageSizeInTbs": + err = unpopulate(val, "DataStorageSizeInTbs", &c.DataStorageSizeInTbs) + delete(rawMsg, key) + case "databaseServerType": + err = unpopulate(val, "DatabaseServerType", &c.DatabaseServerType) + delete(rawMsg, key) + case "dbNodeStorageSizeInGbs": + err = unpopulate(val, "DbNodeStorageSizeInGbs", &c.DbNodeStorageSizeInGbs) + delete(rawMsg, key) + case "dbServerVersion": + err = unpopulate(val, "DbServerVersion", &c.DbServerVersion) + delete(rawMsg, key) + case "definedFileSystemConfiguration": + err = unpopulate(val, "DefinedFileSystemConfiguration", &c.DefinedFileSystemConfiguration) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "estimatedPatchingTime": + err = unpopulate(val, "EstimatedPatchingTime", &c.EstimatedPatchingTime) + delete(rawMsg, key) + case "lastMaintenanceRunId": + err = unpopulate(val, "LastMaintenanceRunID", &c.LastMaintenanceRunID) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &c.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &c.LifecycleState) + delete(rawMsg, key) + case "maintenanceWindow": + err = unpopulate(val, "MaintenanceWindow", &c.MaintenanceWindow) + delete(rawMsg, key) + case "maxCpuCount": + err = unpopulate(val, "MaxCPUCount", &c.MaxCPUCount) + delete(rawMsg, key) + case "maxDataStorageInTbs": + err = unpopulate(val, "MaxDataStorageInTbs", &c.MaxDataStorageInTbs) + delete(rawMsg, key) + case "maxDbNodeStorageSizeInGbs": + err = unpopulate(val, "MaxDbNodeStorageSizeInGbs", &c.MaxDbNodeStorageSizeInGbs) + delete(rawMsg, key) + case "maxMemoryInGbs": + err = unpopulate(val, "MaxMemoryInGbs", &c.MaxMemoryInGbs) + delete(rawMsg, key) + case "memorySizeInGbs": + err = unpopulate(val, "MemorySizeInGbs", &c.MemorySizeInGbs) + delete(rawMsg, key) + case "monthlyDbServerVersion": + err = unpopulate(val, "MonthlyDbServerVersion", &c.MonthlyDbServerVersion) + delete(rawMsg, key) + case "monthlyStorageServerVersion": + err = unpopulate(val, "MonthlyStorageServerVersion", &c.MonthlyStorageServerVersion) + delete(rawMsg, key) + case "nextMaintenanceRunId": + err = unpopulate(val, "NextMaintenanceRunID", &c.NextMaintenanceRunID) + delete(rawMsg, key) + case "ociUrl": + err = unpopulate(val, "OciURL", &c.OciURL) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &c.Ocid) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "shape": + err = unpopulate(val, "Shape", &c.Shape) + delete(rawMsg, key) + case "storageCount": + err = unpopulate(val, "StorageCount", &c.StorageCount) + delete(rawMsg, key) + case "storageServerType": + err = unpopulate(val, "StorageServerType", &c.StorageServerType) + delete(rawMsg, key) + case "storageServerVersion": + err = unpopulate(val, "StorageServerVersion", &c.StorageServerVersion) + delete(rawMsg, key) + case "timeCreated": + err = unpopulate(val, "TimeCreated", &c.TimeCreated) + delete(rawMsg, key) + case "totalStorageSizeInGbs": + err = unpopulate(val, "TotalStorageSizeInGbs", &c.TotalStorageSizeInGbs) + 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 CloudExadataInfrastructureUpdate. +func (c CloudExadataInfrastructureUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "zones", c.Zones) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructureUpdate. +func (c *CloudExadataInfrastructureUpdate) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &c.Zones) + 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 CloudExadataInfrastructureUpdateProperties. +func (c CloudExadataInfrastructureUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "computeCount", c.ComputeCount) + populate(objectMap, "customerContacts", c.CustomerContacts) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "maintenanceWindow", c.MaintenanceWindow) + populate(objectMap, "storageCount", c.StorageCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructureUpdateProperties. +func (c *CloudExadataInfrastructureUpdateProperties) UnmarshalJSON(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 "computeCount": + err = unpopulate(val, "ComputeCount", &c.ComputeCount) + delete(rawMsg, key) + case "customerContacts": + err = unpopulate(val, "CustomerContacts", &c.CustomerContacts) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "maintenanceWindow": + err = unpopulate(val, "MaintenanceWindow", &c.MaintenanceWindow) + delete(rawMsg, key) + case "storageCount": + err = unpopulate(val, "StorageCount", &c.StorageCount) + 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 CloudVMCluster. +func (c CloudVMCluster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", c.ID) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMCluster. +func (c *CloudVMCluster) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudVMClusterListResult. +func (c CloudVMClusterListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMClusterListResult. +func (c *CloudVMClusterListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudVMClusterProperties. +func (c CloudVMClusterProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backupSubnetCidr", c.BackupSubnetCidr) + populate(objectMap, "cpuCoreCount", c.CPUCoreCount) + populate(objectMap, "cloudExadataInfrastructureId", c.CloudExadataInfrastructureID) + populate(objectMap, "clusterName", c.ClusterName) + populate(objectMap, "compartmentId", c.CompartmentID) + populate(objectMap, "computeModel", c.ComputeModel) + populate(objectMap, "computeNodes", c.ComputeNodes) + populate(objectMap, "dataCollectionOptions", c.DataCollectionOptions) + populate(objectMap, "dataStoragePercentage", c.DataStoragePercentage) + populate(objectMap, "dataStorageSizeInTbs", c.DataStorageSizeInTbs) + populate(objectMap, "dbNodeStorageSizeInGbs", c.DbNodeStorageSizeInGbs) + populate(objectMap, "dbServers", c.DbServers) + populate(objectMap, "diskRedundancy", c.DiskRedundancy) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "domain", c.Domain) + populate(objectMap, "fileSystemConfigurationDetails", c.FileSystemConfigurationDetails) + populate(objectMap, "giVersion", c.GiVersion) + populate(objectMap, "hostname", c.Hostname) + populate(objectMap, "iormConfigCache", c.IormConfigCache) + populate(objectMap, "isLocalBackupEnabled", c.IsLocalBackupEnabled) + populate(objectMap, "isSparseDiskgroupEnabled", c.IsSparseDiskgroupEnabled) + populate(objectMap, "lastUpdateHistoryEntryId", c.LastUpdateHistoryEntryID) + populate(objectMap, "licenseModel", c.LicenseModel) + populate(objectMap, "lifecycleDetails", c.LifecycleDetails) + populate(objectMap, "lifecycleState", c.LifecycleState) + populate(objectMap, "listenerPort", c.ListenerPort) + populate(objectMap, "memorySizeInGbs", c.MemorySizeInGbs) + populate(objectMap, "nodeCount", c.NodeCount) + populate(objectMap, "nsgCidrs", c.NsgCidrs) + populate(objectMap, "nsgUrl", c.NsgURL) + populate(objectMap, "ociUrl", c.OciURL) + populate(objectMap, "ocid", c.Ocid) + populate(objectMap, "ocpuCount", c.OcpuCount) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "sshPublicKeys", c.SSHPublicKeys) + populate(objectMap, "scanDnsName", c.ScanDNSName) + populate(objectMap, "scanDnsRecordId", c.ScanDNSRecordID) + populate(objectMap, "scanIpIds", c.ScanIPIDs) + populate(objectMap, "scanListenerPortTcp", c.ScanListenerPortTCP) + populate(objectMap, "scanListenerPortTcpSsl", c.ScanListenerPortTCPSSL) + populate(objectMap, "shape", c.Shape) + populate(objectMap, "storageSizeInGbs", c.StorageSizeInGbs) + populate(objectMap, "subnetId", c.SubnetID) + populate(objectMap, "subnetOcid", c.SubnetOcid) + populate(objectMap, "systemVersion", c.SystemVersion) + populateDateTimeRFC3339(objectMap, "timeCreated", c.TimeCreated) + populate(objectMap, "timeZone", c.TimeZone) + populate(objectMap, "vipIds", c.VipIDs) + populate(objectMap, "vnetId", c.VnetID) + populate(objectMap, "zoneId", c.ZoneID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMClusterProperties. +func (c *CloudVMClusterProperties) UnmarshalJSON(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 "backupSubnetCidr": + err = unpopulate(val, "BackupSubnetCidr", &c.BackupSubnetCidr) + delete(rawMsg, key) + case "cpuCoreCount": + err = unpopulate(val, "CPUCoreCount", &c.CPUCoreCount) + delete(rawMsg, key) + case "cloudExadataInfrastructureId": + err = unpopulate(val, "CloudExadataInfrastructureID", &c.CloudExadataInfrastructureID) + delete(rawMsg, key) + case "clusterName": + err = unpopulate(val, "ClusterName", &c.ClusterName) + delete(rawMsg, key) + case "compartmentId": + err = unpopulate(val, "CompartmentID", &c.CompartmentID) + delete(rawMsg, key) + case "computeModel": + err = unpopulate(val, "ComputeModel", &c.ComputeModel) + delete(rawMsg, key) + case "computeNodes": + err = unpopulate(val, "ComputeNodes", &c.ComputeNodes) + delete(rawMsg, key) + case "dataCollectionOptions": + err = unpopulate(val, "DataCollectionOptions", &c.DataCollectionOptions) + delete(rawMsg, key) + case "dataStoragePercentage": + err = unpopulate(val, "DataStoragePercentage", &c.DataStoragePercentage) + delete(rawMsg, key) + case "dataStorageSizeInTbs": + err = unpopulate(val, "DataStorageSizeInTbs", &c.DataStorageSizeInTbs) + delete(rawMsg, key) + case "dbNodeStorageSizeInGbs": + err = unpopulate(val, "DbNodeStorageSizeInGbs", &c.DbNodeStorageSizeInGbs) + delete(rawMsg, key) + case "dbServers": + err = unpopulate(val, "DbServers", &c.DbServers) + delete(rawMsg, key) + case "diskRedundancy": + err = unpopulate(val, "DiskRedundancy", &c.DiskRedundancy) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "domain": + err = unpopulate(val, "Domain", &c.Domain) + delete(rawMsg, key) + case "fileSystemConfigurationDetails": + err = unpopulate(val, "FileSystemConfigurationDetails", &c.FileSystemConfigurationDetails) + delete(rawMsg, key) + case "giVersion": + err = unpopulate(val, "GiVersion", &c.GiVersion) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, "Hostname", &c.Hostname) + delete(rawMsg, key) + case "iormConfigCache": + err = unpopulate(val, "IormConfigCache", &c.IormConfigCache) + delete(rawMsg, key) + case "isLocalBackupEnabled": + err = unpopulate(val, "IsLocalBackupEnabled", &c.IsLocalBackupEnabled) + delete(rawMsg, key) + case "isSparseDiskgroupEnabled": + err = unpopulate(val, "IsSparseDiskgroupEnabled", &c.IsSparseDiskgroupEnabled) + delete(rawMsg, key) + case "lastUpdateHistoryEntryId": + err = unpopulate(val, "LastUpdateHistoryEntryID", &c.LastUpdateHistoryEntryID) + delete(rawMsg, key) + case "licenseModel": + err = unpopulate(val, "LicenseModel", &c.LicenseModel) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &c.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &c.LifecycleState) + delete(rawMsg, key) + case "listenerPort": + err = unpopulate(val, "ListenerPort", &c.ListenerPort) + delete(rawMsg, key) + case "memorySizeInGbs": + err = unpopulate(val, "MemorySizeInGbs", &c.MemorySizeInGbs) + delete(rawMsg, key) + case "nodeCount": + err = unpopulate(val, "NodeCount", &c.NodeCount) + delete(rawMsg, key) + case "nsgCidrs": + err = unpopulate(val, "NsgCidrs", &c.NsgCidrs) + delete(rawMsg, key) + case "nsgUrl": + err = unpopulate(val, "NsgURL", &c.NsgURL) + delete(rawMsg, key) + case "ociUrl": + err = unpopulate(val, "OciURL", &c.OciURL) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &c.Ocid) + delete(rawMsg, key) + case "ocpuCount": + err = unpopulate(val, "OcpuCount", &c.OcpuCount) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) + delete(rawMsg, key) + case "sshPublicKeys": + err = unpopulate(val, "SSHPublicKeys", &c.SSHPublicKeys) + delete(rawMsg, key) + case "scanDnsName": + err = unpopulate(val, "ScanDNSName", &c.ScanDNSName) + delete(rawMsg, key) + case "scanDnsRecordId": + err = unpopulate(val, "ScanDNSRecordID", &c.ScanDNSRecordID) + delete(rawMsg, key) + case "scanIpIds": + err = unpopulate(val, "ScanIPIDs", &c.ScanIPIDs) + delete(rawMsg, key) + case "scanListenerPortTcp": + err = unpopulate(val, "ScanListenerPortTCP", &c.ScanListenerPortTCP) + delete(rawMsg, key) + case "scanListenerPortTcpSsl": + err = unpopulate(val, "ScanListenerPortTCPSSL", &c.ScanListenerPortTCPSSL) + delete(rawMsg, key) + case "shape": + err = unpopulate(val, "Shape", &c.Shape) + delete(rawMsg, key) + case "storageSizeInGbs": + err = unpopulate(val, "StorageSizeInGbs", &c.StorageSizeInGbs) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &c.SubnetID) + delete(rawMsg, key) + case "subnetOcid": + err = unpopulate(val, "SubnetOcid", &c.SubnetOcid) + delete(rawMsg, key) + case "systemVersion": + err = unpopulate(val, "SystemVersion", &c.SystemVersion) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &c.TimeCreated) + delete(rawMsg, key) + case "timeZone": + err = unpopulate(val, "TimeZone", &c.TimeZone) + delete(rawMsg, key) + case "vipIds": + err = unpopulate(val, "VipIDs", &c.VipIDs) + delete(rawMsg, key) + case "vnetId": + err = unpopulate(val, "VnetID", &c.VnetID) + delete(rawMsg, key) + case "zoneId": + err = unpopulate(val, "ZoneID", &c.ZoneID) + 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 CloudVMClusterUpdate. +func (c CloudVMClusterUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "tags", c.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMClusterUpdate. +func (c *CloudVMClusterUpdate) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + 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 CloudVMClusterUpdateProperties. +func (c CloudVMClusterUpdateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cpuCoreCount", c.CPUCoreCount) + populate(objectMap, "computeNodes", c.ComputeNodes) + populate(objectMap, "dataCollectionOptions", c.DataCollectionOptions) + populate(objectMap, "dataStorageSizeInTbs", c.DataStorageSizeInTbs) + populate(objectMap, "dbNodeStorageSizeInGbs", c.DbNodeStorageSizeInGbs) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "fileSystemConfigurationDetails", c.FileSystemConfigurationDetails) + populate(objectMap, "licenseModel", c.LicenseModel) + populate(objectMap, "memorySizeInGbs", c.MemorySizeInGbs) + populate(objectMap, "ocpuCount", c.OcpuCount) + populate(objectMap, "sshPublicKeys", c.SSHPublicKeys) + populate(objectMap, "storageSizeInGbs", c.StorageSizeInGbs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMClusterUpdateProperties. +func (c *CloudVMClusterUpdateProperties) UnmarshalJSON(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 "cpuCoreCount": + err = unpopulate(val, "CPUCoreCount", &c.CPUCoreCount) + delete(rawMsg, key) + case "computeNodes": + err = unpopulate(val, "ComputeNodes", &c.ComputeNodes) + delete(rawMsg, key) + case "dataCollectionOptions": + err = unpopulate(val, "DataCollectionOptions", &c.DataCollectionOptions) + delete(rawMsg, key) + case "dataStorageSizeInTbs": + err = unpopulate(val, "DataStorageSizeInTbs", &c.DataStorageSizeInTbs) + delete(rawMsg, key) + case "dbNodeStorageSizeInGbs": + err = unpopulate(val, "DbNodeStorageSizeInGbs", &c.DbNodeStorageSizeInGbs) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "fileSystemConfigurationDetails": + err = unpopulate(val, "FileSystemConfigurationDetails", &c.FileSystemConfigurationDetails) + delete(rawMsg, key) + case "licenseModel": + err = unpopulate(val, "LicenseModel", &c.LicenseModel) + delete(rawMsg, key) + case "memorySizeInGbs": + err = unpopulate(val, "MemorySizeInGbs", &c.MemorySizeInGbs) + delete(rawMsg, key) + case "ocpuCount": + err = unpopulate(val, "OcpuCount", &c.OcpuCount) + delete(rawMsg, key) + case "sshPublicKeys": + err = unpopulate(val, "SSHPublicKeys", &c.SSHPublicKeys) + delete(rawMsg, key) + case "storageSizeInGbs": + err = unpopulate(val, "StorageSizeInGbs", &c.StorageSizeInGbs) + 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 ConnectionStringType. +func (c ConnectionStringType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "allConnectionStrings", c.AllConnectionStrings) + populate(objectMap, "dedicated", c.Dedicated) + populate(objectMap, "high", c.High) + populate(objectMap, "low", c.Low) + populate(objectMap, "medium", c.Medium) + populate(objectMap, "profiles", c.Profiles) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionStringType. +func (c *ConnectionStringType) UnmarshalJSON(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 "allConnectionStrings": + err = unpopulate(val, "AllConnectionStrings", &c.AllConnectionStrings) + delete(rawMsg, key) + case "dedicated": + err = unpopulate(val, "Dedicated", &c.Dedicated) + delete(rawMsg, key) + case "high": + err = unpopulate(val, "High", &c.High) + delete(rawMsg, key) + case "low": + err = unpopulate(val, "Low", &c.Low) + delete(rawMsg, key) + case "medium": + err = unpopulate(val, "Medium", &c.Medium) + delete(rawMsg, key) + case "profiles": + err = unpopulate(val, "Profiles", &c.Profiles) + 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 ConnectionURLType. +func (c ConnectionURLType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "apexUrl", c.ApexURL) + populate(objectMap, "databaseTransformsUrl", c.DatabaseTransformsURL) + populate(objectMap, "graphStudioUrl", c.GraphStudioURL) + populate(objectMap, "machineLearningNotebookUrl", c.MachineLearningNotebookURL) + populate(objectMap, "mongoDbUrl", c.MongoDbURL) + populate(objectMap, "ordsUrl", c.OrdsURL) + populate(objectMap, "sqlDevWebUrl", c.SQLDevWebURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionURLType. +func (c *ConnectionURLType) UnmarshalJSON(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 "apexUrl": + err = unpopulate(val, "ApexURL", &c.ApexURL) + delete(rawMsg, key) + case "databaseTransformsUrl": + err = unpopulate(val, "DatabaseTransformsURL", &c.DatabaseTransformsURL) + delete(rawMsg, key) + case "graphStudioUrl": + err = unpopulate(val, "GraphStudioURL", &c.GraphStudioURL) + delete(rawMsg, key) + case "machineLearningNotebookUrl": + err = unpopulate(val, "MachineLearningNotebookURL", &c.MachineLearningNotebookURL) + delete(rawMsg, key) + case "mongoDbUrl": + err = unpopulate(val, "MongoDbURL", &c.MongoDbURL) + delete(rawMsg, key) + case "ordsUrl": + err = unpopulate(val, "OrdsURL", &c.OrdsURL) + delete(rawMsg, key) + case "sqlDevWebUrl": + err = unpopulate(val, "SQLDevWebURL", &c.SQLDevWebURL) + 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 CustomerContact. +func (c CustomerContact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "email", c.Email) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerContact. +func (c *CustomerContact) UnmarshalJSON(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 "email": + err = unpopulate(val, "Email", &c.Email) + 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 DNSPrivateView. +func (d DNSPrivateView) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateView. +func (d *DNSPrivateView) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DNSPrivateViewListResult. +func (d DNSPrivateViewListResult) 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 DNSPrivateViewListResult. +func (d *DNSPrivateViewListResult) UnmarshalJSON(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 DNSPrivateViewProperties. +func (d DNSPrivateViewProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "isProtected", d.IsProtected) + populate(objectMap, "lifecycleState", d.LifecycleState) + populate(objectMap, "ocid", d.Ocid) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "self", d.Self) + populateDateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) + populateDateTimeRFC3339(objectMap, "timeUpdated", d.TimeUpdated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateViewProperties. +func (d *DNSPrivateViewProperties) UnmarshalJSON(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 "displayName": + err = unpopulate(val, "DisplayName", &d.DisplayName) + delete(rawMsg, key) + case "isProtected": + err = unpopulate(val, "IsProtected", &d.IsProtected) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &d.LifecycleState) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &d.Ocid) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "self": + err = unpopulate(val, "Self", &d.Self) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + delete(rawMsg, key) + case "timeUpdated": + err = unpopulateDateTimeRFC3339(val, "TimeUpdated", &d.TimeUpdated) + 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 DNSPrivateZone. +func (d DNSPrivateZone) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateZone. +func (d *DNSPrivateZone) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + 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) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DNSPrivateZoneListResult. +func (d DNSPrivateZoneListResult) 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 DNSPrivateZoneListResult. +func (d *DNSPrivateZoneListResult) UnmarshalJSON(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 DNSPrivateZoneProperties. +func (d DNSPrivateZoneProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isProtected", d.IsProtected) + populate(objectMap, "lifecycleState", d.LifecycleState) + populate(objectMap, "ocid", d.Ocid) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "self", d.Self) + populate(objectMap, "serial", d.Serial) + populateDateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) + populate(objectMap, "version", d.Version) + populate(objectMap, "viewId", d.ViewID) + populate(objectMap, "zoneType", d.ZoneType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateZoneProperties. +func (d *DNSPrivateZoneProperties) UnmarshalJSON(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 "isProtected": + err = unpopulate(val, "IsProtected", &d.IsProtected) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &d.LifecycleState) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &d.Ocid) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + delete(rawMsg, key) + case "self": + err = unpopulate(val, "Self", &d.Self) + delete(rawMsg, key) + case "serial": + err = unpopulate(val, "Serial", &d.Serial) + delete(rawMsg, key) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &d.Version) + delete(rawMsg, key) + case "viewId": + err = unpopulate(val, "ViewID", &d.ViewID) + delete(rawMsg, key) + case "zoneType": + err = unpopulate(val, "ZoneType", &d.ZoneType) + 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 DataCollectionOptions. +func (d DataCollectionOptions) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "isDiagnosticsEventsEnabled", d.IsDiagnosticsEventsEnabled) + populate(objectMap, "isHealthMonitoringEnabled", d.IsHealthMonitoringEnabled) + populate(objectMap, "isIncidentLogsEnabled", d.IsIncidentLogsEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionOptions. +func (d *DataCollectionOptions) UnmarshalJSON(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 "isDiagnosticsEventsEnabled": + err = unpopulate(val, "IsDiagnosticsEventsEnabled", &d.IsDiagnosticsEventsEnabled) delete(rawMsg, key) - case "timeCreated": - err = unpopulate(val, "TimeCreated", &c.TimeCreated) + case "isHealthMonitoringEnabled": + err = unpopulate(val, "IsHealthMonitoringEnabled", &d.IsHealthMonitoringEnabled) delete(rawMsg, key) - case "totalStorageSizeInGbs": - err = unpopulate(val, "TotalStorageSizeInGbs", &c.TotalStorageSizeInGbs) + case "isIncidentLogsEnabled": + err = unpopulate(val, "IsIncidentLogsEnabled", &d.IsIncidentLogsEnabled) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudExadataInfrastructureUpdate. -func (c CloudExadataInfrastructureUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DayOfWeek. +func (d DayOfWeek) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "zones", c.Zones) + populate(objectMap, "name", d.Name) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructureUpdate. -func (c *CloudExadataInfrastructureUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DayOfWeek. +func (d *DayOfWeek) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &c.Tags) - delete(rawMsg, key) - case "zones": - err = unpopulate(val, "Zones", &c.Zones) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudExadataInfrastructureUpdateProperties. -func (c CloudExadataInfrastructureUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DbActionResponse. +func (d DbActionResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "computeCount", c.ComputeCount) - populate(objectMap, "customerContacts", c.CustomerContacts) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "maintenanceWindow", c.MaintenanceWindow) - populate(objectMap, "storageCount", c.StorageCount) + populate(objectMap, "provisioningState", d.ProvisioningState) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudExadataInfrastructureUpdateProperties. -func (c *CloudExadataInfrastructureUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DbActionResponse. +func (d *DbActionResponse) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "computeCount": - err = unpopulate(val, "ComputeCount", &c.ComputeCount) - delete(rawMsg, key) - case "customerContacts": - err = unpopulate(val, "CustomerContacts", &c.CustomerContacts) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &c.DisplayName) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbIormConfig. +func (d DbIormConfig) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dbName", d.DbName) + populate(objectMap, "flashCacheLimit", d.FlashCacheLimit) + populate(objectMap, "share", d.Share) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbIormConfig. +func (d *DbIormConfig) UnmarshalJSON(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 "dbName": + err = unpopulate(val, "DbName", &d.DbName) delete(rawMsg, key) - case "maintenanceWindow": - err = unpopulate(val, "MaintenanceWindow", &c.MaintenanceWindow) + case "flashCacheLimit": + err = unpopulate(val, "FlashCacheLimit", &d.FlashCacheLimit) delete(rawMsg, key) - case "storageCount": - err = unpopulate(val, "StorageCount", &c.StorageCount) + case "share": + err = unpopulate(val, "Share", &d.Share) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudVMCluster. -func (c CloudVMCluster) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DbNode. +func (d DbNode) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "type", c.Type) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMCluster. -func (c *CloudVMCluster) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DbNode. +func (d *DbNode) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &c.Location) + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &c.Name) + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &c.Properties) + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &c.SystemData) - delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &c.Tags) + err = unpopulate(val, "SystemData", &d.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &c.Type) + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudVMClusterListResult. -func (c CloudVMClusterListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DbNodeAction. +func (d DbNodeAction) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "action", d.Action) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMClusterListResult. -func (c *CloudVMClusterListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DbNodeAction. +func (d *DbNodeAction) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &c.NextLink) + case "action": + err = unpopulate(val, "Action", &d.Action) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &c.Value) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbNodeDetails. +func (d DbNodeDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dbNodeId", d.DbNodeID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbNodeDetails. +func (d *DbNodeDetails) UnmarshalJSON(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 "dbNodeId": + err = unpopulate(val, "DbNodeID", &d.DbNodeID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudVMClusterProperties. -func (c CloudVMClusterProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DbNodeListResult. +func (d DbNodeListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "backupSubnetCidr", c.BackupSubnetCidr) - populate(objectMap, "cpuCoreCount", c.CPUCoreCount) - populate(objectMap, "cloudExadataInfrastructureId", c.CloudExadataInfrastructureID) - populate(objectMap, "clusterName", c.ClusterName) - populate(objectMap, "compartmentId", c.CompartmentID) - populate(objectMap, "computeNodes", c.ComputeNodes) - populate(objectMap, "dataCollectionOptions", c.DataCollectionOptions) - populate(objectMap, "dataStoragePercentage", c.DataStoragePercentage) - populate(objectMap, "dataStorageSizeInTbs", c.DataStorageSizeInTbs) - populate(objectMap, "dbNodeStorageSizeInGbs", c.DbNodeStorageSizeInGbs) - populate(objectMap, "dbServers", c.DbServers) - populate(objectMap, "diskRedundancy", c.DiskRedundancy) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "domain", c.Domain) - populate(objectMap, "giVersion", c.GiVersion) - populate(objectMap, "hostname", c.Hostname) - populate(objectMap, "iormConfigCache", c.IormConfigCache) - populate(objectMap, "isLocalBackupEnabled", c.IsLocalBackupEnabled) - populate(objectMap, "isSparseDiskgroupEnabled", c.IsSparseDiskgroupEnabled) - populate(objectMap, "lastUpdateHistoryEntryId", c.LastUpdateHistoryEntryID) - populate(objectMap, "licenseModel", c.LicenseModel) - populate(objectMap, "lifecycleDetails", c.LifecycleDetails) - populate(objectMap, "lifecycleState", c.LifecycleState) - populate(objectMap, "listenerPort", c.ListenerPort) - populate(objectMap, "memorySizeInGbs", c.MemorySizeInGbs) - populate(objectMap, "nodeCount", c.NodeCount) - populate(objectMap, "nsgCidrs", c.NsgCidrs) - populate(objectMap, "nsgUrl", c.NsgURL) - populate(objectMap, "ociUrl", c.OciURL) - populate(objectMap, "ocid", c.Ocid) - populate(objectMap, "ocpuCount", c.OcpuCount) - populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "sshPublicKeys", c.SSHPublicKeys) - populate(objectMap, "scanDnsName", c.ScanDNSName) - populate(objectMap, "scanDnsRecordId", c.ScanDNSRecordID) - populate(objectMap, "scanIpIds", c.ScanIPIDs) - populate(objectMap, "scanListenerPortTcp", c.ScanListenerPortTCP) - populate(objectMap, "scanListenerPortTcpSsl", c.ScanListenerPortTCPSSL) - populate(objectMap, "shape", c.Shape) - populate(objectMap, "storageSizeInGbs", c.StorageSizeInGbs) - populate(objectMap, "subnetId", c.SubnetID) - populate(objectMap, "subnetOcid", c.SubnetOcid) - populate(objectMap, "systemVersion", c.SystemVersion) - populateDateTimeRFC3339(objectMap, "timeCreated", c.TimeCreated) - populate(objectMap, "timeZone", c.TimeZone) - populate(objectMap, "vipIds", c.VipIDs) - populate(objectMap, "vnetId", c.VnetID) - populate(objectMap, "zoneId", c.ZoneID) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbNodeListResult. +func (d *DbNodeListResult) UnmarshalJSON(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 DbNodeProperties. +func (d DbNodeProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalDetails", d.AdditionalDetails) + populate(objectMap, "backupIpId", d.BackupIPID) + populate(objectMap, "backupVnic2Id", d.BackupVnic2ID) + populate(objectMap, "backupVnicId", d.BackupVnicID) + populate(objectMap, "cpuCoreCount", d.CPUCoreCount) + populate(objectMap, "dbNodeStorageSizeInGbs", d.DbNodeStorageSizeInGbs) + populate(objectMap, "dbServerId", d.DbServerID) + populate(objectMap, "dbSystemId", d.DbSystemID) + populate(objectMap, "faultDomain", d.FaultDomain) + populate(objectMap, "hostIpId", d.HostIPID) + populate(objectMap, "hostname", d.Hostname) + populate(objectMap, "lifecycleDetails", d.LifecycleDetails) + populate(objectMap, "lifecycleState", d.LifecycleState) + populate(objectMap, "maintenanceType", d.MaintenanceType) + populate(objectMap, "memorySizeInGbs", d.MemorySizeInGbs) + populate(objectMap, "ocid", d.Ocid) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "softwareStorageSizeInGb", d.SoftwareStorageSizeInGb) + populateDateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) + populateDateTimeRFC3339(objectMap, "timeMaintenanceWindowEnd", d.TimeMaintenanceWindowEnd) + populateDateTimeRFC3339(objectMap, "timeMaintenanceWindowStart", d.TimeMaintenanceWindowStart) + populate(objectMap, "vnic2Id", d.Vnic2ID) + populate(objectMap, "vnicId", d.VnicID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMClusterProperties. -func (c *CloudVMClusterProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DbNodeProperties. +func (d *DbNodeProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "backupSubnetCidr": - err = unpopulate(val, "BackupSubnetCidr", &c.BackupSubnetCidr) - delete(rawMsg, key) - case "cpuCoreCount": - err = unpopulate(val, "CPUCoreCount", &c.CPUCoreCount) - delete(rawMsg, key) - case "cloudExadataInfrastructureId": - err = unpopulate(val, "CloudExadataInfrastructureID", &c.CloudExadataInfrastructureID) - delete(rawMsg, key) - case "clusterName": - err = unpopulate(val, "ClusterName", &c.ClusterName) - delete(rawMsg, key) - case "compartmentId": - err = unpopulate(val, "CompartmentID", &c.CompartmentID) + case "additionalDetails": + err = unpopulate(val, "AdditionalDetails", &d.AdditionalDetails) delete(rawMsg, key) - case "computeNodes": - err = unpopulate(val, "ComputeNodes", &c.ComputeNodes) + case "backupIpId": + err = unpopulate(val, "BackupIPID", &d.BackupIPID) delete(rawMsg, key) - case "dataCollectionOptions": - err = unpopulate(val, "DataCollectionOptions", &c.DataCollectionOptions) + case "backupVnic2Id": + err = unpopulate(val, "BackupVnic2ID", &d.BackupVnic2ID) delete(rawMsg, key) - case "dataStoragePercentage": - err = unpopulate(val, "DataStoragePercentage", &c.DataStoragePercentage) + case "backupVnicId": + err = unpopulate(val, "BackupVnicID", &d.BackupVnicID) delete(rawMsg, key) - case "dataStorageSizeInTbs": - err = unpopulate(val, "DataStorageSizeInTbs", &c.DataStorageSizeInTbs) + case "cpuCoreCount": + err = unpopulate(val, "CPUCoreCount", &d.CPUCoreCount) delete(rawMsg, key) case "dbNodeStorageSizeInGbs": - err = unpopulate(val, "DbNodeStorageSizeInGbs", &c.DbNodeStorageSizeInGbs) - delete(rawMsg, key) - case "dbServers": - err = unpopulate(val, "DbServers", &c.DbServers) + err = unpopulate(val, "DbNodeStorageSizeInGbs", &d.DbNodeStorageSizeInGbs) delete(rawMsg, key) - case "diskRedundancy": - err = unpopulate(val, "DiskRedundancy", &c.DiskRedundancy) + case "dbServerId": + err = unpopulate(val, "DbServerID", &d.DbServerID) delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &c.DisplayName) + case "dbSystemId": + err = unpopulate(val, "DbSystemID", &d.DbSystemID) delete(rawMsg, key) - case "domain": - err = unpopulate(val, "Domain", &c.Domain) + case "faultDomain": + err = unpopulate(val, "FaultDomain", &d.FaultDomain) delete(rawMsg, key) - case "giVersion": - err = unpopulate(val, "GiVersion", &c.GiVersion) + case "hostIpId": + err = unpopulate(val, "HostIPID", &d.HostIPID) delete(rawMsg, key) case "hostname": - err = unpopulate(val, "Hostname", &c.Hostname) - delete(rawMsg, key) - case "iormConfigCache": - err = unpopulate(val, "IormConfigCache", &c.IormConfigCache) - delete(rawMsg, key) - case "isLocalBackupEnabled": - err = unpopulate(val, "IsLocalBackupEnabled", &c.IsLocalBackupEnabled) - delete(rawMsg, key) - case "isSparseDiskgroupEnabled": - err = unpopulate(val, "IsSparseDiskgroupEnabled", &c.IsSparseDiskgroupEnabled) - delete(rawMsg, key) - case "lastUpdateHistoryEntryId": - err = unpopulate(val, "LastUpdateHistoryEntryID", &c.LastUpdateHistoryEntryID) - delete(rawMsg, key) - case "licenseModel": - err = unpopulate(val, "LicenseModel", &c.LicenseModel) + err = unpopulate(val, "Hostname", &d.Hostname) delete(rawMsg, key) case "lifecycleDetails": - err = unpopulate(val, "LifecycleDetails", &c.LifecycleDetails) + err = unpopulate(val, "LifecycleDetails", &d.LifecycleDetails) delete(rawMsg, key) case "lifecycleState": - err = unpopulate(val, "LifecycleState", &c.LifecycleState) + err = unpopulate(val, "LifecycleState", &d.LifecycleState) delete(rawMsg, key) - case "listenerPort": - err = unpopulate(val, "ListenerPort", &c.ListenerPort) + case "maintenanceType": + err = unpopulate(val, "MaintenanceType", &d.MaintenanceType) delete(rawMsg, key) case "memorySizeInGbs": - err = unpopulate(val, "MemorySizeInGbs", &c.MemorySizeInGbs) - delete(rawMsg, key) - case "nodeCount": - err = unpopulate(val, "NodeCount", &c.NodeCount) - delete(rawMsg, key) - case "nsgCidrs": - err = unpopulate(val, "NsgCidrs", &c.NsgCidrs) - delete(rawMsg, key) - case "nsgUrl": - err = unpopulate(val, "NsgURL", &c.NsgURL) - delete(rawMsg, key) - case "ociUrl": - err = unpopulate(val, "OciURL", &c.OciURL) + err = unpopulate(val, "MemorySizeInGbs", &d.MemorySizeInGbs) delete(rawMsg, key) case "ocid": - err = unpopulate(val, "Ocid", &c.Ocid) - delete(rawMsg, key) - case "ocpuCount": - err = unpopulate(val, "OcpuCount", &c.OcpuCount) + err = unpopulate(val, "Ocid", &d.Ocid) delete(rawMsg, key) case "provisioningState": - err = unpopulate(val, "ProvisioningState", &c.ProvisioningState) - delete(rawMsg, key) - case "sshPublicKeys": - err = unpopulate(val, "SSHPublicKeys", &c.SSHPublicKeys) - delete(rawMsg, key) - case "scanDnsName": - err = unpopulate(val, "ScanDNSName", &c.ScanDNSName) - delete(rawMsg, key) - case "scanDnsRecordId": - err = unpopulate(val, "ScanDNSRecordID", &c.ScanDNSRecordID) + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) delete(rawMsg, key) - case "scanIpIds": - err = unpopulate(val, "ScanIPIDs", &c.ScanIPIDs) + case "softwareStorageSizeInGb": + err = unpopulate(val, "SoftwareStorageSizeInGb", &d.SoftwareStorageSizeInGb) delete(rawMsg, key) - case "scanListenerPortTcp": - err = unpopulate(val, "ScanListenerPortTCP", &c.ScanListenerPortTCP) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) delete(rawMsg, key) - case "scanListenerPortTcpSsl": - err = unpopulate(val, "ScanListenerPortTCPSSL", &c.ScanListenerPortTCPSSL) + case "timeMaintenanceWindowEnd": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceWindowEnd", &d.TimeMaintenanceWindowEnd) delete(rawMsg, key) - case "shape": - err = unpopulate(val, "Shape", &c.Shape) + case "timeMaintenanceWindowStart": + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceWindowStart", &d.TimeMaintenanceWindowStart) delete(rawMsg, key) - case "storageSizeInGbs": - err = unpopulate(val, "StorageSizeInGbs", &c.StorageSizeInGbs) + case "vnic2Id": + err = unpopulate(val, "Vnic2ID", &d.Vnic2ID) delete(rawMsg, key) - case "subnetId": - err = unpopulate(val, "SubnetID", &c.SubnetID) + case "vnicId": + err = unpopulate(val, "VnicID", &d.VnicID) delete(rawMsg, key) - case "subnetOcid": - err = unpopulate(val, "SubnetOcid", &c.SubnetOcid) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbServer. +func (d DbServer) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DbServer. +func (d *DbServer) UnmarshalJSON(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 "id": + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) - case "systemVersion": - err = unpopulate(val, "SystemVersion", &c.SystemVersion) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "timeCreated": - err = unpopulateDateTimeRFC3339(val, "TimeCreated", &c.TimeCreated) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "timeZone": - err = unpopulate(val, "TimeZone", &c.TimeZone) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) delete(rawMsg, key) - case "vipIds": - err = unpopulate(val, "VipIDs", &c.VipIDs) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) - case "vnetId": - err = unpopulate(val, "VnetID", &c.VnetID) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DbServerListResult. +func (d DbServerListResult) 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 DbServerListResult. +func (d *DbServerListResult) UnmarshalJSON(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 "zoneId": - err = unpopulate(val, "ZoneID", &c.ZoneID) + case "value": + err = unpopulate(val, "Value", &d.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudVMClusterUpdate. -func (c CloudVMClusterUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DbServerPatchingDetails. +func (d DbServerPatchingDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "tags", c.Tags) + populate(objectMap, "estimatedPatchDuration", d.EstimatedPatchDuration) + populate(objectMap, "patchingStatus", d.PatchingStatus) + populateDateTimeRFC3339(objectMap, "timePatchingEnded", d.TimePatchingEnded) + populateDateTimeRFC3339(objectMap, "timePatchingStarted", d.TimePatchingStarted) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMClusterUpdate. -func (c *CloudVMClusterUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DbServerPatchingDetails. +func (d *DbServerPatchingDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "properties": - err = unpopulate(val, "Properties", &c.Properties) + case "estimatedPatchDuration": + err = unpopulate(val, "EstimatedPatchDuration", &d.EstimatedPatchDuration) delete(rawMsg, key) - case "tags": - err = unpopulate(val, "Tags", &c.Tags) + case "patchingStatus": + err = unpopulate(val, "PatchingStatus", &d.PatchingStatus) + delete(rawMsg, key) + case "timePatchingEnded": + err = unpopulateDateTimeRFC3339(val, "TimePatchingEnded", &d.TimePatchingEnded) + delete(rawMsg, key) + case "timePatchingStarted": + err = unpopulateDateTimeRFC3339(val, "TimePatchingStarted", &d.TimePatchingStarted) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CloudVMClusterUpdateProperties. -func (c CloudVMClusterUpdateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DbServerProperties. +func (d DbServerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "cpuCoreCount", c.CPUCoreCount) - populate(objectMap, "computeNodes", c.ComputeNodes) - populate(objectMap, "dataCollectionOptions", c.DataCollectionOptions) - populate(objectMap, "dataStorageSizeInTbs", c.DataStorageSizeInTbs) - populate(objectMap, "dbNodeStorageSizeInGbs", c.DbNodeStorageSizeInGbs) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "licenseModel", c.LicenseModel) - populate(objectMap, "memorySizeInGbs", c.MemorySizeInGbs) - populate(objectMap, "ocpuCount", c.OcpuCount) - populate(objectMap, "sshPublicKeys", c.SSHPublicKeys) - populate(objectMap, "storageSizeInGbs", c.StorageSizeInGbs) + populate(objectMap, "autonomousVmClusterIds", d.AutonomousVMClusterIDs) + populate(objectMap, "autonomousVirtualMachineIds", d.AutonomousVirtualMachineIDs) + populate(objectMap, "cpuCoreCount", d.CPUCoreCount) + populate(objectMap, "compartmentId", d.CompartmentID) + populate(objectMap, "computeModel", d.ComputeModel) + populate(objectMap, "dbNodeIds", d.DbNodeIDs) + populate(objectMap, "dbNodeStorageSizeInGbs", d.DbNodeStorageSizeInGbs) + populate(objectMap, "dbServerPatchingDetails", d.DbServerPatchingDetails) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "exadataInfrastructureId", d.ExadataInfrastructureID) + populate(objectMap, "lifecycleDetails", d.LifecycleDetails) + populate(objectMap, "lifecycleState", d.LifecycleState) + populate(objectMap, "maxCpuCount", d.MaxCPUCount) + populate(objectMap, "maxDbNodeStorageInGbs", d.MaxDbNodeStorageInGbs) + populate(objectMap, "maxMemoryInGbs", d.MaxMemoryInGbs) + populate(objectMap, "memorySizeInGbs", d.MemorySizeInGbs) + populate(objectMap, "ocid", d.Ocid) + populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "shape", d.Shape) + populateDateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) + populate(objectMap, "vmClusterIds", d.VMClusterIDs) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CloudVMClusterUpdateProperties. -func (c *CloudVMClusterUpdateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DbServerProperties. +func (d *DbServerProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { + case "autonomousVmClusterIds": + err = unpopulate(val, "AutonomousVMClusterIDs", &d.AutonomousVMClusterIDs) + delete(rawMsg, key) + case "autonomousVirtualMachineIds": + err = unpopulate(val, "AutonomousVirtualMachineIDs", &d.AutonomousVirtualMachineIDs) + delete(rawMsg, key) case "cpuCoreCount": - err = unpopulate(val, "CPUCoreCount", &c.CPUCoreCount) + err = unpopulate(val, "CPUCoreCount", &d.CPUCoreCount) delete(rawMsg, key) - case "computeNodes": - err = unpopulate(val, "ComputeNodes", &c.ComputeNodes) + case "compartmentId": + err = unpopulate(val, "CompartmentID", &d.CompartmentID) delete(rawMsg, key) - case "dataCollectionOptions": - err = unpopulate(val, "DataCollectionOptions", &c.DataCollectionOptions) + case "computeModel": + err = unpopulate(val, "ComputeModel", &d.ComputeModel) delete(rawMsg, key) - case "dataStorageSizeInTbs": - err = unpopulate(val, "DataStorageSizeInTbs", &c.DataStorageSizeInTbs) + case "dbNodeIds": + err = unpopulate(val, "DbNodeIDs", &d.DbNodeIDs) delete(rawMsg, key) case "dbNodeStorageSizeInGbs": - err = unpopulate(val, "DbNodeStorageSizeInGbs", &c.DbNodeStorageSizeInGbs) + err = unpopulate(val, "DbNodeStorageSizeInGbs", &d.DbNodeStorageSizeInGbs) + delete(rawMsg, key) + case "dbServerPatchingDetails": + err = unpopulate(val, "DbServerPatchingDetails", &d.DbServerPatchingDetails) delete(rawMsg, key) case "displayName": - err = unpopulate(val, "DisplayName", &c.DisplayName) + err = unpopulate(val, "DisplayName", &d.DisplayName) delete(rawMsg, key) - case "licenseModel": - err = unpopulate(val, "LicenseModel", &c.LicenseModel) + case "exadataInfrastructureId": + err = unpopulate(val, "ExadataInfrastructureID", &d.ExadataInfrastructureID) delete(rawMsg, key) - case "memorySizeInGbs": - err = unpopulate(val, "MemorySizeInGbs", &c.MemorySizeInGbs) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &d.LifecycleDetails) delete(rawMsg, key) - case "ocpuCount": - err = unpopulate(val, "OcpuCount", &c.OcpuCount) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &d.LifecycleState) delete(rawMsg, key) - case "sshPublicKeys": - err = unpopulate(val, "SSHPublicKeys", &c.SSHPublicKeys) + case "maxCpuCount": + err = unpopulate(val, "MaxCPUCount", &d.MaxCPUCount) delete(rawMsg, key) - case "storageSizeInGbs": - err = unpopulate(val, "StorageSizeInGbs", &c.StorageSizeInGbs) + case "maxDbNodeStorageInGbs": + err = unpopulate(val, "MaxDbNodeStorageInGbs", &d.MaxDbNodeStorageInGbs) 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 ConnectionStringType. -func (c ConnectionStringType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "allConnectionStrings", c.AllConnectionStrings) - populate(objectMap, "dedicated", c.Dedicated) - populate(objectMap, "high", c.High) - populate(objectMap, "low", c.Low) - populate(objectMap, "medium", c.Medium) - populate(objectMap, "profiles", c.Profiles) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionStringType. -func (c *ConnectionStringType) UnmarshalJSON(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 "allConnectionStrings": - err = unpopulate(val, "AllConnectionStrings", &c.AllConnectionStrings) + case "maxMemoryInGbs": + err = unpopulate(val, "MaxMemoryInGbs", &d.MaxMemoryInGbs) delete(rawMsg, key) - case "dedicated": - err = unpopulate(val, "Dedicated", &c.Dedicated) + case "memorySizeInGbs": + err = unpopulate(val, "MemorySizeInGbs", &d.MemorySizeInGbs) delete(rawMsg, key) - case "high": - err = unpopulate(val, "High", &c.High) + case "ocid": + err = unpopulate(val, "Ocid", &d.Ocid) delete(rawMsg, key) - case "low": - err = unpopulate(val, "Low", &c.Low) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) delete(rawMsg, key) - case "medium": - err = unpopulate(val, "Medium", &c.Medium) + case "shape": + err = unpopulate(val, "Shape", &d.Shape) delete(rawMsg, key) - case "profiles": - err = unpopulate(val, "Profiles", &c.Profiles) + case "timeCreated": + err = unpopulateDateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + delete(rawMsg, key) + case "vmClusterIds": + err = unpopulate(val, "VMClusterIDs", &d.VMClusterIDs) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectionURLType. -func (c ConnectionURLType) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DbSystemShape. +func (d DbSystemShape) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "apexUrl", c.ApexURL) - populate(objectMap, "databaseTransformsUrl", c.DatabaseTransformsURL) - populate(objectMap, "graphStudioUrl", c.GraphStudioURL) - populate(objectMap, "machineLearningNotebookUrl", c.MachineLearningNotebookURL) - populate(objectMap, "mongoDbUrl", c.MongoDbURL) - populate(objectMap, "ordsUrl", c.OrdsURL) - populate(objectMap, "sqlDevWebUrl", c.SQLDevWebURL) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionURLType. -func (c *ConnectionURLType) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DbSystemShape. +func (d *DbSystemShape) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "apexUrl": - err = unpopulate(val, "ApexURL", &c.ApexURL) - delete(rawMsg, key) - case "databaseTransformsUrl": - err = unpopulate(val, "DatabaseTransformsURL", &c.DatabaseTransformsURL) - delete(rawMsg, key) - case "graphStudioUrl": - err = unpopulate(val, "GraphStudioURL", &c.GraphStudioURL) + case "id": + err = unpopulate(val, "ID", &d.ID) delete(rawMsg, key) - case "machineLearningNotebookUrl": - err = unpopulate(val, "MachineLearningNotebookURL", &c.MachineLearningNotebookURL) + case "name": + err = unpopulate(val, "Name", &d.Name) delete(rawMsg, key) - case "mongoDbUrl": - err = unpopulate(val, "MongoDbURL", &c.MongoDbURL) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) - case "ordsUrl": - err = unpopulate(val, "OrdsURL", &c.OrdsURL) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) delete(rawMsg, key) - case "sqlDevWebUrl": - err = unpopulate(val, "SQLDevWebURL", &c.SQLDevWebURL) + case "type": + err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomerContact. -func (c CustomerContact) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DbSystemShapeListResult. +func (d DbSystemShapeListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "email", c.Email) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomerContact. -func (c *CustomerContact) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DbSystemShapeListResult. +func (d *DbSystemShapeListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "email": - err = unpopulate(val, "Email", &c.Email) + 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DNSPrivateView. -func (d DNSPrivateView) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DbSystemShapeProperties. +func (d DbSystemShapeProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) + populate(objectMap, "areServerTypesSupported", d.AreServerTypesSupported) + populate(objectMap, "availableCoreCount", d.AvailableCoreCount) + populate(objectMap, "availableCoreCountPerNode", d.AvailableCoreCountPerNode) + populate(objectMap, "availableDataStorageInTbs", d.AvailableDataStorageInTbs) + populate(objectMap, "availableDataStoragePerServerInTbs", d.AvailableDataStoragePerServerInTbs) + populate(objectMap, "availableDbNodePerNodeInGbs", d.AvailableDbNodePerNodeInGbs) + populate(objectMap, "availableDbNodeStorageInGbs", d.AvailableDbNodeStorageInGbs) + populate(objectMap, "availableMemoryInGbs", d.AvailableMemoryInGbs) + populate(objectMap, "availableMemoryPerNodeInGbs", d.AvailableMemoryPerNodeInGbs) + populate(objectMap, "computeModel", d.ComputeModel) + populate(objectMap, "coreCountIncrement", d.CoreCountIncrement) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "maxStorageCount", d.MaxStorageCount) + populate(objectMap, "maximumNodeCount", d.MaximumNodeCount) + populate(objectMap, "minCoreCountPerNode", d.MinCoreCountPerNode) + populate(objectMap, "minDataStorageInTbs", d.MinDataStorageInTbs) + populate(objectMap, "minDbNodeStoragePerNodeInGbs", d.MinDbNodeStoragePerNodeInGbs) + populate(objectMap, "minMemoryPerNodeInGbs", d.MinMemoryPerNodeInGbs) + populate(objectMap, "minStorageCount", d.MinStorageCount) + populate(objectMap, "minimumCoreCount", d.MinimumCoreCount) + populate(objectMap, "minimumNodeCount", d.MinimumNodeCount) + populate(objectMap, "runtimeMinimumCoreCount", d.RuntimeMinimumCoreCount) + populate(objectMap, "shapeFamily", d.ShapeFamily) + populate(objectMap, "shapeName", d.ShapeName) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateView. -func (d *DNSPrivateView) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DbSystemShapeProperties. +func (d *DbSystemShapeProperties) UnmarshalJSON(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) @@ -2858,20 +4469,77 @@ func (d *DNSPrivateView) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) + case "areServerTypesSupported": + err = unpopulate(val, "AreServerTypesSupported", &d.AreServerTypesSupported) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) + case "availableCoreCount": + err = unpopulate(val, "AvailableCoreCount", &d.AvailableCoreCount) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "availableCoreCountPerNode": + err = unpopulate(val, "AvailableCoreCountPerNode", &d.AvailableCoreCountPerNode) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) + case "availableDataStorageInTbs": + err = unpopulate(val, "AvailableDataStorageInTbs", &d.AvailableDataStorageInTbs) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "availableDataStoragePerServerInTbs": + err = unpopulate(val, "AvailableDataStoragePerServerInTbs", &d.AvailableDataStoragePerServerInTbs) + delete(rawMsg, key) + case "availableDbNodePerNodeInGbs": + err = unpopulate(val, "AvailableDbNodePerNodeInGbs", &d.AvailableDbNodePerNodeInGbs) + delete(rawMsg, key) + case "availableDbNodeStorageInGbs": + err = unpopulate(val, "AvailableDbNodeStorageInGbs", &d.AvailableDbNodeStorageInGbs) + delete(rawMsg, key) + case "availableMemoryInGbs": + err = unpopulate(val, "AvailableMemoryInGbs", &d.AvailableMemoryInGbs) + delete(rawMsg, key) + case "availableMemoryPerNodeInGbs": + err = unpopulate(val, "AvailableMemoryPerNodeInGbs", &d.AvailableMemoryPerNodeInGbs) + delete(rawMsg, key) + case "computeModel": + err = unpopulate(val, "ComputeModel", &d.ComputeModel) + delete(rawMsg, key) + case "coreCountIncrement": + err = unpopulate(val, "CoreCountIncrement", &d.CoreCountIncrement) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &d.DisplayName) + delete(rawMsg, key) + case "maxStorageCount": + err = unpopulate(val, "MaxStorageCount", &d.MaxStorageCount) + delete(rawMsg, key) + case "maximumNodeCount": + err = unpopulate(val, "MaximumNodeCount", &d.MaximumNodeCount) + delete(rawMsg, key) + case "minCoreCountPerNode": + err = unpopulate(val, "MinCoreCountPerNode", &d.MinCoreCountPerNode) + delete(rawMsg, key) + case "minDataStorageInTbs": + err = unpopulate(val, "MinDataStorageInTbs", &d.MinDataStorageInTbs) + delete(rawMsg, key) + case "minDbNodeStoragePerNodeInGbs": + err = unpopulate(val, "MinDbNodeStoragePerNodeInGbs", &d.MinDbNodeStoragePerNodeInGbs) + delete(rawMsg, key) + case "minMemoryPerNodeInGbs": + err = unpopulate(val, "MinMemoryPerNodeInGbs", &d.MinMemoryPerNodeInGbs) + delete(rawMsg, key) + case "minStorageCount": + err = unpopulate(val, "MinStorageCount", &d.MinStorageCount) + delete(rawMsg, key) + case "minimumCoreCount": + err = unpopulate(val, "MinimumCoreCount", &d.MinimumCoreCount) + delete(rawMsg, key) + case "minimumNodeCount": + err = unpopulate(val, "MinimumNodeCount", &d.MinimumNodeCount) + delete(rawMsg, key) + case "runtimeMinimumCoreCount": + err = unpopulate(val, "RuntimeMinimumCoreCount", &d.RuntimeMinimumCoreCount) + delete(rawMsg, key) + case "shapeFamily": + err = unpopulate(val, "ShapeFamily", &d.ShapeFamily) + delete(rawMsg, key) + case "shapeName": + err = unpopulate(val, "ShapeName", &d.ShapeName) delete(rawMsg, key) } if err != nil { @@ -2881,16 +4549,18 @@ func (d *DNSPrivateView) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DNSPrivateViewListResult. -func (d DNSPrivateViewListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DefinedFileSystemConfiguration. +func (d DefinedFileSystemConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "isBackupPartition", d.IsBackupPartition) + populate(objectMap, "isResizable", d.IsResizable) + populate(objectMap, "minSizeGb", d.MinSizeGb) + populate(objectMap, "mountPoint", d.MountPoint) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateViewListResult. -func (d *DNSPrivateViewListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DefinedFileSystemConfiguration. +func (d *DefinedFileSystemConfiguration) UnmarshalJSON(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) @@ -2898,11 +4568,17 @@ func (d *DNSPrivateViewListResult) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) + case "isBackupPartition": + err = unpopulate(val, "IsBackupPartition", &d.IsBackupPartition) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) + case "isResizable": + err = unpopulate(val, "IsResizable", &d.IsResizable) + delete(rawMsg, key) + case "minSizeGb": + err = unpopulate(val, "MinSizeGb", &d.MinSizeGb) + delete(rawMsg, key) + case "mountPoint": + err = unpopulate(val, "MountPoint", &d.MountPoint) delete(rawMsg, key) } if err != nil { @@ -2912,22 +4588,18 @@ func (d *DNSPrivateViewListResult) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DNSPrivateViewProperties. -func (d DNSPrivateViewProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DisasterRecoveryConfigurationDetails. +func (d DisasterRecoveryConfigurationDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "displayName", d.DisplayName) - populate(objectMap, "isProtected", d.IsProtected) - populate(objectMap, "lifecycleState", d.LifecycleState) - populate(objectMap, "ocid", d.Ocid) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "self", d.Self) - populateDateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) - populateDateTimeRFC3339(objectMap, "timeUpdated", d.TimeUpdated) + populate(objectMap, "disasterRecoveryType", d.DisasterRecoveryType) + populate(objectMap, "isReplicateAutomaticBackups", d.IsReplicateAutomaticBackups) + populate(objectMap, "isSnapshotStandby", d.IsSnapshotStandby) + populateDateTimeRFC3339(objectMap, "timeSnapshotStandbyEnabledTill", d.TimeSnapshotStandbyEnabledTill) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateViewProperties. -func (d *DNSPrivateViewProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DisasterRecoveryConfigurationDetails. +func (d *DisasterRecoveryConfigurationDetails) UnmarshalJSON(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) @@ -2935,29 +4607,17 @@ func (d *DNSPrivateViewProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "displayName": - err = unpopulate(val, "DisplayName", &d.DisplayName) - delete(rawMsg, key) - case "isProtected": - err = unpopulate(val, "IsProtected", &d.IsProtected) - delete(rawMsg, key) - case "lifecycleState": - err = unpopulate(val, "LifecycleState", &d.LifecycleState) - delete(rawMsg, key) - case "ocid": - err = unpopulate(val, "Ocid", &d.Ocid) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + case "disasterRecoveryType": + err = unpopulate(val, "DisasterRecoveryType", &d.DisasterRecoveryType) delete(rawMsg, key) - case "self": - err = unpopulate(val, "Self", &d.Self) + case "isReplicateAutomaticBackups": + err = unpopulate(val, "IsReplicateAutomaticBackups", &d.IsReplicateAutomaticBackups) delete(rawMsg, key) - case "timeCreated": - err = unpopulateDateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + case "isSnapshotStandby": + err = unpopulate(val, "IsSnapshotStandby", &d.IsSnapshotStandby) delete(rawMsg, key) - case "timeUpdated": - err = unpopulateDateTimeRFC3339(val, "TimeUpdated", &d.TimeUpdated) + case "timeSnapshotStandbyEnabledTill": + err = unpopulateDateTimeRFC3339(val, "TimeSnapshotStandbyEnabledTill", &d.TimeSnapshotStandbyEnabledTill) delete(rawMsg, key) } if err != nil { @@ -2967,965 +4627,1101 @@ func (d *DNSPrivateViewProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DNSPrivateZone. -func (d DNSPrivateZone) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type EstimatedPatchingTime. +func (e EstimatedPatchingTime) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) + populate(objectMap, "estimatedDbServerPatchingTime", e.EstimatedDbServerPatchingTime) + populate(objectMap, "estimatedNetworkSwitchesPatchingTime", e.EstimatedNetworkSwitchesPatchingTime) + populate(objectMap, "estimatedStorageServerPatchingTime", e.EstimatedStorageServerPatchingTime) + populate(objectMap, "totalEstimatedPatchingTime", e.TotalEstimatedPatchingTime) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateZone. -func (d *DNSPrivateZone) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type EstimatedPatchingTime. +func (e *EstimatedPatchingTime) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) + case "estimatedDbServerPatchingTime": + err = unpopulate(val, "EstimatedDbServerPatchingTime", &e.EstimatedDbServerPatchingTime) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) + case "estimatedNetworkSwitchesPatchingTime": + err = unpopulate(val, "EstimatedNetworkSwitchesPatchingTime", &e.EstimatedNetworkSwitchesPatchingTime) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) + case "estimatedStorageServerPatchingTime": + err = unpopulate(val, "EstimatedStorageServerPatchingTime", &e.EstimatedStorageServerPatchingTime) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "totalEstimatedPatchingTime": + err = unpopulate(val, "TotalEstimatedPatchingTime", &e.TotalEstimatedPatchingTime) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DNSPrivateZoneListResult. -func (d DNSPrivateZoneListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExadataIormConfig. +func (e ExadataIormConfig) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "dbPlans", e.DbPlans) + populate(objectMap, "lifecycleDetails", e.LifecycleDetails) + populate(objectMap, "lifecycleState", e.LifecycleState) + populate(objectMap, "objective", e.Objective) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateZoneListResult. -func (d *DNSPrivateZoneListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExadataIormConfig. +func (e *ExadataIormConfig) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) + case "dbPlans": + err = unpopulate(val, "DbPlans", &e.DbPlans) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &d.Value) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &e.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &e.LifecycleState) + delete(rawMsg, key) + case "objective": + err = unpopulate(val, "Objective", &e.Objective) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DNSPrivateZoneProperties. -func (d DNSPrivateZoneProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExadbVMCluster. +func (e ExadbVMCluster) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "isProtected", d.IsProtected) - populate(objectMap, "lifecycleState", d.LifecycleState) - populate(objectMap, "ocid", d.Ocid) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "self", d.Self) - populate(objectMap, "serial", d.Serial) - populateDateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) - populate(objectMap, "version", d.Version) - populate(objectMap, "viewId", d.ViewID) - populate(objectMap, "zoneType", d.ZoneType) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + populate(objectMap, "zones", e.Zones) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DNSPrivateZoneProperties. -func (d *DNSPrivateZoneProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExadbVMCluster. +func (e *ExadbVMCluster) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { - case "isProtected": - err = unpopulate(val, "IsProtected", &d.IsProtected) - delete(rawMsg, key) - case "lifecycleState": - err = unpopulate(val, "LifecycleState", &d.LifecycleState) - delete(rawMsg, key) - case "ocid": - err = unpopulate(val, "Ocid", &d.Ocid) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + case "location": + err = unpopulate(val, "Location", &e.Location) delete(rawMsg, key) - case "self": - err = unpopulate(val, "Self", &d.Self) + case "name": + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - case "serial": - err = unpopulate(val, "Serial", &d.Serial) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) - case "timeCreated": - err = unpopulateDateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &d.Version) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) delete(rawMsg, key) - case "viewId": - err = unpopulate(val, "ViewID", &d.ViewID) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) - case "zoneType": - err = unpopulate(val, "ZoneType", &d.ZoneType) + case "zones": + err = unpopulate(val, "Zones", &e.Zones) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DataCollectionOptions. -func (d DataCollectionOptions) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExadbVMClusterListResult. +func (e ExadbVMClusterListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "isDiagnosticsEventsEnabled", d.IsDiagnosticsEventsEnabled) - populate(objectMap, "isHealthMonitoringEnabled", d.IsHealthMonitoringEnabled) - populate(objectMap, "isIncidentLogsEnabled", d.IsIncidentLogsEnabled) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCollectionOptions. -func (d *DataCollectionOptions) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExadbVMClusterListResult. +func (e *ExadbVMClusterListResult) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { - case "isDiagnosticsEventsEnabled": - err = unpopulate(val, "IsDiagnosticsEventsEnabled", &d.IsDiagnosticsEventsEnabled) - delete(rawMsg, key) - case "isHealthMonitoringEnabled": - err = unpopulate(val, "IsHealthMonitoringEnabled", &d.IsHealthMonitoringEnabled) + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) delete(rawMsg, key) - case "isIncidentLogsEnabled": - err = unpopulate(val, "IsIncidentLogsEnabled", &d.IsIncidentLogsEnabled) + case "value": + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DayOfWeek. -func (d DayOfWeek) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExadbVMClusterProperties. +func (e ExadbVMClusterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", d.Name) + populate(objectMap, "backupSubnetCidr", e.BackupSubnetCidr) + populate(objectMap, "backupSubnetOcid", e.BackupSubnetOcid) + populate(objectMap, "clusterName", e.ClusterName) + populate(objectMap, "dataCollectionOptions", e.DataCollectionOptions) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "domain", e.Domain) + populate(objectMap, "enabledEcpuCount", e.EnabledEcpuCount) + populate(objectMap, "exascaleDbStorageVaultId", e.ExascaleDbStorageVaultID) + populate(objectMap, "giVersion", e.GiVersion) + populate(objectMap, "gridImageOcid", e.GridImageOcid) + populate(objectMap, "gridImageType", e.GridImageType) + populate(objectMap, "hostname", e.Hostname) + populate(objectMap, "iormConfigCache", e.IormConfigCache) + populate(objectMap, "licenseModel", e.LicenseModel) + populate(objectMap, "lifecycleDetails", e.LifecycleDetails) + populate(objectMap, "lifecycleState", e.LifecycleState) + populate(objectMap, "listenerPort", e.ListenerPort) + populate(objectMap, "memorySizeInGbs", e.MemorySizeInGbs) + populate(objectMap, "nodeCount", e.NodeCount) + populate(objectMap, "nsgCidrs", e.NsgCidrs) + populate(objectMap, "nsgUrl", e.NsgURL) + populate(objectMap, "ociUrl", e.OciURL) + populate(objectMap, "ocid", e.Ocid) + populate(objectMap, "privateZoneOcid", e.PrivateZoneOcid) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "sshPublicKeys", e.SSHPublicKeys) + populate(objectMap, "scanDnsName", e.ScanDNSName) + populate(objectMap, "scanDnsRecordId", e.ScanDNSRecordID) + populate(objectMap, "scanIpIds", e.ScanIPIDs) + populate(objectMap, "scanListenerPortTcp", e.ScanListenerPortTCP) + populate(objectMap, "scanListenerPortTcpSsl", e.ScanListenerPortTCPSSL) + populate(objectMap, "shape", e.Shape) + populate(objectMap, "snapshotFileSystemStorage", e.SnapshotFileSystemStorage) + populate(objectMap, "subnetId", e.SubnetID) + populate(objectMap, "subnetOcid", e.SubnetOcid) + populate(objectMap, "systemVersion", e.SystemVersion) + populate(objectMap, "timeZone", e.TimeZone) + populate(objectMap, "totalEcpuCount", e.TotalEcpuCount) + populate(objectMap, "totalFileSystemStorage", e.TotalFileSystemStorage) + populate(objectMap, "vmFileSystemStorage", e.VMFileSystemStorage) + populate(objectMap, "vipIds", e.VipIDs) + populate(objectMap, "vnetId", e.VnetID) + populate(objectMap, "zoneOcid", e.ZoneOcid) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DayOfWeek. -func (d *DayOfWeek) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExadbVMClusterProperties. +func (e *ExadbVMClusterProperties) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &d.Name) + case "backupSubnetCidr": + err = unpopulate(val, "BackupSubnetCidr", &e.BackupSubnetCidr) + delete(rawMsg, key) + case "backupSubnetOcid": + err = unpopulate(val, "BackupSubnetOcid", &e.BackupSubnetOcid) + delete(rawMsg, key) + case "clusterName": + err = unpopulate(val, "ClusterName", &e.ClusterName) + delete(rawMsg, key) + case "dataCollectionOptions": + err = unpopulate(val, "DataCollectionOptions", &e.DataCollectionOptions) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &e.DisplayName) + delete(rawMsg, key) + case "domain": + err = unpopulate(val, "Domain", &e.Domain) + delete(rawMsg, key) + case "enabledEcpuCount": + err = unpopulate(val, "EnabledEcpuCount", &e.EnabledEcpuCount) + delete(rawMsg, key) + case "exascaleDbStorageVaultId": + err = unpopulate(val, "ExascaleDbStorageVaultID", &e.ExascaleDbStorageVaultID) + delete(rawMsg, key) + case "giVersion": + err = unpopulate(val, "GiVersion", &e.GiVersion) + delete(rawMsg, key) + case "gridImageOcid": + err = unpopulate(val, "GridImageOcid", &e.GridImageOcid) + delete(rawMsg, key) + case "gridImageType": + err = unpopulate(val, "GridImageType", &e.GridImageType) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, "Hostname", &e.Hostname) + delete(rawMsg, key) + case "iormConfigCache": + err = unpopulate(val, "IormConfigCache", &e.IormConfigCache) + delete(rawMsg, key) + case "licenseModel": + err = unpopulate(val, "LicenseModel", &e.LicenseModel) + delete(rawMsg, key) + case "lifecycleDetails": + err = unpopulate(val, "LifecycleDetails", &e.LifecycleDetails) + delete(rawMsg, key) + case "lifecycleState": + err = unpopulate(val, "LifecycleState", &e.LifecycleState) + delete(rawMsg, key) + case "listenerPort": + err = unpopulate(val, "ListenerPort", &e.ListenerPort) + delete(rawMsg, key) + case "memorySizeInGbs": + err = unpopulate(val, "MemorySizeInGbs", &e.MemorySizeInGbs) + delete(rawMsg, key) + case "nodeCount": + err = unpopulate(val, "NodeCount", &e.NodeCount) + delete(rawMsg, key) + case "nsgCidrs": + err = unpopulate(val, "NsgCidrs", &e.NsgCidrs) + delete(rawMsg, key) + case "nsgUrl": + err = unpopulate(val, "NsgURL", &e.NsgURL) + delete(rawMsg, key) + case "ociUrl": + err = unpopulate(val, "OciURL", &e.OciURL) + delete(rawMsg, key) + case "ocid": + err = unpopulate(val, "Ocid", &e.Ocid) + delete(rawMsg, key) + case "privateZoneOcid": + err = unpopulate(val, "PrivateZoneOcid", &e.PrivateZoneOcid) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) + delete(rawMsg, key) + case "sshPublicKeys": + err = unpopulate(val, "SSHPublicKeys", &e.SSHPublicKeys) + delete(rawMsg, key) + case "scanDnsName": + err = unpopulate(val, "ScanDNSName", &e.ScanDNSName) + delete(rawMsg, key) + case "scanDnsRecordId": + err = unpopulate(val, "ScanDNSRecordID", &e.ScanDNSRecordID) + delete(rawMsg, key) + case "scanIpIds": + err = unpopulate(val, "ScanIPIDs", &e.ScanIPIDs) + delete(rawMsg, key) + case "scanListenerPortTcp": + err = unpopulate(val, "ScanListenerPortTCP", &e.ScanListenerPortTCP) + delete(rawMsg, key) + case "scanListenerPortTcpSsl": + err = unpopulate(val, "ScanListenerPortTCPSSL", &e.ScanListenerPortTCPSSL) + delete(rawMsg, key) + case "shape": + err = unpopulate(val, "Shape", &e.Shape) + delete(rawMsg, key) + case "snapshotFileSystemStorage": + err = unpopulate(val, "SnapshotFileSystemStorage", &e.SnapshotFileSystemStorage) + delete(rawMsg, key) + case "subnetId": + err = unpopulate(val, "SubnetID", &e.SubnetID) + delete(rawMsg, key) + case "subnetOcid": + err = unpopulate(val, "SubnetOcid", &e.SubnetOcid) + delete(rawMsg, key) + case "systemVersion": + err = unpopulate(val, "SystemVersion", &e.SystemVersion) + delete(rawMsg, key) + case "timeZone": + err = unpopulate(val, "TimeZone", &e.TimeZone) + delete(rawMsg, key) + case "totalEcpuCount": + err = unpopulate(val, "TotalEcpuCount", &e.TotalEcpuCount) + delete(rawMsg, key) + case "totalFileSystemStorage": + err = unpopulate(val, "TotalFileSystemStorage", &e.TotalFileSystemStorage) + delete(rawMsg, key) + case "vmFileSystemStorage": + err = unpopulate(val, "VMFileSystemStorage", &e.VMFileSystemStorage) + delete(rawMsg, key) + case "vipIds": + err = unpopulate(val, "VipIDs", &e.VipIDs) + delete(rawMsg, key) + case "vnetId": + err = unpopulate(val, "VnetID", &e.VnetID) + delete(rawMsg, key) + case "zoneOcid": + err = unpopulate(val, "ZoneOcid", &e.ZoneOcid) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DayOfWeekUpdate. -func (d DayOfWeekUpdate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExadbVMClusterStorageDetails. +func (e ExadbVMClusterStorageDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "name", d.Name) + populate(objectMap, "totalSizeInGbs", e.TotalSizeInGbs) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DayOfWeekUpdate. -func (d *DayOfWeekUpdate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExadbVMClusterStorageDetails. +func (e *ExadbVMClusterStorageDetails) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { - case "name": - err = unpopulate(val, "Name", &d.Name) + case "totalSizeInGbs": + err = unpopulate(val, "TotalSizeInGbs", &e.TotalSizeInGbs) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DbIormConfig. -func (d DbIormConfig) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExadbVMClusterUpdate. +func (e ExadbVMClusterUpdate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dbName", d.DbName) - populate(objectMap, "flashCacheLimit", d.FlashCacheLimit) - populate(objectMap, "share", d.Share) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "zones", e.Zones) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DbIormConfig. -func (d *DbIormConfig) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExadbVMClusterUpdate. +func (e *ExadbVMClusterUpdate) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { - case "dbName": - err = unpopulate(val, "DbName", &d.DbName) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) delete(rawMsg, key) - case "flashCacheLimit": - err = unpopulate(val, "FlashCacheLimit", &d.FlashCacheLimit) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) delete(rawMsg, key) - case "share": - err = unpopulate(val, "Share", &d.Share) + case "zones": + err = unpopulate(val, "Zones", &e.Zones) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DbNode. -func (d DbNode) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExadbVMClusterUpdateProperties. +func (e ExadbVMClusterUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) + populate(objectMap, "nodeCount", e.NodeCount) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DbNode. -func (d *DbNode) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExadbVMClusterUpdateProperties. +func (e *ExadbVMClusterUpdateProperties) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - 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) + case "nodeCount": + err = unpopulate(val, "NodeCount", &e.NodeCount) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DbNodeAction. -func (d DbNodeAction) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExascaleDbNode. +func (e ExascaleDbNode) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "action", d.Action) + populate(objectMap, "id", e.ID) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DbNodeAction. -func (d *DbNodeAction) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExascaleDbNode. +func (e *ExascaleDbNode) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { - case "action": - err = unpopulate(val, "Action", &d.Action) + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DbNodeListResult. -func (d DbNodeListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExascaleDbNodeListResult. +func (e ExascaleDbNodeListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DbNodeListResult. -func (d *DbNodeListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExascaleDbNodeListResult. +func (e *ExascaleDbNodeListResult) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) + err = unpopulate(val, "NextLink", &e.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &d.Value) + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DbNodeProperties. -func (d DbNodeProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExascaleDbNodeProperties. +func (e ExascaleDbNodeProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "additionalDetails", d.AdditionalDetails) - populate(objectMap, "backupIpId", d.BackupIPID) - populate(objectMap, "backupVnic2Id", d.BackupVnic2ID) - populate(objectMap, "backupVnicId", d.BackupVnicID) - populate(objectMap, "cpuCoreCount", d.CPUCoreCount) - populate(objectMap, "dbNodeStorageSizeInGbs", d.DbNodeStorageSizeInGbs) - populate(objectMap, "dbServerId", d.DbServerID) - populate(objectMap, "dbSystemId", d.DbSystemID) - populate(objectMap, "faultDomain", d.FaultDomain) - populate(objectMap, "hostIpId", d.HostIPID) - populate(objectMap, "hostname", d.Hostname) - populate(objectMap, "lifecycleDetails", d.LifecycleDetails) - populate(objectMap, "lifecycleState", d.LifecycleState) - populate(objectMap, "maintenanceType", d.MaintenanceType) - populate(objectMap, "memorySizeInGbs", d.MemorySizeInGbs) - populate(objectMap, "ocid", d.Ocid) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "softwareStorageSizeInGb", d.SoftwareStorageSizeInGb) - populateDateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) - populateDateTimeRFC3339(objectMap, "timeMaintenanceWindowEnd", d.TimeMaintenanceWindowEnd) - populateDateTimeRFC3339(objectMap, "timeMaintenanceWindowStart", d.TimeMaintenanceWindowStart) - populate(objectMap, "vnic2Id", d.Vnic2ID) - populate(objectMap, "vnicId", d.VnicID) + populate(objectMap, "additionalDetails", e.AdditionalDetails) + populate(objectMap, "cpuCoreCount", e.CPUCoreCount) + populate(objectMap, "dbNodeStorageSizeInGbs", e.DbNodeStorageSizeInGbs) + populate(objectMap, "faultDomain", e.FaultDomain) + populate(objectMap, "hostname", e.Hostname) + populate(objectMap, "lifecycleState", e.LifecycleState) + populate(objectMap, "maintenanceType", e.MaintenanceType) + populate(objectMap, "memorySizeInGbs", e.MemorySizeInGbs) + populate(objectMap, "ocid", e.Ocid) + populate(objectMap, "softwareStorageSizeInGb", e.SoftwareStorageSizeInGb) + populateDateTimeRFC3339(objectMap, "timeMaintenanceWindowEnd", e.TimeMaintenanceWindowEnd) + populateDateTimeRFC3339(objectMap, "timeMaintenanceWindowStart", e.TimeMaintenanceWindowStart) + populate(objectMap, "totalCpuCoreCount", e.TotalCPUCoreCount) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DbNodeProperties. -func (d *DbNodeProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExascaleDbNodeProperties. +func (e *ExascaleDbNodeProperties) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { case "additionalDetails": - err = unpopulate(val, "AdditionalDetails", &d.AdditionalDetails) - delete(rawMsg, key) - case "backupIpId": - err = unpopulate(val, "BackupIPID", &d.BackupIPID) - delete(rawMsg, key) - case "backupVnic2Id": - err = unpopulate(val, "BackupVnic2ID", &d.BackupVnic2ID) - delete(rawMsg, key) - case "backupVnicId": - err = unpopulate(val, "BackupVnicID", &d.BackupVnicID) + err = unpopulate(val, "AdditionalDetails", &e.AdditionalDetails) delete(rawMsg, key) case "cpuCoreCount": - err = unpopulate(val, "CPUCoreCount", &d.CPUCoreCount) + err = unpopulate(val, "CPUCoreCount", &e.CPUCoreCount) delete(rawMsg, key) case "dbNodeStorageSizeInGbs": - err = unpopulate(val, "DbNodeStorageSizeInGbs", &d.DbNodeStorageSizeInGbs) - delete(rawMsg, key) - case "dbServerId": - err = unpopulate(val, "DbServerID", &d.DbServerID) - delete(rawMsg, key) - case "dbSystemId": - err = unpopulate(val, "DbSystemID", &d.DbSystemID) + err = unpopulate(val, "DbNodeStorageSizeInGbs", &e.DbNodeStorageSizeInGbs) delete(rawMsg, key) case "faultDomain": - err = unpopulate(val, "FaultDomain", &d.FaultDomain) - delete(rawMsg, key) - case "hostIpId": - err = unpopulate(val, "HostIPID", &d.HostIPID) + err = unpopulate(val, "FaultDomain", &e.FaultDomain) delete(rawMsg, key) case "hostname": - err = unpopulate(val, "Hostname", &d.Hostname) - delete(rawMsg, key) - case "lifecycleDetails": - err = unpopulate(val, "LifecycleDetails", &d.LifecycleDetails) + err = unpopulate(val, "Hostname", &e.Hostname) delete(rawMsg, key) case "lifecycleState": - err = unpopulate(val, "LifecycleState", &d.LifecycleState) + err = unpopulate(val, "LifecycleState", &e.LifecycleState) delete(rawMsg, key) case "maintenanceType": - err = unpopulate(val, "MaintenanceType", &d.MaintenanceType) + err = unpopulate(val, "MaintenanceType", &e.MaintenanceType) delete(rawMsg, key) case "memorySizeInGbs": - err = unpopulate(val, "MemorySizeInGbs", &d.MemorySizeInGbs) + err = unpopulate(val, "MemorySizeInGbs", &e.MemorySizeInGbs) delete(rawMsg, key) case "ocid": - err = unpopulate(val, "Ocid", &d.Ocid) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + err = unpopulate(val, "Ocid", &e.Ocid) delete(rawMsg, key) case "softwareStorageSizeInGb": - err = unpopulate(val, "SoftwareStorageSizeInGb", &d.SoftwareStorageSizeInGb) - delete(rawMsg, key) - case "timeCreated": - err = unpopulateDateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + err = unpopulate(val, "SoftwareStorageSizeInGb", &e.SoftwareStorageSizeInGb) delete(rawMsg, key) case "timeMaintenanceWindowEnd": - err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceWindowEnd", &d.TimeMaintenanceWindowEnd) + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceWindowEnd", &e.TimeMaintenanceWindowEnd) delete(rawMsg, key) case "timeMaintenanceWindowStart": - err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceWindowStart", &d.TimeMaintenanceWindowStart) - delete(rawMsg, key) - case "vnic2Id": - err = unpopulate(val, "Vnic2ID", &d.Vnic2ID) + err = unpopulateDateTimeRFC3339(val, "TimeMaintenanceWindowStart", &e.TimeMaintenanceWindowStart) delete(rawMsg, key) - case "vnicId": - err = unpopulate(val, "VnicID", &d.VnicID) + case "totalCpuCoreCount": + err = unpopulate(val, "TotalCPUCoreCount", &e.TotalCPUCoreCount) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DbServer. -func (d DbServer) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExascaleDbStorageDetails. +func (e ExascaleDbStorageDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) + populate(objectMap, "availableSizeInGbs", e.AvailableSizeInGbs) + populate(objectMap, "totalSizeInGbs", e.TotalSizeInGbs) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DbServer. -func (d *DbServer) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExascaleDbStorageDetails. +func (e *ExascaleDbStorageDetails) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) + case "availableSizeInGbs": + err = unpopulate(val, "AvailableSizeInGbs", &e.AvailableSizeInGbs) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) + case "totalSizeInGbs": + err = unpopulate(val, "TotalSizeInGbs", &e.TotalSizeInGbs) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DbServerListResult. -func (d DbServerListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExascaleDbStorageInputDetails. +func (e ExascaleDbStorageInputDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "totalSizeInGbs", e.TotalSizeInGbs) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DbServerListResult. -func (d *DbServerListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExascaleDbStorageInputDetails. +func (e *ExascaleDbStorageInputDetails) UnmarshalJSON(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", e, 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) + case "totalSizeInGbs": + err = unpopulate(val, "TotalSizeInGbs", &e.TotalSizeInGbs) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DbServerPatchingDetails. -func (d DbServerPatchingDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExascaleDbStorageVault. +func (e ExascaleDbStorageVault) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "estimatedPatchDuration", d.EstimatedPatchDuration) - populate(objectMap, "patchingStatus", d.PatchingStatus) - populateDateTimeRFC3339(objectMap, "timePatchingEnded", d.TimePatchingEnded) - populateDateTimeRFC3339(objectMap, "timePatchingStarted", d.TimePatchingStarted) + populate(objectMap, "id", e.ID) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) + populate(objectMap, "tags", e.Tags) + populate(objectMap, "type", e.Type) + populate(objectMap, "zones", e.Zones) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DbServerPatchingDetails. -func (d *DbServerPatchingDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExascaleDbStorageVault. +func (e *ExascaleDbStorageVault) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { - case "estimatedPatchDuration": - err = unpopulate(val, "EstimatedPatchDuration", &d.EstimatedPatchDuration) + case "id": + err = unpopulate(val, "ID", &e.ID) delete(rawMsg, key) - case "patchingStatus": - err = unpopulate(val, "PatchingStatus", &d.PatchingStatus) + case "location": + err = unpopulate(val, "Location", &e.Location) delete(rawMsg, key) - case "timePatchingEnded": - err = unpopulateDateTimeRFC3339(val, "TimePatchingEnded", &d.TimePatchingEnded) + case "name": + err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) - case "timePatchingStarted": - err = unpopulateDateTimeRFC3339(val, "TimePatchingStarted", &d.TimePatchingStarted) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &e.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + case "zones": + err = unpopulate(val, "Zones", &e.Zones) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DbServerProperties. -func (d DbServerProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExascaleDbStorageVaultListResult. +func (e ExascaleDbStorageVaultListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "autonomousVmClusterIds", d.AutonomousVMClusterIDs) - populate(objectMap, "autonomousVirtualMachineIds", d.AutonomousVirtualMachineIDs) - populate(objectMap, "cpuCoreCount", d.CPUCoreCount) - populate(objectMap, "compartmentId", d.CompartmentID) - populate(objectMap, "dbNodeIds", d.DbNodeIDs) - populate(objectMap, "dbNodeStorageSizeInGbs", d.DbNodeStorageSizeInGbs) - populate(objectMap, "dbServerPatchingDetails", d.DbServerPatchingDetails) - populate(objectMap, "displayName", d.DisplayName) - populate(objectMap, "exadataInfrastructureId", d.ExadataInfrastructureID) - populate(objectMap, "lifecycleDetails", d.LifecycleDetails) - populate(objectMap, "lifecycleState", d.LifecycleState) - populate(objectMap, "maxCpuCount", d.MaxCPUCount) - populate(objectMap, "maxDbNodeStorageInGbs", d.MaxDbNodeStorageInGbs) - populate(objectMap, "maxMemoryInGbs", d.MaxMemoryInGbs) - populate(objectMap, "memorySizeInGbs", d.MemorySizeInGbs) - populate(objectMap, "ocid", d.Ocid) - populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "shape", d.Shape) - populateDateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) - populate(objectMap, "vmClusterIds", d.VMClusterIDs) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DbServerProperties. -func (d *DbServerProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ExascaleDbStorageVaultListResult. +func (e *ExascaleDbStorageVaultListResult) UnmarshalJSON(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", e, err) } for key, val := range rawMsg { var err error switch key { - case "autonomousVmClusterIds": - err = unpopulate(val, "AutonomousVMClusterIDs", &d.AutonomousVMClusterIDs) - delete(rawMsg, key) - case "autonomousVirtualMachineIds": - err = unpopulate(val, "AutonomousVirtualMachineIDs", &d.AutonomousVirtualMachineIDs) - delete(rawMsg, key) - case "cpuCoreCount": - err = unpopulate(val, "CPUCoreCount", &d.CPUCoreCount) - delete(rawMsg, key) - case "compartmentId": - err = unpopulate(val, "CompartmentID", &d.CompartmentID) + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) delete(rawMsg, key) - case "dbNodeIds": - err = unpopulate(val, "DbNodeIDs", &d.DbNodeIDs) + case "value": + err = unpopulate(val, "Value", &e.Value) delete(rawMsg, key) - case "dbNodeStorageSizeInGbs": - err = unpopulate(val, "DbNodeStorageSizeInGbs", &d.DbNodeStorageSizeInGbs) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExascaleDbStorageVaultProperties. +func (e ExascaleDbStorageVaultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalFlashCacheInPercent", e.AdditionalFlashCacheInPercent) + populate(objectMap, "description", e.Description) + populate(objectMap, "displayName", e.DisplayName) + populate(objectMap, "highCapacityDatabaseStorage", e.HighCapacityDatabaseStorage) + populate(objectMap, "highCapacityDatabaseStorageInput", e.HighCapacityDatabaseStorageInput) + populate(objectMap, "lifecycleDetails", e.LifecycleDetails) + populate(objectMap, "lifecycleState", e.LifecycleState) + populate(objectMap, "ociUrl", e.OciURL) + populate(objectMap, "ocid", e.Ocid) + populate(objectMap, "provisioningState", e.ProvisioningState) + populate(objectMap, "timeZone", e.TimeZone) + populate(objectMap, "vmClusterCount", e.VMClusterCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExascaleDbStorageVaultProperties. +func (e *ExascaleDbStorageVaultProperties) UnmarshalJSON(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 "additionalFlashCacheInPercent": + err = unpopulate(val, "AdditionalFlashCacheInPercent", &e.AdditionalFlashCacheInPercent) delete(rawMsg, key) - case "dbServerPatchingDetails": - err = unpopulate(val, "DbServerPatchingDetails", &d.DbServerPatchingDetails) + case "description": + err = unpopulate(val, "Description", &e.Description) delete(rawMsg, key) case "displayName": - err = unpopulate(val, "DisplayName", &d.DisplayName) + err = unpopulate(val, "DisplayName", &e.DisplayName) delete(rawMsg, key) - case "exadataInfrastructureId": - err = unpopulate(val, "ExadataInfrastructureID", &d.ExadataInfrastructureID) + case "highCapacityDatabaseStorage": + err = unpopulate(val, "HighCapacityDatabaseStorage", &e.HighCapacityDatabaseStorage) + delete(rawMsg, key) + case "highCapacityDatabaseStorageInput": + err = unpopulate(val, "HighCapacityDatabaseStorageInput", &e.HighCapacityDatabaseStorageInput) delete(rawMsg, key) case "lifecycleDetails": - err = unpopulate(val, "LifecycleDetails", &d.LifecycleDetails) + err = unpopulate(val, "LifecycleDetails", &e.LifecycleDetails) delete(rawMsg, key) case "lifecycleState": - err = unpopulate(val, "LifecycleState", &d.LifecycleState) - delete(rawMsg, key) - case "maxCpuCount": - err = unpopulate(val, "MaxCPUCount", &d.MaxCPUCount) - delete(rawMsg, key) - case "maxDbNodeStorageInGbs": - err = unpopulate(val, "MaxDbNodeStorageInGbs", &d.MaxDbNodeStorageInGbs) - delete(rawMsg, key) - case "maxMemoryInGbs": - err = unpopulate(val, "MaxMemoryInGbs", &d.MaxMemoryInGbs) + err = unpopulate(val, "LifecycleState", &e.LifecycleState) delete(rawMsg, key) - case "memorySizeInGbs": - err = unpopulate(val, "MemorySizeInGbs", &d.MemorySizeInGbs) + case "ociUrl": + err = unpopulate(val, "OciURL", &e.OciURL) delete(rawMsg, key) case "ocid": - err = unpopulate(val, "Ocid", &d.Ocid) + err = unpopulate(val, "Ocid", &e.Ocid) delete(rawMsg, key) case "provisioningState": - err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) + err = unpopulate(val, "ProvisioningState", &e.ProvisioningState) delete(rawMsg, key) - case "shape": - err = unpopulate(val, "Shape", &d.Shape) + case "timeZone": + err = unpopulate(val, "TimeZone", &e.TimeZone) delete(rawMsg, key) - case "timeCreated": - err = unpopulateDateTimeRFC3339(val, "TimeCreated", &d.TimeCreated) + case "vmClusterCount": + err = unpopulate(val, "VMClusterCount", &e.VMClusterCount) delete(rawMsg, key) - case "vmClusterIds": - err = unpopulate(val, "VMClusterIDs", &d.VMClusterIDs) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExascaleDbStorageVaultTagsUpdate. +func (e ExascaleDbStorageVaultTagsUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", e.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExascaleDbStorageVaultTagsUpdate. +func (e *ExascaleDbStorageVaultTagsUpdate) UnmarshalJSON(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 "tags": + err = unpopulate(val, "Tags", &e.Tags) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", e, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DbSystemShape. -func (d DbSystemShape) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FileSystemConfigurationDetails. +func (f FileSystemConfigurationDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", d.ID) - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "systemData", d.SystemData) - populate(objectMap, "type", d.Type) + populate(objectMap, "fileSystemSizeGb", f.FileSystemSizeGb) + populate(objectMap, "mountPoint", f.MountPoint) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DbSystemShape. -func (d *DbSystemShape) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FileSystemConfigurationDetails. +func (f *FileSystemConfigurationDetails) UnmarshalJSON(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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "fileSystemSizeGb": + err = unpopulate(val, "FileSystemSizeGb", &f.FileSystemSizeGb) + delete(rawMsg, key) + case "mountPoint": + err = unpopulate(val, "MountPoint", &f.MountPoint) + 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 FlexComponent. +func (f FlexComponent) 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 FlexComponent. +func (f *FlexComponent) UnmarshalJSON(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", &d.ID) + err = unpopulate(val, "ID", &f.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &d.Name) + err = unpopulate(val, "Name", &f.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &d.Properties) + err = unpopulate(val, "Properties", &f.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &d.SystemData) + err = unpopulate(val, "SystemData", &f.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &d.Type) + err = unpopulate(val, "Type", &f.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DbSystemShapeListResult. -func (d DbSystemShapeListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FlexComponentListResult. +func (f FlexComponentListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", d.NextLink) - populate(objectMap, "value", d.Value) + populate(objectMap, "nextLink", f.NextLink) + populate(objectMap, "value", f.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DbSystemShapeListResult. -func (d *DbSystemShapeListResult) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FlexComponentListResult. +func (f *FlexComponentListResult) UnmarshalJSON(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", f, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &d.NextLink) + err = unpopulate(val, "NextLink", &f.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &d.Value) + err = unpopulate(val, "Value", &f.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type DbSystemShapeProperties. -func (d DbSystemShapeProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FlexComponentProperties. +func (f FlexComponentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "availableCoreCount", d.AvailableCoreCount) - populate(objectMap, "availableCoreCountPerNode", d.AvailableCoreCountPerNode) - populate(objectMap, "availableDataStorageInTbs", d.AvailableDataStorageInTbs) - populate(objectMap, "availableDataStoragePerServerInTbs", d.AvailableDataStoragePerServerInTbs) - populate(objectMap, "availableDbNodePerNodeInGbs", d.AvailableDbNodePerNodeInGbs) - populate(objectMap, "availableDbNodeStorageInGbs", d.AvailableDbNodeStorageInGbs) - populate(objectMap, "availableMemoryInGbs", d.AvailableMemoryInGbs) - populate(objectMap, "availableMemoryPerNodeInGbs", d.AvailableMemoryPerNodeInGbs) - populate(objectMap, "coreCountIncrement", d.CoreCountIncrement) - populate(objectMap, "maxStorageCount", d.MaxStorageCount) - populate(objectMap, "maximumNodeCount", d.MaximumNodeCount) - populate(objectMap, "minCoreCountPerNode", d.MinCoreCountPerNode) - populate(objectMap, "minDataStorageInTbs", d.MinDataStorageInTbs) - populate(objectMap, "minDbNodeStoragePerNodeInGbs", d.MinDbNodeStoragePerNodeInGbs) - populate(objectMap, "minMemoryPerNodeInGbs", d.MinMemoryPerNodeInGbs) - populate(objectMap, "minStorageCount", d.MinStorageCount) - populate(objectMap, "minimumCoreCount", d.MinimumCoreCount) - populate(objectMap, "minimumNodeCount", d.MinimumNodeCount) - populate(objectMap, "runtimeMinimumCoreCount", d.RuntimeMinimumCoreCount) - populate(objectMap, "shapeFamily", d.ShapeFamily) + populate(objectMap, "availableCoreCount", f.AvailableCoreCount) + populate(objectMap, "availableDbStorageInGbs", f.AvailableDbStorageInGbs) + populate(objectMap, "availableLocalStorageInGbs", f.AvailableLocalStorageInGbs) + populate(objectMap, "availableMemoryInGbs", f.AvailableMemoryInGbs) + populate(objectMap, "computeModel", f.ComputeModel) + populate(objectMap, "descriptionSummary", f.DescriptionSummary) + populate(objectMap, "hardwareType", f.HardwareType) + populate(objectMap, "minimumCoreCount", f.MinimumCoreCount) + populate(objectMap, "runtimeMinimumCoreCount", f.RuntimeMinimumCoreCount) + populate(objectMap, "shape", f.Shape) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DbSystemShapeProperties. -func (d *DbSystemShapeProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FlexComponentProperties. +func (f *FlexComponentProperties) UnmarshalJSON(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", f, err) } for key, val := range rawMsg { var err error switch key { case "availableCoreCount": - err = unpopulate(val, "AvailableCoreCount", &d.AvailableCoreCount) - delete(rawMsg, key) - case "availableCoreCountPerNode": - err = unpopulate(val, "AvailableCoreCountPerNode", &d.AvailableCoreCountPerNode) - delete(rawMsg, key) - case "availableDataStorageInTbs": - err = unpopulate(val, "AvailableDataStorageInTbs", &d.AvailableDataStorageInTbs) + err = unpopulate(val, "AvailableCoreCount", &f.AvailableCoreCount) delete(rawMsg, key) - case "availableDataStoragePerServerInTbs": - err = unpopulate(val, "AvailableDataStoragePerServerInTbs", &d.AvailableDataStoragePerServerInTbs) - delete(rawMsg, key) - case "availableDbNodePerNodeInGbs": - err = unpopulate(val, "AvailableDbNodePerNodeInGbs", &d.AvailableDbNodePerNodeInGbs) + case "availableDbStorageInGbs": + err = unpopulate(val, "AvailableDbStorageInGbs", &f.AvailableDbStorageInGbs) delete(rawMsg, key) - case "availableDbNodeStorageInGbs": - err = unpopulate(val, "AvailableDbNodeStorageInGbs", &d.AvailableDbNodeStorageInGbs) + case "availableLocalStorageInGbs": + err = unpopulate(val, "AvailableLocalStorageInGbs", &f.AvailableLocalStorageInGbs) delete(rawMsg, key) case "availableMemoryInGbs": - err = unpopulate(val, "AvailableMemoryInGbs", &d.AvailableMemoryInGbs) - delete(rawMsg, key) - case "availableMemoryPerNodeInGbs": - err = unpopulate(val, "AvailableMemoryPerNodeInGbs", &d.AvailableMemoryPerNodeInGbs) - delete(rawMsg, key) - case "coreCountIncrement": - err = unpopulate(val, "CoreCountIncrement", &d.CoreCountIncrement) - delete(rawMsg, key) - case "maxStorageCount": - err = unpopulate(val, "MaxStorageCount", &d.MaxStorageCount) - delete(rawMsg, key) - case "maximumNodeCount": - err = unpopulate(val, "MaximumNodeCount", &d.MaximumNodeCount) - delete(rawMsg, key) - case "minCoreCountPerNode": - err = unpopulate(val, "MinCoreCountPerNode", &d.MinCoreCountPerNode) - delete(rawMsg, key) - case "minDataStorageInTbs": - err = unpopulate(val, "MinDataStorageInTbs", &d.MinDataStorageInTbs) + err = unpopulate(val, "AvailableMemoryInGbs", &f.AvailableMemoryInGbs) delete(rawMsg, key) - case "minDbNodeStoragePerNodeInGbs": - err = unpopulate(val, "MinDbNodeStoragePerNodeInGbs", &d.MinDbNodeStoragePerNodeInGbs) + case "computeModel": + err = unpopulate(val, "ComputeModel", &f.ComputeModel) delete(rawMsg, key) - case "minMemoryPerNodeInGbs": - err = unpopulate(val, "MinMemoryPerNodeInGbs", &d.MinMemoryPerNodeInGbs) + case "descriptionSummary": + err = unpopulate(val, "DescriptionSummary", &f.DescriptionSummary) delete(rawMsg, key) - case "minStorageCount": - err = unpopulate(val, "MinStorageCount", &d.MinStorageCount) + case "hardwareType": + err = unpopulate(val, "HardwareType", &f.HardwareType) delete(rawMsg, key) case "minimumCoreCount": - err = unpopulate(val, "MinimumCoreCount", &d.MinimumCoreCount) - delete(rawMsg, key) - case "minimumNodeCount": - err = unpopulate(val, "MinimumNodeCount", &d.MinimumNodeCount) + err = unpopulate(val, "MinimumCoreCount", &f.MinimumCoreCount) delete(rawMsg, key) case "runtimeMinimumCoreCount": - err = unpopulate(val, "RuntimeMinimumCoreCount", &d.RuntimeMinimumCoreCount) + err = unpopulate(val, "RuntimeMinimumCoreCount", &f.RuntimeMinimumCoreCount) delete(rawMsg, key) - case "shapeFamily": - err = unpopulate(val, "ShapeFamily", &d.ShapeFamily) + case "shape": + err = unpopulate(val, "Shape", &f.Shape) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", d, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type EstimatedPatchingTime. -func (e EstimatedPatchingTime) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GenerateAutonomousDatabaseWalletDetails. +func (g GenerateAutonomousDatabaseWalletDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "estimatedDbServerPatchingTime", e.EstimatedDbServerPatchingTime) - populate(objectMap, "estimatedNetworkSwitchesPatchingTime", e.EstimatedNetworkSwitchesPatchingTime) - populate(objectMap, "estimatedStorageServerPatchingTime", e.EstimatedStorageServerPatchingTime) - populate(objectMap, "totalEstimatedPatchingTime", e.TotalEstimatedPatchingTime) + populate(objectMap, "generateType", g.GenerateType) + populate(objectMap, "isRegional", g.IsRegional) + populate(objectMap, "password", g.Password) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type EstimatedPatchingTime. -func (e *EstimatedPatchingTime) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateAutonomousDatabaseWalletDetails. +func (g *GenerateAutonomousDatabaseWalletDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "estimatedDbServerPatchingTime": - err = unpopulate(val, "EstimatedDbServerPatchingTime", &e.EstimatedDbServerPatchingTime) - delete(rawMsg, key) - case "estimatedNetworkSwitchesPatchingTime": - err = unpopulate(val, "EstimatedNetworkSwitchesPatchingTime", &e.EstimatedNetworkSwitchesPatchingTime) + case "generateType": + err = unpopulate(val, "GenerateType", &g.GenerateType) delete(rawMsg, key) - case "estimatedStorageServerPatchingTime": - err = unpopulate(val, "EstimatedStorageServerPatchingTime", &e.EstimatedStorageServerPatchingTime) + case "isRegional": + err = unpopulate(val, "IsRegional", &g.IsRegional) delete(rawMsg, key) - case "totalEstimatedPatchingTime": - err = unpopulate(val, "TotalEstimatedPatchingTime", &e.TotalEstimatedPatchingTime) + case "password": + err = unpopulate(val, "Password", &g.Password) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type ExadataIormConfig. -func (e ExadataIormConfig) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GiMinorVersion. +func (g GiMinorVersion) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dbPlans", e.DbPlans) - populate(objectMap, "lifecycleDetails", e.LifecycleDetails) - populate(objectMap, "lifecycleState", e.LifecycleState) - populate(objectMap, "objective", e.Objective) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) + populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExadataIormConfig. -func (e *ExadataIormConfig) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GiMinorVersion. +func (g *GiMinorVersion) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } for key, val := range rawMsg { var err error switch key { - case "dbPlans": - err = unpopulate(val, "DbPlans", &e.DbPlans) + case "id": + err = unpopulate(val, "ID", &g.ID) delete(rawMsg, key) - case "lifecycleDetails": - err = unpopulate(val, "LifecycleDetails", &e.LifecycleDetails) + case "name": + err = unpopulate(val, "Name", &g.Name) delete(rawMsg, key) - case "lifecycleState": - err = unpopulate(val, "LifecycleState", &e.LifecycleState) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) - case "objective": - err = unpopulate(val, "Objective", &e.Objective) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", g, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type GenerateAutonomousDatabaseWalletDetails. -func (g GenerateAutonomousDatabaseWalletDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type GiMinorVersionListResult. +func (g GiMinorVersionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "generateType", g.GenerateType) - populate(objectMap, "isRegional", g.IsRegional) - populate(objectMap, "password", g.Password) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GenerateAutonomousDatabaseWalletDetails. -func (g *GenerateAutonomousDatabaseWalletDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type GiMinorVersionListResult. +func (g *GiMinorVersionListResult) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", g, err) @@ -3933,14 +5729,42 @@ func (g *GenerateAutonomousDatabaseWalletDetails) UnmarshalJSON(data []byte) err for key, val := range rawMsg { var err error switch key { - case "generateType": - err = unpopulate(val, "GenerateType", &g.GenerateType) + case "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) delete(rawMsg, key) - case "isRegional": - err = unpopulate(val, "IsRegional", &g.IsRegional) + case "value": + err = unpopulate(val, "Value", &g.Value) delete(rawMsg, key) - case "password": - err = unpopulate(val, "Password", &g.Password) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GiMinorVersionProperties. +func (g GiMinorVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "gridImageOcid", g.GridImageOcid) + populate(objectMap, "version", g.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GiMinorVersionProperties. +func (g *GiMinorVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "gridImageOcid": + err = unpopulate(val, "GridImageOcid", &g.GridImageOcid) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &g.Version) delete(rawMsg, key) } if err != nil { @@ -4405,9 +6229,12 @@ func (o *OracleSubscriptionListResult) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type OracleSubscriptionProperties. func (o OracleSubscriptionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "addSubscriptionOperationState", o.AddSubscriptionOperationState) + populate(objectMap, "azureSubscriptionIds", o.AzureSubscriptionIDs) populate(objectMap, "cloudAccountId", o.CloudAccountID) populate(objectMap, "cloudAccountState", o.CloudAccountState) populate(objectMap, "intent", o.Intent) + populate(objectMap, "lastOperationStatusDetail", o.LastOperationStatusDetail) populate(objectMap, "productCode", o.ProductCode) populate(objectMap, "provisioningState", o.ProvisioningState) populate(objectMap, "saasSubscriptionId", o.SaasSubscriptionID) @@ -4424,6 +6251,12 @@ func (o *OracleSubscriptionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "addSubscriptionOperationState": + err = unpopulate(val, "AddSubscriptionOperationState", &o.AddSubscriptionOperationState) + delete(rawMsg, key) + case "azureSubscriptionIds": + err = unpopulate(val, "AzureSubscriptionIDs", &o.AzureSubscriptionIDs) + delete(rawMsg, key) case "cloudAccountId": err = unpopulate(val, "CloudAccountID", &o.CloudAccountID) delete(rawMsg, key) @@ -4433,6 +6266,9 @@ func (o *OracleSubscriptionProperties) UnmarshalJSON(data []byte) error { case "intent": err = unpopulate(val, "Intent", &o.Intent) delete(rawMsg, key) + case "lastOperationStatusDetail": + err = unpopulate(val, "LastOperationStatusDetail", &o.LastOperationStatusDetail) + delete(rawMsg, key) case "productCode": err = unpopulate(val, "ProductCode", &o.ProductCode) delete(rawMsg, key) @@ -4519,6 +6355,8 @@ func (o *OracleSubscriptionUpdateProperties) UnmarshalJSON(data []byte) error { func (p PeerDbDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "peerDbId", p.PeerDbID) + populate(objectMap, "peerDbLocation", p.PeerDbLocation) + populate(objectMap, "peerDbOcid", p.PeerDbOcid) return json.Marshal(objectMap) } @@ -4534,6 +6372,12 @@ func (p *PeerDbDetails) UnmarshalJSON(data []byte) error { case "peerDbId": err = unpopulate(val, "PeerDbID", &p.PeerDbID) delete(rawMsg, key) + case "peerDbLocation": + err = unpopulate(val, "PeerDbLocation", &p.PeerDbLocation) + delete(rawMsg, key) + case "peerDbOcid": + err = unpopulate(val, "PeerDbOcid", &p.PeerDbOcid) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -4792,15 +6636,15 @@ func (p *ProfileType) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RestoreAutonomousDatabaseDetails. -func (r RestoreAutonomousDatabaseDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RemoveVirtualMachineFromExadbVMClusterDetails. +func (r RemoveVirtualMachineFromExadbVMClusterDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "timestamp", r.Timestamp) + populate(objectMap, "dbNodes", r.DbNodes) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreAutonomousDatabaseDetails. -func (r *RestoreAutonomousDatabaseDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RemoveVirtualMachineFromExadbVMClusterDetails. +func (r *RemoveVirtualMachineFromExadbVMClusterDetails) UnmarshalJSON(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) @@ -4808,8 +6652,8 @@ func (r *RestoreAutonomousDatabaseDetails) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "timestamp": - err = unpopulateDateTimeRFC3339(val, "Timestamp", &r.Timestamp) + case "dbNodes": + err = unpopulate(val, "DbNodes", &r.DbNodes) delete(rawMsg, key) } if err != nil { @@ -4819,72 +6663,28 @@ func (r *RestoreAutonomousDatabaseDetails) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SaasSubscriptionDetails. -func (s SaasSubscriptionDetails) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RestoreAutonomousDatabaseDetails. +func (r RestoreAutonomousDatabaseDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", s.ID) - populate(objectMap, "isAutoRenew", s.IsAutoRenew) - populate(objectMap, "isFreeTrial", s.IsFreeTrial) - populate(objectMap, "offerId", s.OfferID) - populate(objectMap, "planId", s.PlanID) - populate(objectMap, "publisherId", s.PublisherID) - populate(objectMap, "purchaserEmailId", s.PurchaserEmailID) - populate(objectMap, "purchaserTenantId", s.PurchaserTenantID) - populate(objectMap, "saasSubscriptionStatus", s.SaasSubscriptionStatus) - populate(objectMap, "subscriptionName", s.SubscriptionName) - populate(objectMap, "termUnit", s.TermUnit) - populateDateTimeRFC3339(objectMap, "timeCreated", s.TimeCreated) + populateDateTimeRFC3339(objectMap, "timestamp", r.Timestamp) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SaasSubscriptionDetails. -func (s *SaasSubscriptionDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestoreAutonomousDatabaseDetails. +func (r *RestoreAutonomousDatabaseDetails) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &s.ID) - delete(rawMsg, key) - case "isAutoRenew": - err = unpopulate(val, "IsAutoRenew", &s.IsAutoRenew) - delete(rawMsg, key) - case "isFreeTrial": - err = unpopulate(val, "IsFreeTrial", &s.IsFreeTrial) - delete(rawMsg, key) - case "offerId": - err = unpopulate(val, "OfferID", &s.OfferID) - delete(rawMsg, key) - case "planId": - err = unpopulate(val, "PlanID", &s.PlanID) - delete(rawMsg, key) - case "publisherId": - err = unpopulate(val, "PublisherID", &s.PublisherID) - delete(rawMsg, key) - case "purchaserEmailId": - err = unpopulate(val, "PurchaserEmailID", &s.PurchaserEmailID) - delete(rawMsg, key) - case "purchaserTenantId": - err = unpopulate(val, "PurchaserTenantID", &s.PurchaserTenantID) - delete(rawMsg, key) - case "saasSubscriptionStatus": - err = unpopulate(val, "SaasSubscriptionStatus", &s.SaasSubscriptionStatus) - delete(rawMsg, key) - case "subscriptionName": - err = unpopulate(val, "SubscriptionName", &s.SubscriptionName) - delete(rawMsg, key) - case "termUnit": - err = unpopulate(val, "TermUnit", &s.TermUnit) - delete(rawMsg, key) - case "timeCreated": - err = unpopulateDateTimeRFC3339(val, "TimeCreated", &s.TimeCreated) + case "timestamp": + err = unpopulateDateTimeRFC3339(val, "Timestamp", &r.Timestamp) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) + return fmt.Errorf("unmarshalling type %T: %v", r, err) } } return nil @@ -4925,41 +6725,6 @@ func (s *ScheduledOperationsType) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ScheduledOperationsTypeUpdate. -func (s ScheduledOperationsTypeUpdate) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "dayOfWeek", s.DayOfWeek) - populate(objectMap, "scheduledStartTime", s.ScheduledStartTime) - populate(objectMap, "scheduledStopTime", s.ScheduledStopTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScheduledOperationsTypeUpdate. -func (s *ScheduledOperationsTypeUpdate) UnmarshalJSON(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 "dayOfWeek": - err = unpopulate(val, "DayOfWeek", &s.DayOfWeek) - delete(rawMsg, key) - case "scheduledStartTime": - err = unpopulate(val, "ScheduledStartTime", &s.ScheduledStartTime) - delete(rawMsg, key) - case "scheduledStopTime": - err = unpopulate(val, "ScheduledStopTime", &s.ScheduledStopTime) - 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) diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client.go index 3afa79d96e07..4f9d7545a779 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/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 armoracledatabase @@ -39,7 +35,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - List the operations for the provider // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-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/Oracle.Database/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-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client_example_test.go index fc5cc5ef79a8..b4283dc9e4b7 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/operations_client_example_test.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/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 armoracledatabase_test import ( "context" - "log" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/operations_list.json +// Generated from example definition: 2025-03-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 := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } @@ -39,18 +33,21 @@ 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 = armoracledatabase.OperationListResult{ - // Value: []*armoracledatabase.Operation{ - // { - // Name: to.Ptr("Oracle.Database/cloudExadataInfrastructures/Read"), - // Display: &armoracledatabase.OperationDisplay{ - // Description: to.Ptr("Reads Exadata Infrastructure"), - // Operation: to.Ptr("Get/list Exadata Infrastructure resources"), - // Provider: to.Ptr("Oracle.Database"), - // Resource: to.Ptr("cloudExadataInfrastructures"), + // page = armoracledatabase.OperationsClientListResponse{ + // OperationListResult: armoracledatabase.OperationListResult{ + // Value: []*armoracledatabase.Operation{ + // { + // Name: to.Ptr("Oracle.Database/cloudExadataInfrastructures/Read"), + // IsDataAction: to.Ptr(false), + // Display: &armoracledatabase.OperationDisplay{ + // Provider: to.Ptr("Oracle.Database"), + // Resource: to.Ptr("cloudExadataInfrastructures"), + // Operation: to.Ptr("Get/list Exadata Infrastructure resources"), + // Description: to.Ptr("Reads Exadata Infrastructure"), + // }, // }, - // IsDataAction: to.Ptr(false), - // }}, + // }, + // }, // } } } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/options.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/options.go index 3ff90a3ca86e..ec90ab66cb26 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/options.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/options.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 armoracledatabase // AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.BeginCreateOrUpdate // method. type AutonomousDatabaseBackupsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AutonomousDatabaseBackupsClientBeginDeleteOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.BeginDelete // method. type AutonomousDatabaseBackupsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AutonomousDatabaseBackupsClientBeginUpdateOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.BeginUpdate // method. type AutonomousDatabaseBackupsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -35,9 +31,9 @@ type AutonomousDatabaseBackupsClientGetOptions struct { // placeholder for future optional parameters } -// AutonomousDatabaseBackupsClientListByAutonomousDatabaseOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager +// AutonomousDatabaseBackupsClientListByParentOptions contains the optional parameters for the AutonomousDatabaseBackupsClient.NewListByParentPager // method. -type AutonomousDatabaseBackupsClientListByAutonomousDatabaseOptions struct { +type AutonomousDatabaseBackupsClientListByParentOptions struct { // placeholder for future optional parameters } @@ -77,52 +73,59 @@ type AutonomousDatabaseVersionsClientListByLocationOptions struct { // placeholder for future optional parameters } +// AutonomousDatabasesClientBeginChangeDisasterRecoveryConfigurationOptions contains the optional parameters for the AutonomousDatabasesClient.BeginChangeDisasterRecoveryConfiguration +// method. +type AutonomousDatabasesClientBeginChangeDisasterRecoveryConfigurationOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + // AutonomousDatabasesClientBeginCreateOrUpdateOptions contains the optional parameters for the AutonomousDatabasesClient.BeginCreateOrUpdate // method. type AutonomousDatabasesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AutonomousDatabasesClientBeginDeleteOptions contains the optional parameters for the AutonomousDatabasesClient.BeginDelete // method. type AutonomousDatabasesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AutonomousDatabasesClientBeginFailoverOptions contains the optional parameters for the AutonomousDatabasesClient.BeginFailover // method. type AutonomousDatabasesClientBeginFailoverOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AutonomousDatabasesClientBeginRestoreOptions contains the optional parameters for the AutonomousDatabasesClient.BeginRestore // method. type AutonomousDatabasesClientBeginRestoreOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AutonomousDatabasesClientBeginShrinkOptions contains the optional parameters for the AutonomousDatabasesClient.BeginShrink // method. type AutonomousDatabasesClientBeginShrinkOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AutonomousDatabasesClientBeginSwitchoverOptions contains the optional parameters for the AutonomousDatabasesClient.BeginSwitchover // method. type AutonomousDatabasesClientBeginSwitchoverOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AutonomousDatabasesClientBeginUpdateOptions contains the optional parameters for the AutonomousDatabasesClient.BeginUpdate // method. type AutonomousDatabasesClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -152,28 +155,28 @@ type AutonomousDatabasesClientListBySubscriptionOptions struct { // CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginAddStorageCapacity // method. type CloudExadataInfrastructuresClientBeginAddStorageCapacityOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginCreateOrUpdate // method. type CloudExadataInfrastructuresClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudExadataInfrastructuresClientBeginDeleteOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginDelete // method. type CloudExadataInfrastructuresClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudExadataInfrastructuresClientBeginUpdateOptions contains the optional parameters for the CloudExadataInfrastructuresClient.BeginUpdate // method. type CloudExadataInfrastructuresClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -197,33 +200,33 @@ type CloudExadataInfrastructuresClientListBySubscriptionOptions struct { // CloudVMClustersClientBeginAddVMsOptions contains the optional parameters for the CloudVMClustersClient.BeginAddVMs method. type CloudVMClustersClientBeginAddVMsOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudVMClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the CloudVMClustersClient.BeginCreateOrUpdate // method. type CloudVMClustersClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudVMClustersClientBeginDeleteOptions contains the optional parameters for the CloudVMClustersClient.BeginDelete method. type CloudVMClustersClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudVMClustersClientBeginRemoveVMsOptions contains the optional parameters for the CloudVMClustersClient.BeginRemoveVMs // method. type CloudVMClustersClientBeginRemoveVMsOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // CloudVMClustersClientBeginUpdateOptions contains the optional parameters for the CloudVMClustersClient.BeginUpdate method. type CloudVMClustersClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -274,7 +277,7 @@ type DNSPrivateZonesClientListByLocationOptions struct { // DbNodesClientBeginActionOptions contains the optional parameters for the DbNodesClient.BeginAction method. type DbNodesClientBeginActionOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -283,9 +286,8 @@ type DbNodesClientGetOptions struct { // placeholder for future optional parameters } -// DbNodesClientListByCloudVMClusterOptions contains the optional parameters for the DbNodesClient.NewListByCloudVMClusterPager -// method. -type DbNodesClientListByCloudVMClusterOptions struct { +// DbNodesClientListByParentOptions contains the optional parameters for the DbNodesClient.NewListByParentPager method. +type DbNodesClientListByParentOptions struct { // placeholder for future optional parameters } @@ -294,9 +296,8 @@ type DbServersClientGetOptions struct { // placeholder for future optional parameters } -// DbServersClientListByCloudExadataInfrastructureOptions contains the optional parameters for the DbServersClient.NewListByCloudExadataInfrastructurePager -// method. -type DbServersClientListByCloudExadataInfrastructureOptions struct { +// DbServersClientListByParentOptions contains the optional parameters for the DbServersClient.NewListByParentPager method. +type DbServersClientListByParentOptions struct { // placeholder for future optional parameters } @@ -308,9 +309,135 @@ type DbSystemShapesClientGetOptions struct { // DbSystemShapesClientListByLocationOptions contains the optional parameters for the DbSystemShapesClient.NewListByLocationPager // method. type DbSystemShapesClientListByLocationOptions struct { + // Filters the result for the given Azure Availability Zone + Zone *string +} + +// ExadbVMClustersClientBeginCreateOrUpdateOptions contains the optional parameters for the ExadbVMClustersClient.BeginCreateOrUpdate +// method. +type ExadbVMClustersClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ExadbVMClustersClientBeginDeleteOptions contains the optional parameters for the ExadbVMClustersClient.BeginDelete method. +type ExadbVMClustersClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ExadbVMClustersClientBeginRemoveVMsOptions contains the optional parameters for the ExadbVMClustersClient.BeginRemoveVMs +// method. +type ExadbVMClustersClientBeginRemoveVMsOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ExadbVMClustersClientBeginUpdateOptions contains the optional parameters for the ExadbVMClustersClient.BeginUpdate method. +type ExadbVMClustersClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ExadbVMClustersClientGetOptions contains the optional parameters for the ExadbVMClustersClient.Get method. +type ExadbVMClustersClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExadbVMClustersClientListByResourceGroupOptions contains the optional parameters for the ExadbVMClustersClient.NewListByResourceGroupPager +// method. +type ExadbVMClustersClientListByResourceGroupOptions struct { // placeholder for future optional parameters } +// ExadbVMClustersClientListBySubscriptionOptions contains the optional parameters for the ExadbVMClustersClient.NewListBySubscriptionPager +// method. +type ExadbVMClustersClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// ExascaleDbNodesClientBeginActionOptions contains the optional parameters for the ExascaleDbNodesClient.BeginAction method. +type ExascaleDbNodesClientBeginActionOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ExascaleDbNodesClientGetOptions contains the optional parameters for the ExascaleDbNodesClient.Get method. +type ExascaleDbNodesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExascaleDbNodesClientListByParentOptions contains the optional parameters for the ExascaleDbNodesClient.NewListByParentPager +// method. +type ExascaleDbNodesClientListByParentOptions struct { + // placeholder for future optional parameters +} + +// ExascaleDbStorageVaultsClientBeginCreateOptions contains the optional parameters for the ExascaleDbStorageVaultsClient.BeginCreate +// method. +type ExascaleDbStorageVaultsClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ExascaleDbStorageVaultsClientBeginDeleteOptions contains the optional parameters for the ExascaleDbStorageVaultsClient.BeginDelete +// method. +type ExascaleDbStorageVaultsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ExascaleDbStorageVaultsClientBeginUpdateOptions contains the optional parameters for the ExascaleDbStorageVaultsClient.BeginUpdate +// method. +type ExascaleDbStorageVaultsClientBeginUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// ExascaleDbStorageVaultsClientGetOptions contains the optional parameters for the ExascaleDbStorageVaultsClient.Get method. +type ExascaleDbStorageVaultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ExascaleDbStorageVaultsClientListByResourceGroupOptions contains the optional parameters for the ExascaleDbStorageVaultsClient.NewListByResourceGroupPager +// method. +type ExascaleDbStorageVaultsClientListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// ExascaleDbStorageVaultsClientListBySubscriptionOptions contains the optional parameters for the ExascaleDbStorageVaultsClient.NewListBySubscriptionPager +// method. +type ExascaleDbStorageVaultsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// FlexComponentsClientGetOptions contains the optional parameters for the FlexComponentsClient.Get method. +type FlexComponentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// FlexComponentsClientListByParentOptions contains the optional parameters for the FlexComponentsClient.NewListByParentPager +// method. +type FlexComponentsClientListByParentOptions struct { + // If provided, filters the results for the given shape + Shape *SystemShapes +} + +// GiMinorVersionsClientGetOptions contains the optional parameters for the GiMinorVersionsClient.Get method. +type GiMinorVersionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// GiMinorVersionsClientListByParentOptions contains the optional parameters for the GiMinorVersionsClient.NewListByParentPager +// method. +type GiMinorVersionsClientListByParentOptions struct { + // If provided, filters the results to the set of database versions which are supported for the given shape family. + ShapeFamily *ShapeFamily + + // Filters the result for the given Azure Availability Zone + Zone *string +} + // GiVersionsClientGetOptions contains the optional parameters for the GiVersionsClient.Get method. type GiVersionsClientGetOptions struct { // placeholder for future optional parameters @@ -319,7 +446,11 @@ type GiVersionsClientGetOptions struct { // GiVersionsClientListByLocationOptions contains the optional parameters for the GiVersionsClient.NewListByLocationPager // method. type GiVersionsClientListByLocationOptions struct { - // placeholder for future optional parameters + // If provided, filters the results for the given shape + Shape *SystemShapes + + // Filters the result for the given Azure Availability Zone + Zone *string } // OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. @@ -327,45 +458,52 @@ type OperationsClientListOptions struct { // placeholder for future optional parameters } +// OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginAddAzureSubscriptions +// method. +type OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + // OracleSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the OracleSubscriptionsClient.BeginCreateOrUpdate // method. type OracleSubscriptionsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // OracleSubscriptionsClientBeginDeleteOptions contains the optional parameters for the OracleSubscriptionsClient.BeginDelete // method. type OracleSubscriptionsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // OracleSubscriptionsClientBeginListActivationLinksOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListActivationLinks // method. type OracleSubscriptionsClientBeginListActivationLinksOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // OracleSubscriptionsClientBeginListCloudAccountDetailsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListCloudAccountDetails // method. type OracleSubscriptionsClientBeginListCloudAccountDetailsOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListSaasSubscriptionDetails // method. type OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // OracleSubscriptionsClientBeginUpdateOptions contains the optional parameters for the OracleSubscriptionsClient.BeginUpdate // method. type OracleSubscriptionsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -394,14 +532,14 @@ type SystemVersionsClientListByLocationOptions struct { // VirtualNetworkAddressesClientBeginCreateOrUpdateOptions contains the optional parameters for the VirtualNetworkAddressesClient.BeginCreateOrUpdate // method. type VirtualNetworkAddressesClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // VirtualNetworkAddressesClientBeginDeleteOptions contains the optional parameters for the VirtualNetworkAddressesClient.BeginDelete // method. type VirtualNetworkAddressesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -410,8 +548,8 @@ type VirtualNetworkAddressesClientGetOptions struct { // placeholder for future optional parameters } -// VirtualNetworkAddressesClientListByCloudVMClusterOptions contains the optional parameters for the VirtualNetworkAddressesClient.NewListByCloudVMClusterPager +// VirtualNetworkAddressesClientListByParentOptions contains the optional parameters for the VirtualNetworkAddressesClient.NewListByParentPager // method. -type VirtualNetworkAddressesClientListByCloudVMClusterOptions struct { +type VirtualNetworkAddressesClientListByParentOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client.go index 9b251202d11f..8429819c6192 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_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 armoracledatabase @@ -43,10 +39,81 @@ func NewOracleSubscriptionsClient(subscriptionID string, credential azcore.Token return client, nil } +// BeginAddAzureSubscriptions - Add Azure Subscriptions +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +// - body - The content of the action request +// - options - OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginAddAzureSubscriptions +// method. +func (client *OracleSubscriptionsClient) BeginAddAzureSubscriptions(ctx context.Context, body AzureSubscriptions, options *OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions) (*runtime.Poller[OracleSubscriptionsClientAddAzureSubscriptionsResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.addAzureSubscriptions(ctx, body, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientAddAzureSubscriptionsResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[OracleSubscriptionsClientAddAzureSubscriptionsResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// AddAzureSubscriptions - Add Azure Subscriptions +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-03-01 +func (client *OracleSubscriptionsClient) addAzureSubscriptions(ctx context.Context, body AzureSubscriptions, options *OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions) (*http.Response, error) { + var err error + const operationName = "OracleSubscriptionsClient.BeginAddAzureSubscriptions" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.addAzureSubscriptionsCreateRequest(ctx, body, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// addAzureSubscriptionsCreateRequest creates the AddAzureSubscriptions request. +func (client *OracleSubscriptionsClient) addAzureSubscriptionsCreateRequest(ctx context.Context, body AzureSubscriptions, _ *OracleSubscriptionsClientBeginAddAzureSubscriptionsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/addAzureSubscriptions" + 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-03-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 +} + // BeginCreateOrUpdate - Create a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resource - Resource create parameters. // - options - OracleSubscriptionsClientBeginCreateOrUpdateOptions contains the optional parameters for the OracleSubscriptionsClient.BeginCreateOrUpdate // method. @@ -57,8 +124,7 @@ func (client *OracleSubscriptionsClient) BeginCreateOrUpdate(ctx context.Context return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -71,7 +137,7 @@ func (client *OracleSubscriptionsClient) BeginCreateOrUpdate(ctx context.Context // CreateOrUpdate - Create a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *OracleSubscriptionsClient) createOrUpdate(ctx context.Context, resource OracleSubscription, options *OracleSubscriptionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "OracleSubscriptionsClient.BeginCreateOrUpdate" @@ -94,7 +160,7 @@ func (client *OracleSubscriptionsClient) createOrUpdate(ctx context.Context, res } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *OracleSubscriptionsClient) createOrUpdateCreateRequest(ctx context.Context, resource OracleSubscription, options *OracleSubscriptionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *OracleSubscriptionsClient) createOrUpdateCreateRequest(ctx context.Context, resource OracleSubscription, _ *OracleSubscriptionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -105,9 +171,10 @@ func (client *OracleSubscriptionsClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -117,7 +184,7 @@ func (client *OracleSubscriptionsClient) createOrUpdateCreateRequest(ctx context // BeginDelete - Delete a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - options - OracleSubscriptionsClientBeginDeleteOptions contains the optional parameters for the OracleSubscriptionsClient.BeginDelete // method. func (client *OracleSubscriptionsClient) BeginDelete(ctx context.Context, options *OracleSubscriptionsClientBeginDeleteOptions) (*runtime.Poller[OracleSubscriptionsClientDeleteResponse], error) { @@ -127,8 +194,7 @@ func (client *OracleSubscriptionsClient) BeginDelete(ctx context.Context, option return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -141,7 +207,7 @@ func (client *OracleSubscriptionsClient) BeginDelete(ctx context.Context, option // Delete - Delete a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *OracleSubscriptionsClient) deleteOperation(ctx context.Context, options *OracleSubscriptionsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "OracleSubscriptionsClient.BeginDelete" @@ -164,7 +230,7 @@ func (client *OracleSubscriptionsClient) deleteOperation(ctx context.Context, op } // deleteCreateRequest creates the Delete request. -func (client *OracleSubscriptionsClient) deleteCreateRequest(ctx context.Context, options *OracleSubscriptionsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *OracleSubscriptionsClient) deleteCreateRequest(ctx context.Context, _ *OracleSubscriptionsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -175,7 +241,7 @@ func (client *OracleSubscriptionsClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -184,7 +250,7 @@ func (client *OracleSubscriptionsClient) deleteCreateRequest(ctx context.Context // Get - Get a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - options - OracleSubscriptionsClientGetOptions contains the optional parameters for the OracleSubscriptionsClient.Get method. func (client *OracleSubscriptionsClient) Get(ctx context.Context, options *OracleSubscriptionsClientGetOptions) (OracleSubscriptionsClientGetResponse, error) { var err error @@ -209,7 +275,7 @@ func (client *OracleSubscriptionsClient) Get(ctx context.Context, options *Oracl } // getCreateRequest creates the Get request. -func (client *OracleSubscriptionsClient) getCreateRequest(ctx context.Context, options *OracleSubscriptionsClientGetOptions) (*policy.Request, error) { +func (client *OracleSubscriptionsClient) getCreateRequest(ctx context.Context, _ *OracleSubscriptionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -220,7 +286,7 @@ func (client *OracleSubscriptionsClient) getCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -238,7 +304,7 @@ func (client *OracleSubscriptionsClient) getHandleResponse(resp *http.Response) // BeginListActivationLinks - List Activation Links // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - options - OracleSubscriptionsClientBeginListActivationLinksOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListActivationLinks // method. func (client *OracleSubscriptionsClient) BeginListActivationLinks(ctx context.Context, options *OracleSubscriptionsClientBeginListActivationLinksOptions) (*runtime.Poller[OracleSubscriptionsClientListActivationLinksResponse], error) { @@ -248,8 +314,7 @@ func (client *OracleSubscriptionsClient) BeginListActivationLinks(ctx context.Co return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientListActivationLinksResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -262,7 +327,7 @@ func (client *OracleSubscriptionsClient) BeginListActivationLinks(ctx context.Co // ListActivationLinks - List Activation Links // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *OracleSubscriptionsClient) listActivationLinks(ctx context.Context, options *OracleSubscriptionsClientBeginListActivationLinksOptions) (*http.Response, error) { var err error const operationName = "OracleSubscriptionsClient.BeginListActivationLinks" @@ -285,7 +350,7 @@ func (client *OracleSubscriptionsClient) listActivationLinks(ctx context.Context } // listActivationLinksCreateRequest creates the ListActivationLinks request. -func (client *OracleSubscriptionsClient) listActivationLinksCreateRequest(ctx context.Context, options *OracleSubscriptionsClientBeginListActivationLinksOptions) (*policy.Request, error) { +func (client *OracleSubscriptionsClient) listActivationLinksCreateRequest(ctx context.Context, _ *OracleSubscriptionsClientBeginListActivationLinksOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/listActivationLinks" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -296,7 +361,7 @@ func (client *OracleSubscriptionsClient) listActivationLinksCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -304,7 +369,7 @@ func (client *OracleSubscriptionsClient) listActivationLinksCreateRequest(ctx co // NewListBySubscriptionPager - List OracleSubscription resources by subscription ID // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - options - OracleSubscriptionsClientListBySubscriptionOptions contains the optional parameters for the OracleSubscriptionsClient.NewListBySubscriptionPager // method. func (client *OracleSubscriptionsClient) NewListBySubscriptionPager(options *OracleSubscriptionsClientListBySubscriptionOptions) *runtime.Pager[OracleSubscriptionsClientListBySubscriptionResponse] { @@ -331,7 +396,7 @@ func (client *OracleSubscriptionsClient) NewListBySubscriptionPager(options *Ora } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *OracleSubscriptionsClient) listBySubscriptionCreateRequest(ctx context.Context, options *OracleSubscriptionsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *OracleSubscriptionsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *OracleSubscriptionsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -342,7 +407,7 @@ func (client *OracleSubscriptionsClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -360,7 +425,7 @@ func (client *OracleSubscriptionsClient) listBySubscriptionHandleResponse(resp * // BeginListCloudAccountDetails - List Cloud Account Details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - options - OracleSubscriptionsClientBeginListCloudAccountDetailsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListCloudAccountDetails // method. func (client *OracleSubscriptionsClient) BeginListCloudAccountDetails(ctx context.Context, options *OracleSubscriptionsClientBeginListCloudAccountDetailsOptions) (*runtime.Poller[OracleSubscriptionsClientListCloudAccountDetailsResponse], error) { @@ -370,8 +435,7 @@ func (client *OracleSubscriptionsClient) BeginListCloudAccountDetails(ctx contex return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientListCloudAccountDetailsResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -384,7 +448,7 @@ func (client *OracleSubscriptionsClient) BeginListCloudAccountDetails(ctx contex // ListCloudAccountDetails - List Cloud Account Details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *OracleSubscriptionsClient) listCloudAccountDetails(ctx context.Context, options *OracleSubscriptionsClientBeginListCloudAccountDetailsOptions) (*http.Response, error) { var err error const operationName = "OracleSubscriptionsClient.BeginListCloudAccountDetails" @@ -407,7 +471,7 @@ func (client *OracleSubscriptionsClient) listCloudAccountDetails(ctx context.Con } // listCloudAccountDetailsCreateRequest creates the ListCloudAccountDetails request. -func (client *OracleSubscriptionsClient) listCloudAccountDetailsCreateRequest(ctx context.Context, options *OracleSubscriptionsClientBeginListCloudAccountDetailsOptions) (*policy.Request, error) { +func (client *OracleSubscriptionsClient) listCloudAccountDetailsCreateRequest(ctx context.Context, _ *OracleSubscriptionsClientBeginListCloudAccountDetailsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/listCloudAccountDetails" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -418,7 +482,7 @@ func (client *OracleSubscriptionsClient) listCloudAccountDetailsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -427,7 +491,7 @@ func (client *OracleSubscriptionsClient) listCloudAccountDetailsCreateRequest(ct // BeginListSaasSubscriptionDetails - List Saas Subscription Details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - options - OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions contains the optional parameters for the OracleSubscriptionsClient.BeginListSaasSubscriptionDetails // method. func (client *OracleSubscriptionsClient) BeginListSaasSubscriptionDetails(ctx context.Context, options *OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions) (*runtime.Poller[OracleSubscriptionsClientListSaasSubscriptionDetailsResponse], error) { @@ -437,8 +501,7 @@ func (client *OracleSubscriptionsClient) BeginListSaasSubscriptionDetails(ctx co return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientListSaasSubscriptionDetailsResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -451,7 +514,7 @@ func (client *OracleSubscriptionsClient) BeginListSaasSubscriptionDetails(ctx co // ListSaasSubscriptionDetails - List Saas Subscription Details // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *OracleSubscriptionsClient) listSaasSubscriptionDetails(ctx context.Context, options *OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions) (*http.Response, error) { var err error const operationName = "OracleSubscriptionsClient.BeginListSaasSubscriptionDetails" @@ -474,7 +537,7 @@ func (client *OracleSubscriptionsClient) listSaasSubscriptionDetails(ctx context } // listSaasSubscriptionDetailsCreateRequest creates the ListSaasSubscriptionDetails request. -func (client *OracleSubscriptionsClient) listSaasSubscriptionDetailsCreateRequest(ctx context.Context, options *OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions) (*policy.Request, error) { +func (client *OracleSubscriptionsClient) listSaasSubscriptionDetailsCreateRequest(ctx context.Context, _ *OracleSubscriptionsClientBeginListSaasSubscriptionDetailsOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default/listSaasSubscriptionDetails" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -485,7 +548,7 @@ func (client *OracleSubscriptionsClient) listSaasSubscriptionDetailsCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -494,7 +557,7 @@ func (client *OracleSubscriptionsClient) listSaasSubscriptionDetailsCreateReques // BeginUpdate - Update a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - properties - The resource properties to be updated. // - options - OracleSubscriptionsClientBeginUpdateOptions contains the optional parameters for the OracleSubscriptionsClient.BeginUpdate // method. @@ -505,8 +568,7 @@ func (client *OracleSubscriptionsClient) BeginUpdate(ctx context.Context, proper return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[OracleSubscriptionsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -519,7 +581,7 @@ func (client *OracleSubscriptionsClient) BeginUpdate(ctx context.Context, proper // Update - Update a OracleSubscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *OracleSubscriptionsClient) update(ctx context.Context, properties OracleSubscriptionUpdate, options *OracleSubscriptionsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "OracleSubscriptionsClient.BeginUpdate" @@ -542,7 +604,7 @@ func (client *OracleSubscriptionsClient) update(ctx context.Context, properties } // updateCreateRequest creates the Update request. -func (client *OracleSubscriptionsClient) updateCreateRequest(ctx context.Context, properties OracleSubscriptionUpdate, options *OracleSubscriptionsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *OracleSubscriptionsClient) updateCreateRequest(ctx context.Context, properties OracleSubscriptionUpdate, _ *OracleSubscriptionsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/oracleSubscriptions/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -553,9 +615,10 @@ func (client *OracleSubscriptionsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client_example_test.go index 4c37f167fdbc..a8ae70d3644b 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client_example_test.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/oraclesubscriptions_client_example_test.go @@ -1,167 +1,54 @@ -//go:build go1.18 -// +build go1.18 - // Copyright (c) Microsoft Corporation. All rights 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 armoracledatabase_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/oracledatabase/armoracledatabase" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase/v2" + "log" ) -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_listBySubscription.json -func ExampleOracleSubscriptionsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOracleSubscriptionsClient().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.OracleSubscriptionListResult = armoracledatabase.OracleSubscriptionListResult{ - // Value: []*armoracledatabase.OracleSubscription{ - // { - // Type: to.Ptr("Oracle.Database/oracleSubscriptions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/oracleSubscriptions/default"), - // Plan: &armoracledatabase.Plan{ - // Name: to.Ptr("plan1"), - // Product: to.Ptr("product1"), - // PromotionCode: to.Ptr("none"), - // Publisher: to.Ptr("publisher1"), - // Version: to.Ptr("alpha"), - // }, - // Properties: &armoracledatabase.OracleSubscriptionProperties{ - // CloudAccountID: to.Ptr("ocid1..aaaaaa"), - // CloudAccountState: to.Ptr(armoracledatabase.CloudAccountProvisioningStatePending), - // ProvisioningState: to.Ptr(armoracledatabase.OracleSubscriptionProvisioningStateSucceeded), - // SaasSubscriptionID: to.Ptr("saas1"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_get.json -func ExampleOracleSubscriptionsClient_Get() { +// Generated from example definition: 2025-03-01/oracleSubscriptions_addAzureSubscriptions.json +func ExampleOracleSubscriptionsClient_BeginAddAzureSubscriptions() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewOracleSubscriptionsClient().Get(ctx, 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.OracleSubscription = armoracledatabase.OracleSubscription{ - // Type: to.Ptr("Oracle.Database/oracleSubscriptions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/oracleSubscriptions/default"), - // Plan: &armoracledatabase.Plan{ - // Name: to.Ptr("plan1"), - // Product: to.Ptr("product1"), - // PromotionCode: to.Ptr("none"), - // Publisher: to.Ptr("publisher1"), - // Version: to.Ptr("alpha"), - // }, - // Properties: &armoracledatabase.OracleSubscriptionProperties{ - // CloudAccountID: to.Ptr("ocid1..aaaaaa"), - // CloudAccountState: to.Ptr(armoracledatabase.CloudAccountProvisioningStatePending), - // ProvisioningState: to.Ptr(armoracledatabase.OracleSubscriptionProvisioningStateSucceeded), - // SaasSubscriptionID: to.Ptr("saas1"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_create.json -func ExampleOracleSubscriptionsClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOracleSubscriptionsClient().BeginCreateOrUpdate(ctx, armoracledatabase.OracleSubscription{ - Plan: &armoracledatabase.Plan{ - Name: to.Ptr("plan1"), - Product: to.Ptr("product1"), - PromotionCode: to.Ptr("none"), - Publisher: to.Ptr("publisher1"), - Version: to.Ptr("alpha"), + poller, err := clientFactory.NewOracleSubscriptionsClient().BeginAddAzureSubscriptions(ctx, armoracledatabase.AzureSubscriptions{ + AzureSubscriptionIDs: []*string{ + to.Ptr("00000000-0000-0000-0000-000000000001"), }, - Properties: &armoracledatabase.OracleSubscriptionProperties{}, }, 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.OracleSubscription = armoracledatabase.OracleSubscription{ - // Type: to.Ptr("Oracle.Database/oracleSubscriptions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/oracleSubscriptions/default"), - // Plan: &armoracledatabase.Plan{ - // Name: to.Ptr("plan1"), - // Product: to.Ptr("product1"), - // PromotionCode: to.Ptr("none"), - // Publisher: to.Ptr("publisher1"), - // Version: to.Ptr("alpha"), - // }, - // Properties: &armoracledatabase.OracleSubscriptionProperties{ - // CloudAccountID: to.Ptr("ocid1..aaaaaa"), - // CloudAccountState: to.Ptr(armoracledatabase.CloudAccountProvisioningStatePending), - // ProvisioningState: to.Ptr(armoracledatabase.OracleSubscriptionProvisioningStateSucceeded), - // SaasSubscriptionID: to.Ptr("saas1"), - // }, - // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_patch.json -func ExampleOracleSubscriptionsClient_BeginUpdate() { +// Generated from example definition: 2025-03-01/oracleSubscriptions_listActivationLinks.json +func ExampleOracleSubscriptionsClient_BeginListActivationLinks() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewOracleSubscriptionsClient().BeginUpdate(ctx, armoracledatabase.OracleSubscriptionUpdate{}, nil) + poller, err := clientFactory.NewOracleSubscriptionsClient().BeginListActivationLinks(ctx, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -172,58 +59,22 @@ func ExampleOracleSubscriptionsClient_BeginUpdate() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.OracleSubscription = armoracledatabase.OracleSubscription{ - // Type: to.Ptr("Oracle.Database/oracleSubscriptions"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/oracleSubscriptions/default"), - // Plan: &armoracledatabase.Plan{ - // Name: to.Ptr("plan1"), - // Product: to.Ptr("product1"), - // PromotionCode: to.Ptr("none"), - // Publisher: to.Ptr("publisher1"), - // Version: to.Ptr("alpha"), - // }, - // Properties: &armoracledatabase.OracleSubscriptionProperties{ - // CloudAccountID: to.Ptr("ocid1..aaaaaa"), - // CloudAccountState: to.Ptr(armoracledatabase.CloudAccountProvisioningStatePending), - // ProvisioningState: to.Ptr(armoracledatabase.OracleSubscriptionProvisioningStateSucceeded), - // SaasSubscriptionID: to.Ptr("saas1"), - // }, + // res = armoracledatabase.OracleSubscriptionsClientListActivationLinksResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_delete.json -func ExampleOracleSubscriptionsClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewOracleSubscriptionsClient().BeginDelete(ctx, 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/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_listActivationLinks.json -func ExampleOracleSubscriptionsClient_BeginListActivationLinks() { +// Generated from example definition: 2025-03-01/oracleSubscriptions_listCloudAccountDetails.json +func ExampleOracleSubscriptionsClient_BeginListCloudAccountDetails() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewOracleSubscriptionsClient().BeginListActivationLinks(ctx, nil) + poller, err := clientFactory.NewOracleSubscriptionsClient().BeginListCloudAccountDetails(ctx, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -234,24 +85,22 @@ func ExampleOracleSubscriptionsClient_BeginListActivationLinks() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActivationLinks = armoracledatabase.ActivationLinks{ - // ExistingCloudAccountActivationLink: to.Ptr("https://existing-tenancy-activation-link"), - // NewCloudAccountActivationLink: to.Ptr("https://new-tenancy-activation-link"), + // res = armoracledatabase.OracleSubscriptionsClientListCloudAccountDetailsResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_listCloudAccountDetails.json -func ExampleOracleSubscriptionsClient_BeginListCloudAccountDetails() { +// Generated from example definition: 2025-03-01/oracleSubscriptions_listSaasSubscriptionDetails.json +func ExampleOracleSubscriptionsClient_BeginListSaasSubscriptionDetails() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewOracleSubscriptionsClient().BeginListCloudAccountDetails(ctx, nil) + poller, err := clientFactory.NewOracleSubscriptionsClient().BeginListSaasSubscriptionDetails(ctx, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -262,24 +111,22 @@ func ExampleOracleSubscriptionsClient_BeginListCloudAccountDetails() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CloudAccountDetails = armoracledatabase.CloudAccountDetails{ - // CloudAccountHomeRegion: to.Ptr("East US"), - // CloudAccountName: to.Ptr("Cloud Account"), + // res = armoracledatabase.OracleSubscriptionsClientListSaasSubscriptionDetailsResponse{ // } } -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/oracleSubscriptions_listSaasSubscriptionDetails.json -func ExampleOracleSubscriptionsClient_BeginListSaasSubscriptionDetails() { +// Generated from example definition: 2025-03-01/oracleSubscriptions_patch.json +func ExampleOracleSubscriptionsClient_BeginUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) + clientFactory, err := armoracledatabase.NewClientFactory("00000000-0000-0000-0000-000000000000", cred, nil) if err != nil { log.Fatalf("failed to create client: %v", err) } - poller, err := clientFactory.NewOracleSubscriptionsClient().BeginListSaasSubscriptionDetails(ctx, nil) + poller, err := clientFactory.NewOracleSubscriptionsClient().BeginUpdate(ctx, armoracledatabase.OracleSubscriptionUpdate{}, nil) if err != nil { log.Fatalf("failed to finish the request: %v", err) } @@ -290,18 +137,23 @@ func ExampleOracleSubscriptionsClient_BeginListSaasSubscriptionDetails() { // You could use response here. We use blank identifier for just demo purposes. _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SaasSubscriptionDetails = armoracledatabase.SaasSubscriptionDetails{ - // ID: to.Ptr("1234567890"), - // IsAutoRenew: to.Ptr(true), - // IsFreeTrial: to.Ptr(false), - // OfferID: to.Ptr("offer1"), - // PlanID: to.Ptr("silver"), - // PublisherID: to.Ptr("Oracle"), - // PurchaserEmailID: to.Ptr("test@test.com"), - // PurchaserTenantID: to.Ptr("1234567890"), - // SaasSubscriptionStatus: to.Ptr("PendingFulfillmentStart"), - // SubscriptionName: to.Ptr("Oracle"), - // TermUnit: to.Ptr("P1M"), - // TimeCreated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2022-03-07T00:00:00.000Z"); return t}()), + // res = armoracledatabase.OracleSubscriptionsClientUpdateResponse{ + // OracleSubscription: &armoracledatabase.OracleSubscription{ + // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/oracleSubscriptions/default"), + // Type: to.Ptr("Oracle.Database/oracleSubscriptions"), + // Properties: &armoracledatabase.OracleSubscriptionProperties{ + // ProvisioningState: to.Ptr(armoracledatabase.OracleSubscriptionProvisioningStateSucceeded), + // SaasSubscriptionID: to.Ptr("saas1"), + // CloudAccountID: to.Ptr("ocid1..aaaaaa"), + // CloudAccountState: to.Ptr(armoracledatabase.CloudAccountProvisioningStatePending), + // }, + // Plan: &armoracledatabase.Plan{ + // Name: to.Ptr("plan1"), + // Publisher: to.Ptr("publisher1"), + // Product: to.Ptr("product1"), + // PromotionCode: to.Ptr("none"), + // Version: to.Ptr("alpha"), + // }, + // }, // } } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/polymorphic_helpers.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/polymorphic_helpers.go index 63ffe40ed9bf..6f21e916c82a 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/polymorphic_helpers.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/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 armoracledatabase @@ -20,10 +16,14 @@ func unmarshalAutonomousDatabaseBasePropertiesClassification(rawMsg json.RawMess } var b AutonomousDatabaseBasePropertiesClassification switch m["dataBaseType"] { - case string(DataBaseTypeClone): - b = &AutonomousDatabaseCloneProperties{} case string(DataBaseTypeRegular): b = &AutonomousDatabaseProperties{} + case string(DataBaseTypeClone): + b = &AutonomousDatabaseCloneProperties{} + case string(DataBaseTypeCrossRegionDisasterRecovery): + b = &AutonomousDatabaseCrossRegionDisasterRecoveryProperties{} + case string(DataBaseTypeCloneFromBackupTimestamp): + b = &AutonomousDatabaseFromBackupTimestampProperties{} default: b = &AutonomousDatabaseBaseProperties{} } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/responses.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/responses.go index f34e50a6e231..55a67d431956 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/responses.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/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 armoracledatabase @@ -25,8 +21,8 @@ type AutonomousDatabaseBackupsClientGetResponse struct { AutonomousDatabaseBackup } -// AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse contains the response from method AutonomousDatabaseBackupsClient.NewListByAutonomousDatabasePager. -type AutonomousDatabaseBackupsClientListByAutonomousDatabaseResponse struct { +// AutonomousDatabaseBackupsClientListByParentResponse contains the response from method AutonomousDatabaseBackupsClient.NewListByParentPager. +type AutonomousDatabaseBackupsClientListByParentResponse struct { // The response of a AutonomousDatabaseBackup list operation. AutonomousDatabaseBackupListResult } @@ -73,6 +69,12 @@ type AutonomousDatabaseVersionsClientListByLocationResponse struct { AutonomousDbVersionListResult } +// AutonomousDatabasesClientChangeDisasterRecoveryConfigurationResponse contains the response from method AutonomousDatabasesClient.BeginChangeDisasterRecoveryConfiguration. +type AutonomousDatabasesClientChangeDisasterRecoveryConfigurationResponse struct { + // Autonomous Database resource model. + AutonomousDatabase +} + // AutonomousDatabasesClientCreateOrUpdateResponse contains the response from method AutonomousDatabasesClient.BeginCreateOrUpdate. type AutonomousDatabasesClientCreateOrUpdateResponse struct { // Autonomous Database resource model. @@ -216,8 +218,7 @@ type CloudVMClustersClientListBySubscriptionResponse struct { // CloudVMClustersClientListPrivateIPAddressesResponse contains the response from method CloudVMClustersClient.ListPrivateIPAddresses. type CloudVMClustersClientListPrivateIPAddressesResponse struct { - // Array of PrivateIpAddressProperties - PrivateIPAddressPropertiesArray []*PrivateIPAddressProperties + PrivateIpAddressPropertiesArray []*PrivateIPAddressProperties } // CloudVMClustersClientRemoveVMsResponse contains the response from method CloudVMClustersClient.BeginRemoveVMs. @@ -268,8 +269,8 @@ type DbNodesClientGetResponse struct { DbNode } -// DbNodesClientListByCloudVMClusterResponse contains the response from method DbNodesClient.NewListByCloudVMClusterPager. -type DbNodesClientListByCloudVMClusterResponse struct { +// DbNodesClientListByParentResponse contains the response from method DbNodesClient.NewListByParentPager. +type DbNodesClientListByParentResponse struct { // The response of a DbNode list operation. DbNodeListResult } @@ -280,8 +281,8 @@ type DbServersClientGetResponse struct { DbServer } -// DbServersClientListByCloudExadataInfrastructureResponse contains the response from method DbServersClient.NewListByCloudExadataInfrastructurePager. -type DbServersClientListByCloudExadataInfrastructureResponse struct { +// DbServersClientListByParentResponse contains the response from method DbServersClient.NewListByParentPager. +type DbServersClientListByParentResponse struct { // The response of a DbServer list operation. DbServerListResult } @@ -298,6 +299,124 @@ type DbSystemShapesClientListByLocationResponse struct { DbSystemShapeListResult } +// ExadbVMClustersClientCreateOrUpdateResponse contains the response from method ExadbVMClustersClient.BeginCreateOrUpdate. +type ExadbVMClustersClientCreateOrUpdateResponse struct { + // ExadbVmCluster resource definition + ExadbVMCluster +} + +// ExadbVMClustersClientDeleteResponse contains the response from method ExadbVMClustersClient.BeginDelete. +type ExadbVMClustersClientDeleteResponse struct { + // placeholder for future response values +} + +// ExadbVMClustersClientGetResponse contains the response from method ExadbVMClustersClient.Get. +type ExadbVMClustersClientGetResponse struct { + // ExadbVmCluster resource definition + ExadbVMCluster +} + +// ExadbVMClustersClientListByResourceGroupResponse contains the response from method ExadbVMClustersClient.NewListByResourceGroupPager. +type ExadbVMClustersClientListByResourceGroupResponse struct { + // The response of a ExadbVmCluster list operation. + ExadbVMClusterListResult +} + +// ExadbVMClustersClientListBySubscriptionResponse contains the response from method ExadbVMClustersClient.NewListBySubscriptionPager. +type ExadbVMClustersClientListBySubscriptionResponse struct { + // The response of a ExadbVmCluster list operation. + ExadbVMClusterListResult +} + +// ExadbVMClustersClientRemoveVMsResponse contains the response from method ExadbVMClustersClient.BeginRemoveVMs. +type ExadbVMClustersClientRemoveVMsResponse struct { + // ExadbVmCluster resource definition + ExadbVMCluster +} + +// ExadbVMClustersClientUpdateResponse contains the response from method ExadbVMClustersClient.BeginUpdate. +type ExadbVMClustersClientUpdateResponse struct { + // ExadbVmCluster resource definition + ExadbVMCluster +} + +// ExascaleDbNodesClientActionResponse contains the response from method ExascaleDbNodesClient.BeginAction. +type ExascaleDbNodesClientActionResponse struct { + // ExascaleDbNode action response + DbActionResponse +} + +// ExascaleDbNodesClientGetResponse contains the response from method ExascaleDbNodesClient.Get. +type ExascaleDbNodesClientGetResponse struct { + // The DbNode resource belonging to ExadbVmCluster + ExascaleDbNode +} + +// ExascaleDbNodesClientListByParentResponse contains the response from method ExascaleDbNodesClient.NewListByParentPager. +type ExascaleDbNodesClientListByParentResponse struct { + // The response of a ExascaleDbNode list operation. + ExascaleDbNodeListResult +} + +// ExascaleDbStorageVaultsClientCreateResponse contains the response from method ExascaleDbStorageVaultsClient.BeginCreate. +type ExascaleDbStorageVaultsClientCreateResponse struct { + // ExascaleDbStorageVault resource definition + ExascaleDbStorageVault +} + +// ExascaleDbStorageVaultsClientDeleteResponse contains the response from method ExascaleDbStorageVaultsClient.BeginDelete. +type ExascaleDbStorageVaultsClientDeleteResponse struct { + // placeholder for future response values +} + +// ExascaleDbStorageVaultsClientGetResponse contains the response from method ExascaleDbStorageVaultsClient.Get. +type ExascaleDbStorageVaultsClientGetResponse struct { + // ExascaleDbStorageVault resource definition + ExascaleDbStorageVault +} + +// ExascaleDbStorageVaultsClientListByResourceGroupResponse contains the response from method ExascaleDbStorageVaultsClient.NewListByResourceGroupPager. +type ExascaleDbStorageVaultsClientListByResourceGroupResponse struct { + // The response of a ExascaleDbStorageVault list operation. + ExascaleDbStorageVaultListResult +} + +// ExascaleDbStorageVaultsClientListBySubscriptionResponse contains the response from method ExascaleDbStorageVaultsClient.NewListBySubscriptionPager. +type ExascaleDbStorageVaultsClientListBySubscriptionResponse struct { + // The response of a ExascaleDbStorageVault list operation. + ExascaleDbStorageVaultListResult +} + +// ExascaleDbStorageVaultsClientUpdateResponse contains the response from method ExascaleDbStorageVaultsClient.BeginUpdate. +type ExascaleDbStorageVaultsClientUpdateResponse struct { + // ExascaleDbStorageVault resource definition + ExascaleDbStorageVault +} + +// FlexComponentsClientGetResponse contains the response from method FlexComponentsClient.Get. +type FlexComponentsClientGetResponse struct { + // FlexComponent Resource Definition + FlexComponent +} + +// FlexComponentsClientListByParentResponse contains the response from method FlexComponentsClient.NewListByParentPager. +type FlexComponentsClientListByParentResponse struct { + // The response of a FlexComponent list operation. + FlexComponentListResult +} + +// GiMinorVersionsClientGetResponse contains the response from method GiMinorVersionsClient.Get. +type GiMinorVersionsClientGetResponse struct { + // The Oracle Grid Infrastructure (GI) minor version resource definition. + GiMinorVersion +} + +// GiMinorVersionsClientListByParentResponse contains the response from method GiMinorVersionsClient.NewListByParentPager. +type GiMinorVersionsClientListByParentResponse struct { + // The response of a GiMinorVersion list operation. + GiMinorVersionListResult +} + // GiVersionsClientGetResponse contains the response from method GiVersionsClient.Get. type GiVersionsClientGetResponse struct { // GiVersion resource definition @@ -316,6 +435,11 @@ type OperationsClientListResponse struct { OperationListResult } +// OracleSubscriptionsClientAddAzureSubscriptionsResponse contains the response from method OracleSubscriptionsClient.BeginAddAzureSubscriptions. +type OracleSubscriptionsClientAddAzureSubscriptionsResponse struct { + // placeholder for future response values +} + // OracleSubscriptionsClientCreateOrUpdateResponse contains the response from method OracleSubscriptionsClient.BeginCreateOrUpdate. type OracleSubscriptionsClientCreateOrUpdateResponse struct { // OracleSubscription resource definition @@ -335,8 +459,7 @@ type OracleSubscriptionsClientGetResponse struct { // OracleSubscriptionsClientListActivationLinksResponse contains the response from method OracleSubscriptionsClient.BeginListActivationLinks. type OracleSubscriptionsClientListActivationLinksResponse struct { - // Activation Links model - ActivationLinks + // placeholder for future response values } // OracleSubscriptionsClientListBySubscriptionResponse contains the response from method OracleSubscriptionsClient.NewListBySubscriptionPager. @@ -347,14 +470,12 @@ type OracleSubscriptionsClientListBySubscriptionResponse struct { // OracleSubscriptionsClientListCloudAccountDetailsResponse contains the response from method OracleSubscriptionsClient.BeginListCloudAccountDetails. type OracleSubscriptionsClientListCloudAccountDetailsResponse struct { - // Cloud Account Details model - CloudAccountDetails + // placeholder for future response values } // OracleSubscriptionsClientListSaasSubscriptionDetailsResponse contains the response from method OracleSubscriptionsClient.BeginListSaasSubscriptionDetails. type OracleSubscriptionsClientListSaasSubscriptionDetailsResponse struct { - // SaaS Subscription Details model - SaasSubscriptionDetails + // placeholder for future response values } // OracleSubscriptionsClientUpdateResponse contains the response from method OracleSubscriptionsClient.BeginUpdate. @@ -392,8 +513,8 @@ type VirtualNetworkAddressesClientGetResponse struct { VirtualNetworkAddress } -// VirtualNetworkAddressesClientListByCloudVMClusterResponse contains the response from method VirtualNetworkAddressesClient.NewListByCloudVMClusterPager. -type VirtualNetworkAddressesClientListByCloudVMClusterResponse struct { +// VirtualNetworkAddressesClientListByParentResponse contains the response from method VirtualNetworkAddressesClient.NewListByParentPager. +type VirtualNetworkAddressesClientListByParentResponse struct { // The response of a VirtualNetworkAddress list operation. VirtualNetworkAddressListResult } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client.go index 9cd4a0226b2e..e95b61868aaa 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_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 armoracledatabase @@ -46,7 +42,7 @@ func NewSystemVersionsClient(subscriptionID string, credential azcore.TokenCrede // Get - Get a SystemVersion // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - systemversionname - SystemVersion name // - options - SystemVersionsClientGetOptions contains the optional parameters for the SystemVersionsClient.Get method. @@ -73,7 +69,7 @@ func (client *SystemVersionsClient) Get(ctx context.Context, location string, sy } // getCreateRequest creates the Get request. -func (client *SystemVersionsClient) getCreateRequest(ctx context.Context, location string, systemversionname string, options *SystemVersionsClientGetOptions) (*policy.Request, error) { +func (client *SystemVersionsClient) getCreateRequest(ctx context.Context, location string, systemversionname string, _ *SystemVersionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/systemVersions/{systemversionname}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -92,7 +88,7 @@ func (client *SystemVersionsClient) getCreateRequest(ctx context.Context, locati return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -107,9 +103,9 @@ func (client *SystemVersionsClient) getHandleResponse(resp *http.Response) (Syst return result, nil } -// NewListByLocationPager - List SystemVersion resources by Location +// NewListByLocationPager - List SystemVersion resources by SubscriptionLocationResource // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - location - The name of the Azure region. // - options - SystemVersionsClientListByLocationOptions contains the optional parameters for the SystemVersionsClient.NewListByLocationPager // method. @@ -137,7 +133,7 @@ func (client *SystemVersionsClient) NewListByLocationPager(location string, opti } // listByLocationCreateRequest creates the ListByLocation request. -func (client *SystemVersionsClient) listByLocationCreateRequest(ctx context.Context, location string, options *SystemVersionsClientListByLocationOptions) (*policy.Request, error) { +func (client *SystemVersionsClient) listByLocationCreateRequest(ctx context.Context, location string, _ *SystemVersionsClientListByLocationOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Oracle.Database/locations/{location}/systemVersions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -152,7 +148,7 @@ func (client *SystemVersionsClient) listByLocationCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client_example_test.go deleted file mode 100644 index 5a6d1aa80dad..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/systemversions_client_example_test.go +++ /dev/null @@ -1,78 +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 armoracledatabase_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/systemVersions_listByLocation.json -func ExampleSystemVersionsClient_NewListByLocationPager_listExadataSystemVersionsByTheProvidedFilter() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewSystemVersionsClient().NewListByLocationPager("eastus", 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.SystemVersionListResult = armoracledatabase.SystemVersionListResult{ - // Value: []*armoracledatabase.SystemVersion{ - // { - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/systemVersion/22.1.7.0.0.230113"), - // Properties: &armoracledatabase.SystemVersionProperties{ - // SystemVersion: to.Ptr("22.1.7.0.0.230113"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/systemVersions_get.json -func ExampleSystemVersionsClient_Get_getExadataSystemVersion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSystemVersionsClient().Get(ctx, "eastus", "22.x", 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.SystemVersion = armoracledatabase.SystemVersion{ - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/providers/Oracle.Database/locations/eastus/systemVersion/22.1.7.0.0.230113"), - // Properties: &armoracledatabase.SystemVersionProperties{ - // SystemVersion: to.Ptr("22.1.7.0.0.230113"), - // }, - // } -} diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/time_rfc3339.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/time_rfc3339.go index fa76bf4dd2e3..8cd6cef54750 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/time_rfc3339.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/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 armoracledatabase @@ -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/oracledatabase/armoracledatabase/tsp-location.yaml b/sdk/resourcemanager/oracledatabase/armoracledatabase/tsp-location.yaml new file mode 100644 index 000000000000..7a49da36a139 --- /dev/null +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/oracle/Oracle.Database.Management +commit: 079f70d6f2b754db6b736e117196104efd2dd496 +repo: Azure/azure-rest-api-specs +additionalDirectories: +- specification/oracle/Oracle.Database.Management/models diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client.go index a807d9ae6281..d3edf4d17312 100644 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client.go +++ b/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_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 armoracledatabase @@ -46,7 +42,7 @@ func NewVirtualNetworkAddressesClient(subscriptionID string, credential azcore.T // BeginCreateOrUpdate - Create a VirtualNetworkAddress // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - virtualnetworkaddressname - Virtual IP address hostname. @@ -60,8 +56,7 @@ func (client *VirtualNetworkAddressesClient) BeginCreateOrUpdate(ctx context.Con return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkAddressesClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -74,7 +69,7 @@ func (client *VirtualNetworkAddressesClient) BeginCreateOrUpdate(ctx context.Con // CreateOrUpdate - Create a VirtualNetworkAddress // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *VirtualNetworkAddressesClient) createOrUpdate(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, resource VirtualNetworkAddress, options *VirtualNetworkAddressesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "VirtualNetworkAddressesClient.BeginCreateOrUpdate" @@ -97,7 +92,7 @@ func (client *VirtualNetworkAddressesClient) createOrUpdate(ctx context.Context, } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *VirtualNetworkAddressesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, resource VirtualNetworkAddress, options *VirtualNetworkAddressesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *VirtualNetworkAddressesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, resource VirtualNetworkAddress, _ *VirtualNetworkAddressesClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses/{virtualnetworkaddressname}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -120,9 +115,10 @@ func (client *VirtualNetworkAddressesClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-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 } @@ -132,7 +128,7 @@ func (client *VirtualNetworkAddressesClient) createOrUpdateCreateRequest(ctx con // BeginDelete - Delete a VirtualNetworkAddress // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - virtualnetworkaddressname - Virtual IP address hostname. @@ -145,8 +141,7 @@ func (client *VirtualNetworkAddressesClient) BeginDelete(ctx context.Context, re return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[VirtualNetworkAddressesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -159,7 +154,7 @@ func (client *VirtualNetworkAddressesClient) BeginDelete(ctx context.Context, re // Delete - Delete a VirtualNetworkAddress // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 func (client *VirtualNetworkAddressesClient) deleteOperation(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, options *VirtualNetworkAddressesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "VirtualNetworkAddressesClient.BeginDelete" @@ -182,7 +177,7 @@ func (client *VirtualNetworkAddressesClient) deleteOperation(ctx context.Context } // deleteCreateRequest creates the Delete request. -func (client *VirtualNetworkAddressesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, options *VirtualNetworkAddressesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *VirtualNetworkAddressesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, _ *VirtualNetworkAddressesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses/{virtualnetworkaddressname}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -205,7 +200,7 @@ func (client *VirtualNetworkAddressesClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -214,7 +209,7 @@ func (client *VirtualNetworkAddressesClient) deleteCreateRequest(ctx context.Con // Get - Get a VirtualNetworkAddress // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name // - virtualnetworkaddressname - Virtual IP address hostname. @@ -243,7 +238,7 @@ func (client *VirtualNetworkAddressesClient) Get(ctx context.Context, resourceGr } // getCreateRequest creates the Get request. -func (client *VirtualNetworkAddressesClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, options *VirtualNetworkAddressesClientGetOptions) (*policy.Request, error) { +func (client *VirtualNetworkAddressesClient) getCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, virtualnetworkaddressname string, _ *VirtualNetworkAddressesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses/{virtualnetworkaddressname}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -266,7 +261,7 @@ func (client *VirtualNetworkAddressesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -281,38 +276,38 @@ func (client *VirtualNetworkAddressesClient) getHandleResponse(resp *http.Respon return result, nil } -// NewListByCloudVMClusterPager - List VirtualNetworkAddress resources by CloudVmCluster +// NewListByParentPager - List VirtualNetworkAddress resources by CloudVmCluster // -// Generated from API version 2023-09-01 +// Generated from API version 2025-03-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - cloudvmclustername - CloudVmCluster name -// - options - VirtualNetworkAddressesClientListByCloudVMClusterOptions contains the optional parameters for the VirtualNetworkAddressesClient.NewListByCloudVMClusterPager +// - options - VirtualNetworkAddressesClientListByParentOptions contains the optional parameters for the VirtualNetworkAddressesClient.NewListByParentPager // method. -func (client *VirtualNetworkAddressesClient) NewListByCloudVMClusterPager(resourceGroupName string, cloudvmclustername string, options *VirtualNetworkAddressesClientListByCloudVMClusterOptions) *runtime.Pager[VirtualNetworkAddressesClientListByCloudVMClusterResponse] { - return runtime.NewPager(runtime.PagingHandler[VirtualNetworkAddressesClientListByCloudVMClusterResponse]{ - More: func(page VirtualNetworkAddressesClientListByCloudVMClusterResponse) bool { +func (client *VirtualNetworkAddressesClient) NewListByParentPager(resourceGroupName string, cloudvmclustername string, options *VirtualNetworkAddressesClientListByParentOptions) *runtime.Pager[VirtualNetworkAddressesClientListByParentResponse] { + return runtime.NewPager(runtime.PagingHandler[VirtualNetworkAddressesClientListByParentResponse]{ + More: func(page VirtualNetworkAddressesClientListByParentResponse) bool { return page.NextLink != nil && len(*page.NextLink) > 0 }, - Fetcher: func(ctx context.Context, page *VirtualNetworkAddressesClientListByCloudVMClusterResponse) (VirtualNetworkAddressesClientListByCloudVMClusterResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualNetworkAddressesClient.NewListByCloudVMClusterPager") + Fetcher: func(ctx context.Context, page *VirtualNetworkAddressesClientListByParentResponse) (VirtualNetworkAddressesClientListByParentResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "VirtualNetworkAddressesClient.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.listByCloudVMClusterCreateRequest(ctx, resourceGroupName, cloudvmclustername, options) + return client.listByParentCreateRequest(ctx, resourceGroupName, cloudvmclustername, options) }, nil) if err != nil { - return VirtualNetworkAddressesClientListByCloudVMClusterResponse{}, err + return VirtualNetworkAddressesClientListByParentResponse{}, err } - return client.listByCloudVMClusterHandleResponse(resp) + return client.listByParentHandleResponse(resp) }, Tracer: client.internal.Tracer(), }) } -// listByCloudVMClusterCreateRequest creates the ListByCloudVMCluster request. -func (client *VirtualNetworkAddressesClient) listByCloudVMClusterCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, options *VirtualNetworkAddressesClientListByCloudVMClusterOptions) (*policy.Request, error) { +// listByParentCreateRequest creates the ListByParent request. +func (client *VirtualNetworkAddressesClient) listByParentCreateRequest(ctx context.Context, resourceGroupName string, cloudvmclustername string, _ *VirtualNetworkAddressesClientListByParentOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Oracle.Database/cloudVmClusters/{cloudvmclustername}/virtualNetworkAddresses" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -331,17 +326,17 @@ func (client *VirtualNetworkAddressesClient) listByCloudVMClusterCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01") + reqQP.Set("api-version", "2025-03-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// listByCloudVMClusterHandleResponse handles the ListByCloudVMCluster response. -func (client *VirtualNetworkAddressesClient) listByCloudVMClusterHandleResponse(resp *http.Response) (VirtualNetworkAddressesClientListByCloudVMClusterResponse, error) { - result := VirtualNetworkAddressesClientListByCloudVMClusterResponse{} +// listByParentHandleResponse handles the ListByParent response. +func (client *VirtualNetworkAddressesClient) listByParentHandleResponse(resp *http.Response) (VirtualNetworkAddressesClientListByParentResponse, error) { + result := VirtualNetworkAddressesClientListByParentResponse{} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkAddressListResult); err != nil { - return VirtualNetworkAddressesClientListByCloudVMClusterResponse{}, err + return VirtualNetworkAddressesClientListByParentResponse{}, err } return result, nil } diff --git a/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client_example_test.go b/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client_example_test.go deleted file mode 100644 index 890f38a5f662..000000000000 --- a/sdk/resourcemanager/oracledatabase/armoracledatabase/virtualnetworkaddresses_client_example_test.go +++ /dev/null @@ -1,159 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armoracledatabase_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/oracledatabase/armoracledatabase" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/virtualNetworkAddresses_listByParent.json -func ExampleVirtualNetworkAddressesClient_NewListByCloudVMClusterPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewVirtualNetworkAddressesClient().NewListByCloudVMClusterPager("rg000", "cluster1", 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.VirtualNetworkAddressListResult = armoracledatabase.VirtualNetworkAddressListResult{ - // Value: []*armoracledatabase.VirtualNetworkAddress{ - // { - // Type: to.Ptr("Oracle.Database/cloudVmClusters/virtualNetworkAddresses"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1/virtualNetworkAddresses/hostname1"), - // Properties: &armoracledatabase.VirtualNetworkAddressProperties{ - // Domain: to.Ptr("domain1"), - // IPAddress: to.Ptr("192.168.0.1"), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.VirtualNetworkAddressLifecycleStateAvailable), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // TimeAssigned: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T00:27:02.119Z"); return t}()), - // VMOcid: to.Ptr("ocid1..aaaa"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/virtualNetworkAddresses_get.json -func ExampleVirtualNetworkAddressesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewVirtualNetworkAddressesClient().Get(ctx, "rg000", "cluster1", "hostname1", 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.VirtualNetworkAddress = armoracledatabase.VirtualNetworkAddress{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters/virtualNetworkAddresses"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1/virtualNetworkAddresses/hostname1"), - // Properties: &armoracledatabase.VirtualNetworkAddressProperties{ - // Domain: to.Ptr("domain1"), - // IPAddress: to.Ptr("192.168.0.1"), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.VirtualNetworkAddressLifecycleStateAvailable), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // TimeAssigned: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T00:27:02.119Z"); return t}()), - // VMOcid: to.Ptr("ocid1..aaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/virtualNetworkAddresses_create.json -func ExampleVirtualNetworkAddressesClient_BeginCreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkAddressesClient().BeginCreateOrUpdate(ctx, "rg000", "cluster1", "hostname1", armoracledatabase.VirtualNetworkAddress{ - Properties: &armoracledatabase.VirtualNetworkAddressProperties{ - IPAddress: to.Ptr("192.168.0.1"), - VMOcid: to.Ptr("ocid1..aaaa"), - }, - }, 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.VirtualNetworkAddress = armoracledatabase.VirtualNetworkAddress{ - // Type: to.Ptr("Oracle.Database/cloudVmClusters/virtualNetworkAddresses"), - // ID: to.Ptr("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg000/providers/Oracle.Database/cloudVmClusters/cluster1/virtualNetworkAddresses/hostname1"), - // Properties: &armoracledatabase.VirtualNetworkAddressProperties{ - // Domain: to.Ptr("domain1"), - // IPAddress: to.Ptr("192.168.0.1"), - // LifecycleDetails: to.Ptr("success"), - // LifecycleState: to.Ptr(armoracledatabase.VirtualNetworkAddressLifecycleStateAvailable), - // Ocid: to.Ptr("ocid1..aaaaaa"), - // ProvisioningState: to.Ptr(armoracledatabase.AzureResourceProvisioningStateSucceeded), - // TimeAssigned: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2023-10-22T00:27:02.119Z"); return t}()), - // VMOcid: to.Ptr("ocid1..aaaa"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/1c63635d66ae38cff18045ab416a6572d3e15f6e/specification/oracle/resource-manager/Oracle.Database/stable/2023-09-01/examples/virtualNetworkAddresses_delete.json -func ExampleVirtualNetworkAddressesClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armoracledatabase.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewVirtualNetworkAddressesClient().BeginDelete(ctx, "rg000", "cluster1", "hostname1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/pineconevectordb/armpineconevectordb/CHANGELOG.md b/sdk/resourcemanager/pineconevectordb/armpineconevectordb/CHANGELOG.md index 5ed8f5ba2cce..23caeaf8f196 100644 --- a/sdk/resourcemanager/pineconevectordb/armpineconevectordb/CHANGELOG.md +++ b/sdk/resourcemanager/pineconevectordb/armpineconevectordb/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 0.1.2 (2025-05-13) +### Other Changes + + ## 0.1.1 (2025-04-01) ### Other Changes diff --git a/sdk/resourcemanager/pineconevectordb/armpineconevectordb/constants.go b/sdk/resourcemanager/pineconevectordb/armpineconevectordb/constants.go index c82a943ca3bf..62e03365664b 100644 --- a/sdk/resourcemanager/pineconevectordb/armpineconevectordb/constants.go +++ b/sdk/resourcemanager/pineconevectordb/armpineconevectordb/constants.go @@ -6,7 +6,7 @@ package armpineconevectordb const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/pineconevectordb/armpineconevectordb" - moduleVersion = "v0.1.1" + moduleVersion = "v0.1.2" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/pineconevectordb/armpineconevectordb/fake/organizations_server.go b/sdk/resourcemanager/pineconevectordb/armpineconevectordb/fake/organizations_server.go index 4ddf30edcc03..98c863346bf3 100644 --- a/sdk/resourcemanager/pineconevectordb/armpineconevectordb/fake/organizations_server.go +++ b/sdk/resourcemanager/pineconevectordb/armpineconevectordb/fake/organizations_server.go @@ -131,7 +131,7 @@ func (o *OrganizationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Pinecone\.VectorDb/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armpineconevectordb.OrganizationResource](req) @@ -179,7 +179,7 @@ func (o *OrganizationsServerTransport) dispatchBeginDelete(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Pinecone\.VectorDb/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,7 +221,7 @@ func (o *OrganizationsServerTransport) dispatchGet(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Pinecone\.VectorDb/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -256,7 +256,7 @@ func (o *OrganizationsServerTransport) dispatchNewListByResourceGroupPager(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Pinecone\.VectorDb/organizations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -293,7 +293,7 @@ func (o *OrganizationsServerTransport) dispatchNewListBySubscriptionPager(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Pinecone\.VectorDb/organizations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := o.srv.NewListBySubscriptionPager(nil) @@ -324,7 +324,7 @@ func (o *OrganizationsServerTransport) dispatchUpdate(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Pinecone\.VectorDb/organizations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armpineconevectordb.OrganizationResourceUpdate](req) diff --git a/sdk/resourcemanager/pineconevectordb/armpineconevectordb/fake/time_rfc3339.go b/sdk/resourcemanager/pineconevectordb/armpineconevectordb/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/pineconevectordb/armpineconevectordb/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/pineconevectordb/armpineconevectordb/models.go b/sdk/resourcemanager/pineconevectordb/armpineconevectordb/models.go index a20046e79364..74662b7d1cb2 100644 --- a/sdk/resourcemanager/pineconevectordb/armpineconevectordb/models.go +++ b/sdk/resourcemanager/pineconevectordb/armpineconevectordb/models.go @@ -27,7 +27,7 @@ type MarketplaceDetails struct { // REQUIRED; Offer details for the marketplace that is selected by the user OfferDetails *OfferDetails - // Azure subscription id for the marketplace offer is purchased from + // Azure subscription id for the the marketplace offer is purchased from SubscriptionID *string // READ-ONLY; Marketplace subscription status @@ -55,7 +55,9 @@ type OfferDetails struct { TermUnit *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 diff --git a/sdk/resourcemanager/pineconevectordb/armpineconevectordb/tsp-location.yaml b/sdk/resourcemanager/pineconevectordb/armpineconevectordb/tsp-location.yaml index c08c213ab74b..8ac04cc2bd55 100644 --- a/sdk/resourcemanager/pineconevectordb/armpineconevectordb/tsp-location.yaml +++ b/sdk/resourcemanager/pineconevectordb/armpineconevectordb/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/liftrpinecone/Pinecone.VectorDb.Management -commit: 3db6867b8e524ea6d1bc7a3bbb989fe50dd2f184 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md b/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md index b32ab903f087..21f4b8bf09a6 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.2.0-beta.2 (2025-05-13) +### Other Changes + + ## 1.2.0-beta.1 (2025-04-23) ### Features Added diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/constants.go index 23156014febf..5782de633d99 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.2.0-beta.1" + moduleVersion = "v1.2.0-beta.2" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/associationsinterface_server.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/associationsinterface_server.go index 350b2f1ec11f..add2c1c34b3f 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/associationsinterface_server.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/associationsinterface_server.go @@ -123,7 +123,7 @@ func (a *AssociationsInterfaceServerTransport) dispatchBeginCreateOrUpdate(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/associations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armservicenetworking.Association](req) @@ -175,7 +175,7 @@ func (a *AssociationsInterfaceServerTransport) dispatchBeginDelete(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/associations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,7 +221,7 @@ func (a *AssociationsInterfaceServerTransport) dispatchGet(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/associations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -260,7 +260,7 @@ func (a *AssociationsInterfaceServerTransport) dispatchNewListByTrafficControlle const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/associations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -299,7 +299,7 @@ func (a *AssociationsInterfaceServerTransport) dispatchUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/associations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armservicenetworking.AssociationUpdate](req) diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/frontendsinterface_server.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/frontendsinterface_server.go index 216168928c5d..d041d0b45486 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/frontendsinterface_server.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/frontendsinterface_server.go @@ -123,7 +123,7 @@ func (f *FrontendsInterfaceServerTransport) dispatchBeginCreateOrUpdate(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/frontends/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armservicenetworking.Frontend](req) @@ -175,7 +175,7 @@ func (f *FrontendsInterfaceServerTransport) dispatchBeginDelete(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/frontends/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,7 +221,7 @@ func (f *FrontendsInterfaceServerTransport) dispatchGet(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/frontends/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -260,7 +260,7 @@ func (f *FrontendsInterfaceServerTransport) dispatchNewListByTrafficControllerPa const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/frontends` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -299,7 +299,7 @@ func (f *FrontendsInterfaceServerTransport) dispatchUpdate(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/frontends/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armservicenetworking.FrontendUpdate](req) diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/securitypoliciesinterface_server.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/securitypoliciesinterface_server.go index e990437ffea4..ed1244cebbb4 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/securitypoliciesinterface_server.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/securitypoliciesinterface_server.go @@ -123,7 +123,7 @@ func (s *SecurityPoliciesInterfaceServerTransport) dispatchBeginCreateOrUpdate(r const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armservicenetworking.SecurityPolicy](req) @@ -175,7 +175,7 @@ func (s *SecurityPoliciesInterfaceServerTransport) dispatchBeginDelete(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,7 +221,7 @@ func (s *SecurityPoliciesInterfaceServerTransport) dispatchGet(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -260,7 +260,7 @@ func (s *SecurityPoliciesInterfaceServerTransport) dispatchNewListByTrafficContr const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityPolicies` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -299,7 +299,7 @@ func (s *SecurityPoliciesInterfaceServerTransport) dispatchUpdate(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armservicenetworking.SecurityPolicyUpdate](req) diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/time_rfc3339.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/servicenetworking/armservicenetworking/fake/trafficcontrollerinterface_server.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/trafficcontrollerinterface_server.go index 6c17fc12a5b5..89fca443e96a 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/trafficcontrollerinterface_server.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/fake/trafficcontrollerinterface_server.go @@ -131,7 +131,7 @@ func (t *TrafficControllerInterfaceServerTransport) dispatchBeginCreateOrUpdate( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armservicenetworking.TrafficController](req) @@ -179,7 +179,7 @@ func (t *TrafficControllerInterfaceServerTransport) dispatchBeginDelete(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,7 +221,7 @@ func (t *TrafficControllerInterfaceServerTransport) dispatchGet(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -256,7 +256,7 @@ func (t *TrafficControllerInterfaceServerTransport) dispatchNewListByResourceGro const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -293,7 +293,7 @@ func (t *TrafficControllerInterfaceServerTransport) dispatchNewListBySubscriptio const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := t.srv.NewListBySubscriptionPager(nil) @@ -324,7 +324,7 @@ func (t *TrafficControllerInterfaceServerTransport) dispatchUpdate(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ServiceNetworking/trafficControllers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armservicenetworking.TrafficControllerUpdate](req) diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/models.go b/sdk/resourcemanager/servicenetworking/armservicenetworking/models.go index ab622f5cbe04..7378c2c76f14 100644 --- a/sdk/resourcemanager/servicenetworking/armservicenetworking/models.go +++ b/sdk/resourcemanager/servicenetworking/armservicenetworking/models.go @@ -169,7 +169,9 @@ type IPAccessRulesSecurityPolicy struct { ID *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 diff --git a/sdk/resourcemanager/servicenetworking/armservicenetworking/tsp-location.yaml b/sdk/resourcemanager/servicenetworking/armservicenetworking/tsp-location.yaml index ba649fdc653a..f4386323529e 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: fc1f625dbec2d92ba4d9dd0df16ece543b04fec9 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md b/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md index 67b84e339a28..71b51a1a30bd 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md +++ b/sdk/resourcemanager/standbypool/armstandbypool/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 2.0.1 (2025-05-13) +### Other Changes + + ## 2.0.0 (2025-04-07) ### Breaking Changes diff --git a/sdk/resourcemanager/standbypool/armstandbypool/constants.go b/sdk/resourcemanager/standbypool/armstandbypool/constants.go index 63b66e556bef..3b2f308765f4 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 = "v2.0.0" + moduleVersion = "v2.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/standbycontainergrouppoolruntimeviews_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go index 58c672803b28..b61be5235fd2 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppoolruntimeviews_server.go @@ -99,7 +99,7 @@ func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) dispatchGet(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyContainerGroupPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runtimeViews/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -138,7 +138,7 @@ func (s *StandbyContainerGroupPoolRuntimeViewsServerTransport) dispatchNewListBy const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyContainerGroupPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runtimeViews` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go index a56ffa37fb21..09f40eda067a 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbycontainergrouppools_server.go @@ -131,7 +131,7 @@ func (s *StandbyContainerGroupPoolsServerTransport) dispatchBeginCreateOrUpdate( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyContainerGroupPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armstandbypool.StandbyContainerGroupPoolResource](req) @@ -179,7 +179,7 @@ func (s *StandbyContainerGroupPoolsServerTransport) dispatchBeginDelete(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyContainerGroupPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,7 +221,7 @@ func (s *StandbyContainerGroupPoolsServerTransport) dispatchGet(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyContainerGroupPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -256,7 +256,7 @@ func (s *StandbyContainerGroupPoolsServerTransport) dispatchNewListByResourceGro const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyContainerGroupPools` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -293,7 +293,7 @@ func (s *StandbyContainerGroupPoolsServerTransport) dispatchNewListBySubscriptio const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyContainerGroupPools` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := s.srv.NewListBySubscriptionPager(nil) @@ -324,7 +324,7 @@ func (s *StandbyContainerGroupPoolsServerTransport) dispatchUpdate(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyContainerGroupPools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armstandbypool.StandbyContainerGroupPoolResourceUpdate](req) diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go index 812235d2ac01..5bd67f698bac 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepoolruntimeviews_server.go @@ -99,7 +99,7 @@ func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) dispatchGet(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyVirtualMachinePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runtimeViews/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -138,7 +138,7 @@ func (s *StandbyVirtualMachinePoolRuntimeViewsServerTransport) dispatchNewListBy const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyVirtualMachinePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/runtimeViews` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go index e93a633c47b4..48d7defd66c0 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachinepools_server.go @@ -131,7 +131,7 @@ func (s *StandbyVirtualMachinePoolsServerTransport) dispatchBeginCreateOrUpdate( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyVirtualMachinePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armstandbypool.StandbyVirtualMachinePoolResource](req) @@ -179,7 +179,7 @@ func (s *StandbyVirtualMachinePoolsServerTransport) dispatchBeginDelete(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyVirtualMachinePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,7 +221,7 @@ func (s *StandbyVirtualMachinePoolsServerTransport) dispatchGet(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyVirtualMachinePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -256,7 +256,7 @@ func (s *StandbyVirtualMachinePoolsServerTransport) dispatchNewListByResourceGro const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyVirtualMachinePools` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -293,7 +293,7 @@ func (s *StandbyVirtualMachinePoolsServerTransport) dispatchNewListBySubscriptio const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyVirtualMachinePools` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := s.srv.NewListBySubscriptionPager(nil) @@ -324,7 +324,7 @@ func (s *StandbyVirtualMachinePoolsServerTransport) dispatchUpdate(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyVirtualMachinePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armstandbypool.StandbyVirtualMachinePoolResourceUpdate](req) diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go index 6245c1b0a2e4..e566b142d9e2 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/fake/standbyvirtualmachines_server.go @@ -99,7 +99,7 @@ func (s *StandbyVirtualMachinesServerTransport) dispatchGet(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyVirtualMachinePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/standbyVirtualMachines/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -138,7 +138,7 @@ func (s *StandbyVirtualMachinesServerTransport) dispatchNewListByStandbyVirtualM const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.StandbyPool/standbyVirtualMachinePools/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/standbyVirtualMachines` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) diff --git a/sdk/resourcemanager/standbypool/armstandbypool/fake/time_rfc3339.go b/sdk/resourcemanager/standbypool/armstandbypool/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/standbypool/armstandbypool/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/standbypool/armstandbypool/models.go b/sdk/resourcemanager/standbypool/armstandbypool/models.go index 19472a198fd2..7328b0975ddf 100644 --- a/sdk/resourcemanager/standbypool/armstandbypool/models.go +++ b/sdk/resourcemanager/standbypool/armstandbypool/models.go @@ -34,7 +34,9 @@ type ContainerGroupProperties struct { SubnetIDs []*Subnet } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 diff --git a/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml b/sdk/resourcemanager/standbypool/armstandbypool/tsp-location.yaml index e9ade2e47641..364dbcd572db 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: 3db6867b8e524ea6d1bc7a3bbb989fe50dd2f184 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/terraform/armterraform/CHANGELOG.md b/sdk/resourcemanager/terraform/armterraform/CHANGELOG.md index 683baba6e17a..0362ccc3bcea 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-05-13) +### 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/fake/terraform_server.go b/sdk/resourcemanager/terraform/armterraform/fake/terraform_server.go index ab052040f9cd..efd83bddee38 100644 --- a/sdk/resourcemanager/terraform/armterraform/fake/terraform_server.go +++ b/sdk/resourcemanager/terraform/armterraform/fake/terraform_server.go @@ -93,7 +93,7 @@ func (t *TerraformServerTransport) dispatchBeginExportTerraform(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.AzureTerraform/exportTerraform` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } raw, err := readRequestBody(req) diff --git a/sdk/resourcemanager/terraform/armterraform/fake/time_rfc3339.go b/sdk/resourcemanager/terraform/armterraform/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/terraform/armterraform/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) - -const ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - if len(data) == 0 { - return nil - } - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/terraform/armterraform/models.go b/sdk/resourcemanager/terraform/armterraform/models.go index 96e615ca4de8..eedd96fd4a4c 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,23 @@ 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 +// Operation - REST API 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..00c6f740a1de 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: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs additionalDirectories: diff --git a/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md b/sdk/resourcemanager/trustedsigning/armtrustedsigning/CHANGELOG.md index 65b66c134a02..3a02a5a36f2a 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-05-13) +### 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..9b21175ea93e 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) { @@ -104,7 +123,7 @@ func (c *CertificateProfilesServerTransport) dispatchBeginCreate(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armtrustedsigning.CertificateProfile](req) @@ -156,7 +175,7 @@ func (c *CertificateProfilesServerTransport) dispatchBeginDelete(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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) @@ -202,7 +221,7 @@ func (c *CertificateProfilesServerTransport) dispatchGet(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -241,7 +260,7 @@ func (c *CertificateProfilesServerTransport) dispatchNewListByCodeSigningAccount const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -280,7 +299,7 @@ func (c *CertificateProfilesServerTransport) dispatchRevokeCertificate(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/certificateProfiles/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/revokeCertificate` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armtrustedsigning.RevokeCertificate](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..f82687dd0800 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) { @@ -118,7 +137,7 @@ func (c *CodeSigningAccountsServerTransport) dispatchCheckNameAvailability(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/checkNameAvailability` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armtrustedsigning.CheckNameAvailability](req) @@ -149,7 +168,7 @@ func (c *CodeSigningAccountsServerTransport) dispatchBeginCreate(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armtrustedsigning.CodeSigningAccount](req) @@ -197,7 +216,7 @@ func (c *CodeSigningAccountsServerTransport) dispatchBeginDelete(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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) @@ -239,7 +258,7 @@ func (c *CodeSigningAccountsServerTransport) dispatchGet(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -274,7 +293,7 @@ func (c *CodeSigningAccountsServerTransport) dispatchNewListByResourceGroupPager const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -311,7 +330,7 @@ func (c *CodeSigningAccountsServerTransport) dispatchNewListBySubscriptionPager( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := c.srv.NewListBySubscriptionPager(nil) @@ -344,7 +363,7 @@ func (c *CodeSigningAccountsServerTransport) dispatchBeginUpdate(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.CodeSigning/codeSigningAccounts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armtrustedsigning.CodeSigningAccountPatch](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/fake/time_rfc3339.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/trustedsigning/armtrustedsigning/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/trustedsigning/armtrustedsigning/models.go b/sdk/resourcemanager/trustedsigning/armtrustedsigning/models.go index cfb89b3234d0..f30c346e8df8 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. @@ -203,14 +185,16 @@ type CodeSigningAccountProperties struct { ProvisioningState *ProvisioningState } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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..ece3d5cf1874 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: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs additionalDirectories: diff --git a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/CHANGELOG.md b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/CHANGELOG.md index 0243920a5405..f4689a3b8843 100644 --- a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/CHANGELOG.md +++ b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/CHANGELOG.md @@ -1,5 +1,9 @@ # Release History +## 1.0.0 (2025-05-13) +### Other Changes + + ## 0.1.0 (2025-03-12) ### Other Changes diff --git a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/constants.go b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/constants.go index c2789170e485..db8321bd4687 100644 --- a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/constants.go +++ b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/constants.go @@ -6,7 +6,7 @@ package armweightsandbiases const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/weightsandbiases/armweightsandbiases" - moduleVersion = "v0.1.0" + moduleVersion = "v1.0.0" ) // ActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/fake/instances_server.go b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/fake/instances_server.go index f49f62f5de46..3952c62920e4 100644 --- a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/fake/instances_server.go +++ b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/fake/instances_server.go @@ -131,7 +131,7 @@ func (i *InstancesServerTransport) dispatchBeginCreateOrUpdate(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.WeightsAndBiases/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armweightsandbiases.InstanceResource](req) @@ -179,7 +179,7 @@ func (i *InstancesServerTransport) dispatchBeginDelete(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.WeightsAndBiases/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,7 +221,7 @@ func (i *InstancesServerTransport) dispatchGet(req *http.Request) (*http.Respons const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.WeightsAndBiases/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -256,7 +256,7 @@ func (i *InstancesServerTransport) dispatchNewListByResourceGroupPager(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.WeightsAndBiases/instances` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -293,7 +293,7 @@ func (i *InstancesServerTransport) dispatchNewListBySubscriptionPager(req *http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.WeightsAndBiases/instances` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := i.srv.NewListBySubscriptionPager(nil) @@ -324,7 +324,7 @@ func (i *InstancesServerTransport) dispatchUpdate(req *http.Request) (*http.Resp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.WeightsAndBiases/instances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armweightsandbiases.InstanceResourceUpdate](req) diff --git a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/fake/time_rfc3339.go b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/fake/time_rfc3339.go deleted file mode 100644 index 87ee11e83b32..000000000000 --- a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/fake/time_rfc3339.go +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the 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/weightsandbiases/armweightsandbiases/instances_client.go b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/instances_client.go index 6ee21d85fc84..e7e66d072bb9 100644 --- a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/instances_client.go +++ b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/instances_client.go @@ -42,7 +42,7 @@ func NewInstancesClient(subscriptionID string, credential azcore.TokenCredential // BeginCreateOrUpdate - Create a InstanceResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-09-18-preview +// Generated from API version 2024-09-18 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instancename - Name of the Instance resource // - resource - Resource create parameters. @@ -68,7 +68,7 @@ func (client *InstancesClient) BeginCreateOrUpdate(ctx context.Context, resource // CreateOrUpdate - Create a InstanceResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-09-18-preview +// Generated from API version 2024-09-18 func (client *InstancesClient) createOrUpdate(ctx context.Context, resourceGroupName string, instancename string, resource InstanceResource, options *InstancesClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "InstancesClient.BeginCreateOrUpdate" @@ -110,7 +110,7 @@ func (client *InstancesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-09-18-preview") + reqQP.Set("api-version", "2024-09-18") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} req.Raw().Header["Content-Type"] = []string{"application/json"} @@ -123,7 +123,7 @@ func (client *InstancesClient) createOrUpdateCreateRequest(ctx context.Context, // BeginDelete - Delete a InstanceResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-09-18-preview +// Generated from API version 2024-09-18 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instancename - Name of the Instance resource // - options - InstancesClientBeginDeleteOptions contains the optional parameters for the InstancesClient.BeginDelete method. @@ -147,7 +147,7 @@ func (client *InstancesClient) BeginDelete(ctx context.Context, resourceGroupNam // Delete - Delete a InstanceResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-09-18-preview +// Generated from API version 2024-09-18 func (client *InstancesClient) deleteOperation(ctx context.Context, resourceGroupName string, instancename string, options *InstancesClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "InstancesClient.BeginDelete" @@ -189,7 +189,7 @@ func (client *InstancesClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-09-18-preview") + reqQP.Set("api-version", "2024-09-18") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -198,7 +198,7 @@ func (client *InstancesClient) deleteCreateRequest(ctx context.Context, resource // Get - Get a InstanceResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-09-18-preview +// Generated from API version 2024-09-18 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instancename - Name of the Instance resource // - options - InstancesClientGetOptions contains the optional parameters for the InstancesClient.Get method. @@ -244,7 +244,7 @@ func (client *InstancesClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-09-18-preview") + reqQP.Set("api-version", "2024-09-18") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,7 +261,7 @@ func (client *InstancesClient) getHandleResponse(resp *http.Response) (Instances // NewListByResourceGroupPager - List InstanceResource resources by resource group // -// Generated from API version 2024-09-18-preview +// Generated from API version 2024-09-18 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - InstancesClientListByResourceGroupOptions contains the optional parameters for the InstancesClient.NewListByResourceGroupPager // method. @@ -304,7 +304,7 @@ func (client *InstancesClient) listByResourceGroupCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-09-18-preview") + reqQP.Set("api-version", "2024-09-18") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -321,7 +321,7 @@ func (client *InstancesClient) listByResourceGroupHandleResponse(resp *http.Resp // NewListBySubscriptionPager - List InstanceResource resources by subscription ID // -// Generated from API version 2024-09-18-preview +// Generated from API version 2024-09-18 // - options - InstancesClientListBySubscriptionOptions contains the optional parameters for the InstancesClient.NewListBySubscriptionPager // method. func (client *InstancesClient) NewListBySubscriptionPager(options *InstancesClientListBySubscriptionOptions) *runtime.Pager[InstancesClientListBySubscriptionResponse] { @@ -359,7 +359,7 @@ func (client *InstancesClient) listBySubscriptionCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-09-18-preview") + reqQP.Set("api-version", "2024-09-18") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -377,7 +377,7 @@ func (client *InstancesClient) listBySubscriptionHandleResponse(resp *http.Respo // Update - Update a InstanceResource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-09-18-preview +// Generated from API version 2024-09-18 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - instancename - Name of the Instance resource // - properties - The resource properties to be updated. @@ -424,7 +424,7 @@ func (client *InstancesClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-09-18-preview") + reqQP.Set("api-version", "2024-09-18") 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/weightsandbiases/armweightsandbiases/instances_client_example_test.go b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/instances_client_example_test.go index ff27f66b2092..df4100f6a691 100644 --- a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/instances_client_example_test.go +++ b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/instances_client_example_test.go @@ -12,7 +12,7 @@ import ( "log" ) -// Generated from example definition: 2024-09-18-preview/Instances_CreateOrUpdate_MaximumSet_Gen.json +// Generated from example definition: 2024-09-18/Instances_CreateOrUpdate_MaximumSet_Gen.json func ExampleInstancesClient_BeginCreateOrUpdate() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -137,7 +137,7 @@ func ExampleInstancesClient_BeginCreateOrUpdate() { // } } -// Generated from example definition: 2024-09-18-preview/Instances_Delete_MaximumSet_Gen.json +// Generated from example definition: 2024-09-18/Instances_Delete_MaximumSet_Gen.json func ExampleInstancesClient_BeginDelete() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -158,7 +158,7 @@ func ExampleInstancesClient_BeginDelete() { } } -// Generated from example definition: 2024-09-18-preview/Instances_Get_MaximumSet_Gen.json +// Generated from example definition: 2024-09-18/Instances_Get_MaximumSet_Gen.json func ExampleInstancesClient_Get() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -238,7 +238,7 @@ func ExampleInstancesClient_Get() { // } } -// Generated from example definition: 2024-09-18-preview/Instances_ListByResourceGroup_MaximumSet_Gen.json +// Generated from example definition: 2024-09-18/Instances_ListByResourceGroup_MaximumSet_Gen.json func ExampleInstancesClient_NewListByResourceGroupPager_instancesListByResourceGroupGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -328,7 +328,7 @@ func ExampleInstancesClient_NewListByResourceGroupPager_instancesListByResourceG } } -// Generated from example definition: 2024-09-18-preview/Instances_ListByResourceGroup_MinimumSet_Gen.json +// Generated from example definition: 2024-09-18/Instances_ListByResourceGroup_MinimumSet_Gen.json func ExampleInstancesClient_NewListByResourceGroupPager_instancesListByResourceGroupGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -363,7 +363,7 @@ func ExampleInstancesClient_NewListByResourceGroupPager_instancesListByResourceG } } -// Generated from example definition: 2024-09-18-preview/Instances_ListBySubscription_MaximumSet_Gen.json +// Generated from example definition: 2024-09-18/Instances_ListBySubscription_MaximumSet_Gen.json func ExampleInstancesClient_NewListBySubscriptionPager_instancesListBySubscriptionGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -453,7 +453,7 @@ func ExampleInstancesClient_NewListBySubscriptionPager_instancesListBySubscripti } } -// Generated from example definition: 2024-09-18-preview/Instances_ListBySubscription_MinimumSet_Gen.json +// Generated from example definition: 2024-09-18/Instances_ListBySubscription_MinimumSet_Gen.json func ExampleInstancesClient_NewListBySubscriptionPager_instancesListBySubscriptionGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -488,7 +488,7 @@ func ExampleInstancesClient_NewListBySubscriptionPager_instancesListBySubscripti } } -// Generated from example definition: 2024-09-18-preview/Instances_Update_MaximumSet_Gen.json +// Generated from example definition: 2024-09-18/Instances_Update_MaximumSet_Gen.json func ExampleInstancesClient_Update() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/models.go b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/models.go index a7ae3eadc81e..ca7bfb906599 100644 --- a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/models.go +++ b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/models.go @@ -11,12 +11,12 @@ type InstanceProperties struct { // REQUIRED; Marketplace details of the resource. Marketplace *MarketplaceDetails + // REQUIRED; partner properties + PartnerProperties *PartnerProperties + // REQUIRED; Details of the user. User *UserDetails - // partner properties - PartnerProperties *PartnerProperties - // Single sign-on properties SingleSignOnProperties *SingleSignOnPropertiesV2 @@ -118,7 +118,9 @@ type OfferDetails struct { TermUnit *string } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API 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 diff --git a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/operations_client.go b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/operations_client.go index bf43045ca9a8..23f70b5454a6 100644 --- a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/operations_client.go +++ b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/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-09-18-preview +// Generated from API version 2024-09-18 // - 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-09-18-preview") + reqQP.Set("api-version", "2024-09-18") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/operations_client_example_test.go b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/operations_client_example_test.go index 4397a8db33ab..ca9977180404 100644 --- a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/operations_client_example_test.go +++ b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/operations_client_example_test.go @@ -11,7 +11,7 @@ import ( "log" ) -// Generated from example definition: 2024-09-18-preview/Operations_List_MaximumSet_Gen.json +// Generated from example definition: 2024-09-18/Operations_List_MaximumSet_Gen.json func ExampleOperationsClient_NewListPager_operationsListGeneratedByMaximumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { @@ -55,7 +55,7 @@ func ExampleOperationsClient_NewListPager_operationsListGeneratedByMaximumSetRul } } -// Generated from example definition: 2024-09-18-preview/Operations_List_MinimumSet_Gen.json +// Generated from example definition: 2024-09-18/Operations_List_MinimumSet_Gen.json func ExampleOperationsClient_NewListPager_operationsListGeneratedByMinimumSetRule() { cred, err := azidentity.NewDefaultAzureCredential(nil) if err != nil { diff --git a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/tsp-location.yaml b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/tsp-location.yaml index b7d4888617fe..9be22b322145 100644 --- a/sdk/resourcemanager/weightsandbiases/armweightsandbiases/tsp-location.yaml +++ b/sdk/resourcemanager/weightsandbiases/armweightsandbiases/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/liftrweightsandbiases/Liftr.WeightsAndBiases.Management -commit: 237c2500daac3752cafd855c35e86e14a73586b3 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs -additionalDirectories: \ No newline at end of file +additionalDirectories: diff --git a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/CHANGELOG.md b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/CHANGELOG.md index 3a3e8181ab5f..3b932703e532 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-05-13) +### 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..b76baaabcdfb 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) { @@ -125,7 +140,7 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginCreate(req * 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~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPApplicationServerInstance](req) @@ -177,7 +192,7 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchBeginDelete(req * 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~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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) @@ -223,7 +238,7 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchGet(req *http.Req 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~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -262,7 +277,7 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchNewListPager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/applicationInstances` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -294,16 +309,16 @@ 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()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.StartRequest](req) @@ -322,46 +337,46 @@ 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()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.StopRequest](req) @@ -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 @@ -417,7 +432,7 @@ func (s *SAPApplicationServerInstancesServerTransport) dispatchUpdate(req *http. 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~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.UpdateSAPApplicationInstanceRequest](req) @@ -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 59% rename from sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralinstances_server.go rename to sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/sapcentralserverinstances_server.go index b4c64a343374..1f74c2818ebb 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")} } @@ -125,7 +140,7 @@ func (s *SAPCentralInstancesServerTransport) dispatchBeginCreate(req *http.Reque 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~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPCentralServerInstance](req) @@ -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")} } @@ -177,7 +192,7 @@ func (s *SAPCentralInstancesServerTransport) dispatchBeginDelete(req *http.Reque 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~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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,14 +231,14 @@ 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")} } 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~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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")} } @@ -262,7 +277,7 @@ func (s *SAPCentralInstancesServerTransport) dispatchNewListPager(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/centralInstances` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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,16 +309,16 @@ 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()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.StartRequest](req) @@ -322,46 +337,46 @@ 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()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.StopRequest](req) @@ -380,44 +395,44 @@ 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")} } 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~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.UpdateSAPCentralInstanceRequest](req) @@ -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..e2e05c365d06 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) { @@ -125,7 +140,7 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchBeginCreate(req *http.Requ 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~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPDatabaseInstance](req) @@ -177,7 +192,7 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchBeginDelete(req *http.Requ 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~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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) @@ -223,7 +238,7 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchGet(req *http.Request) (*h 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~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -262,7 +277,7 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchNewListPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/databaseInstances` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -294,16 +309,16 @@ 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()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.StartRequest](req) @@ -322,46 +337,46 @@ 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()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.StopRequest](req) @@ -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 @@ -417,7 +432,7 @@ func (s *SAPDatabaseInstancesServerTransport) dispatchUpdate(req *http.Request) 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~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.UpdateSAPDatabaseInstanceRequest](req) @@ -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..1ac5ac3d2ce0 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) { @@ -135,7 +174,7 @@ func (s *SAPVirtualInstancesServerTransport) dispatchBeginCreate(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.SAPVirtualInstance](req) @@ -183,7 +222,7 @@ func (s *SAPVirtualInstancesServerTransport) dispatchBeginDelete(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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) @@ -225,7 +264,7 @@ func (s *SAPVirtualInstancesServerTransport) dispatchGet(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -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 len(matches) < 3 { + 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 len(matches) < 3 { + 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 len(matches) < 3 { + 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 len(matches) < 3 { + 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")} @@ -260,7 +431,7 @@ func (s *SAPVirtualInstancesServerTransport) dispatchNewListByResourceGroupPager const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -297,7 +468,7 @@ func (s *SAPVirtualInstancesServerTransport) dispatchNewListBySubscriptionPager( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := s.srv.NewListBySubscriptionPager(nil) @@ -330,7 +501,7 @@ func (s *SAPVirtualInstancesServerTransport) dispatchBeginStart(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/start` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.StartRequest](req) @@ -384,7 +555,7 @@ func (s *SAPVirtualInstancesServerTransport) dispatchBeginStop(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/stop` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.StopRequest](req) @@ -438,7 +609,7 @@ func (s *SAPVirtualInstancesServerTransport) dispatchBeginUpdate(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Workloads/sapVirtualInstances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armworkloadssapvirtualinstance.UpdateSAPVirtualInstanceRequest](req) @@ -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 deleted file mode 100644 index 81f308b0d343..000000000000 --- a/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/fake/time_rfc3339.go +++ /dev/null @@ -1,110 +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 ( - "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 { - 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/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..200889178bc3 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,48 +576,40 @@ 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. OSConfiguration OSConfigurationClassification } -// Operation - Details of a REST API operation, returned from the Resource Provider Operations API +// Operation - REST API Operation +// +// Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { // Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + // 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 +621,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 +642,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 +670,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 +693,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 +712,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 +799,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 +823,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 +879,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 +891,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 +910,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 +996,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 +1046,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 +1099,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 +1114,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 +1127,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 +1161,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 +1189,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 +1202,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 +1220,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 +1248,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 +1287,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 +1299,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 +1316,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 +1333,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 +1347,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 +1366,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 +1380,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 +1406,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 +1420,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 +1460,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 +1488,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 +1535,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 +1565,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 +1580,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 +1593,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..f325464789aa 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,146 @@ 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), + // 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_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 +1118,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 +1131,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 +1142,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 +1154,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 +1213,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 +1224,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 +1245,183 @@ 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), + // 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{ // }, - // 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 +1432,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 +1444,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 +1456,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 +1468,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 +1527,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 +1562,186 @@ 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), + // 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{ // }, - // 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 +1752,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 +1765,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 +1776,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 +1788,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 +1882,264 @@ 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), + // 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{ // }, - // 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 +2151,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 +2225,63 @@ 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), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, - // 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 +2292,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 +2307,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 +2319,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 +2334,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 +2382,149 @@ 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), + // 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{ // }, - // 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 +2535,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 +2551,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 +2562,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 +2577,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 +2590,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 +2625,164 @@ 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), + // 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{ // }, - // 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 +2791,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 +2814,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 +2859,137 @@ 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), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, - // 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 +3003,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 +3027,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 +3038,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 +3165,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 +3177,227 @@ 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), + // 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{ // }, - // 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 +3411,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 +3435,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 +3446,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 +3637,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 +3649,291 @@ 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), + // 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{ // }, - // 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 +3947,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 +3971,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 +3982,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 +4147,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 +4158,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 +4170,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 +4182,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{ + // 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), + // Status: to.Ptr(armworkloadssapvirtualinstance.SAPVirtualInstanceStatus("Unknown")), // }, - // 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 +4480,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 +4498,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 +4510,119 @@ 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), + // 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{ // }, - // 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 +4636,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 +4660,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 +4685,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 +4696,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 +4705,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 +4717,134 @@ 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), + // 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{ // }, - // 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 +4858,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 +4870,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 +4882,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 +4895,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 +4907,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 +4918,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 +4930,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 +4942,137 @@ 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), + // 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{ // }, - // 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 +5086,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 +5098,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 +5110,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 +5123,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 +5135,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 +5146,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 +5158,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 +5170,172 @@ 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), + // 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{ // }, - // 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 +5347,97 @@ 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), + // 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{ // }, - // 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 +5445,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 +5475,92 @@ 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), + // 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{ // }, - // 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 +5568,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 +5580,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 +5592,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 +5605,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 +5617,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 +5628,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 +5656,147 @@ 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), + // 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{ // }, - // 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 +5804,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 +5816,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 +5828,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 +5841,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 +5853,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 +5864,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 +5892,453 @@ 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), + // 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{ // }, - // 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), + // 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: 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 +6350,2364 @@ 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), + // 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: 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), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningState("Accepted")), + // 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), + // ProvisioningState: to.Ptr(armworkloadssapvirtualinstance.SapVirtualInstanceProvisioningState("Accepted")), + // 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 +8722,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 +8974,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 +9301,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 +9338,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 +9374,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 +9522,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..9dad758ad5f6 --- /dev/null +++ b/sdk/resourcemanager/workloadssapvirtualinstance/armworkloadssapvirtualinstance/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/workloads/Workloads.SAPVirtualInstance.Management +commit: 079f70d6f2b754db6b736e117196104efd2dd496 +repo: Azure/azure-rest-api-specs +additionalDirectories: 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), - // }}, - // } -} diff --git a/sdk/security/keyvault/azcertificates/CHANGELOG.md b/sdk/security/keyvault/azcertificates/CHANGELOG.md index 9cd9f060c1b1..b7afde6b6a82 100644 --- a/sdk/security/keyvault/azcertificates/CHANGELOG.md +++ b/sdk/security/keyvault/azcertificates/CHANGELOG.md @@ -1,5 +1,31 @@ # Release History +## 1.4.0-beta.2 (2025-05-13) +### Breaking Changes + +- Type of `Certificate.ID` has been changed from `*ID` to `*string` +- Type of `Certificate.KID` has been changed from `*ID` to `*string` +- Type of `Certificate.SID` has been changed from `*ID` to `*string` +- Type of `CertificateAttributes.RecoveryLevel` has been changed from `*string` to `*DeletionRecoveryLevel` +- Type of `CertificateOperation.Error` has been changed from `*ErrorInfo` to `*KeyVaultErrorError` +- Type of `CertificateOperation.ID` has been changed from `*ID` to `*string` +- Type of `CertificatePolicy.ID` has been changed from `*ID` to `*string` +- Type of `CertificateProperties.ID` has been changed from `*ID` to `*string` +- Type of `DeletedCertificate.ID` has been changed from `*ID` to `*string` +- Type of `DeletedCertificate.KID` has been changed from `*ID` to `*string` +- Type of `DeletedCertificate.SID` has been changed from `*ID` to `*string` +- Type of `DeletedCertificateProperties.ID` has been changed from `*ID` to `*string` + +### Features Added + +- New enum type `DeletionRecoveryLevel` with values `DeletionRecoveryLevelCustomizedRecoverable`, `DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription`, `DeletionRecoveryLevelCustomizedRecoverablePurgeable`, `DeletionRecoveryLevelPurgeable`, `DeletionRecoveryLevelRecoverable`, `DeletionRecoveryLevelRecoverableProtectedSubscription`, `DeletionRecoveryLevelRecoverablePurgeable` +- New struct `KeyVaultErrorError` +- New field `Maxresults` in struct `ListCertificatePropertiesOptions` +- New field `Maxresults` in struct `ListCertificatePropertiesVersionsOptions` +- New field `Maxresults` in struct `ListDeletedCertificatePropertiesOptions` +- New field `Maxresults` in struct `ListIssuerPropertiesOptions` + + ## 1.4.0-beta.2 (Unreleased) ### Features Added diff --git a/sdk/security/keyvault/azcertificates/build.go b/sdk/security/keyvault/azcertificates/build.go deleted file mode 100644 index 975bf9e748ba..000000000000 --- a/sdk/security/keyvault/azcertificates/build.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:generate tsp-client update -//go:generate go run internal/transforms.go -//go:generate goimports -w . - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -package azcertificates diff --git a/sdk/security/keyvault/azcertificates/client.go b/sdk/security/keyvault/azcertificates/client.go index 4376e79b48b9..2ad5f20c9caa 100644 --- a/sdk/security/keyvault/azcertificates/client.go +++ b/sdk/security/keyvault/azcertificates/client.go @@ -7,14 +7,13 @@ package azcertificates import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "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" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // Client - The key vault client performs cryptographic key operations and vault operations against the Key Vault service. @@ -412,6 +411,9 @@ func (client *Client) getCertificateCreateRequest(ctx context.Context, name stri return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{certificate-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{certificate-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath)) if err != nil { @@ -827,6 +829,9 @@ func (client *Client) listCertificatePropertiesCreateRequest(ctx context.Context if options != nil && options.IncludePending != nil { reqQP.Set("includePending", strconv.FormatBool(*options.IncludePending)) } + if options != nil && options.Maxresults != nil { + reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -873,7 +878,7 @@ func (client *Client) NewListCertificatePropertiesVersionsPager(name string, opt } // listCertificatePropertiesVersionsCreateRequest creates the ListCertificatePropertiesVersions request. -func (client *Client) listCertificatePropertiesVersionsCreateRequest(ctx context.Context, name string, _ *ListCertificatePropertiesVersionsOptions) (*policy.Request, error) { +func (client *Client) listCertificatePropertiesVersionsCreateRequest(ctx context.Context, name string, options *ListCertificatePropertiesVersionsOptions) (*policy.Request, error) { host := "{vaultBaseUrl}" host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/certificates/{certificate-name}/versions" @@ -887,6 +892,9 @@ func (client *Client) listCertificatePropertiesVersionsCreateRequest(ctx context } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "7.6-preview.2") + if options != nil && options.Maxresults != nil { + reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -947,6 +955,9 @@ func (client *Client) listDeletedCertificatePropertiesCreateRequest(ctx context. if options != nil && options.IncludePending != nil { reqQP.Set("includePending", strconv.FormatBool(*options.IncludePending)) } + if options != nil && options.Maxresults != nil { + reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -991,7 +1002,7 @@ func (client *Client) NewListIssuerPropertiesPager(options *ListIssuerProperties } // listIssuerPropertiesCreateRequest creates the ListIssuerProperties request. -func (client *Client) listIssuerPropertiesCreateRequest(ctx context.Context, _ *ListIssuerPropertiesOptions) (*policy.Request, error) { +func (client *Client) listIssuerPropertiesCreateRequest(ctx context.Context, options *ListIssuerPropertiesOptions) (*policy.Request, error) { host := "{vaultBaseUrl}" host = strings.ReplaceAll(host, "{vaultBaseUrl}", client.vaultBaseUrl) urlPath := "/certificates/issuers" @@ -1001,6 +1012,9 @@ func (client *Client) listIssuerPropertiesCreateRequest(ctx context.Context, _ * } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "7.6-preview.2") + if options != nil && options.Maxresults != nil { + reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1404,6 +1418,9 @@ func (client *Client) updateCertificateCreateRequest(ctx context.Context, name s return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{certificate-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{certificate-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(host, urlPath)) if err != nil { diff --git a/sdk/security/keyvault/azcertificates/constants.go b/sdk/security/keyvault/azcertificates/constants.go index bb6c4eb8f94b..f3dbac1f25cf 100644 --- a/sdk/security/keyvault/azcertificates/constants.go +++ b/sdk/security/keyvault/azcertificates/constants.go @@ -22,7 +22,7 @@ func PossibleCertificatePolicyActionValues() []CertificatePolicyAction { } } -// CurveName - Elliptic curve name. +// CurveName - Elliptic curve name. For valid values, see JsonWebKeyCurveName. type CurveName string const ( @@ -46,6 +46,59 @@ func PossibleCurveNameValues() []CurveName { } } +// DeletionRecoveryLevel - Reflects the deletion recovery level currently in effect for secrets in the current vault. If it +// contains 'Purgeable', the secret can be permanently deleted by a privileged user; otherwise, only the system can purge +// the secret, at the end of the retention interval. +type DeletionRecoveryLevel string + +const ( + // DeletionRecoveryLevelCustomizedRecoverable - Denotes a vault state in which deletion is recoverable without the possibility + // for immediate and permanent deletion (i.e. purge when 7 <= SoftDeleteRetentionInDays < 90).This level guarantees the recoverability + // of the deleted entity during the retention interval and while the subscription is still available. + DeletionRecoveryLevelCustomizedRecoverable DeletionRecoveryLevel = "CustomizedRecoverable" + // DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription - Denotes a vault and subscription state in which deletion + // is recoverable, immediate and permanent deletion (i.e. purge) is not permitted, and in which the subscription itself cannot + // be permanently canceled when 7 <= SoftDeleteRetentionInDays < 90. This level guarantees the recoverability of the deleted + // entity during the retention interval, and also reflects the fact that the subscription itself cannot be cancelled. + DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription DeletionRecoveryLevel = "CustomizedRecoverable+ProtectedSubscription" + // DeletionRecoveryLevelCustomizedRecoverablePurgeable - Denotes a vault state in which deletion is recoverable, and which + // also permits immediate and permanent deletion (i.e. purge when 7 <= SoftDeleteRetentionInDays < 90). This level guarantees + // the recoverability of the deleted entity during the retention interval, unless a Purge operation is requested, or the subscription + // is cancelled. + DeletionRecoveryLevelCustomizedRecoverablePurgeable DeletionRecoveryLevel = "CustomizedRecoverable+Purgeable" + // DeletionRecoveryLevelPurgeable - Denotes a vault state in which deletion is an irreversible operation, without the possibility + // for recovery. This level corresponds to no protection being available against a Delete operation; the data is irretrievably + // lost upon accepting a Delete operation at the entity level or higher (vault, resource group, subscription etc.) + DeletionRecoveryLevelPurgeable DeletionRecoveryLevel = "Purgeable" + // DeletionRecoveryLevelRecoverable - Denotes a vault state in which deletion is recoverable without the possibility for immediate + // and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity during the retention + // interval (90 days) and while the subscription is still available. System wil permanently delete it after 90 days, if not + // recovered + DeletionRecoveryLevelRecoverable DeletionRecoveryLevel = "Recoverable" + // DeletionRecoveryLevelRecoverableProtectedSubscription - Denotes a vault and subscription state in which deletion is recoverable + // within retention interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in which the subscription + // itself cannot be permanently canceled. System wil permanently delete it after 90 days, if not recovered + DeletionRecoveryLevelRecoverableProtectedSubscription DeletionRecoveryLevel = "Recoverable+ProtectedSubscription" + // DeletionRecoveryLevelRecoverablePurgeable - Denotes a vault state in which deletion is recoverable, and which also permits + // immediate and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity during the + // retention interval (90 days), unless a Purge operation is requested, or the subscription is cancelled. System wil permanently + // delete it after 90 days, if not recovered + DeletionRecoveryLevelRecoverablePurgeable DeletionRecoveryLevel = "Recoverable+Purgeable" +) + +// PossibleDeletionRecoveryLevelValues returns the possible values for the DeletionRecoveryLevel const type. +func PossibleDeletionRecoveryLevelValues() []DeletionRecoveryLevel { + return []DeletionRecoveryLevel{ + DeletionRecoveryLevelCustomizedRecoverable, + DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription, + DeletionRecoveryLevelCustomizedRecoverablePurgeable, + DeletionRecoveryLevelPurgeable, + DeletionRecoveryLevelRecoverable, + DeletionRecoveryLevelRecoverableProtectedSubscription, + DeletionRecoveryLevelRecoverablePurgeable, + } +} + // KeyType - The type of key pair to be used for the certificate. type KeyType string diff --git a/sdk/security/keyvault/azcertificates/models.go b/sdk/security/keyvault/azcertificates/models.go index 8b195cde56e1..816f67db88ba 100644 --- a/sdk/security/keyvault/azcertificates/models.go +++ b/sdk/security/keyvault/azcertificates/models.go @@ -46,16 +46,16 @@ type Certificate struct { Tags map[string]*string // READ-ONLY; The certificate id. - ID *ID + ID *string // READ-ONLY; The key id. - KID *ID + KID *string // READ-ONLY; The management policy. Policy *CertificatePolicy // READ-ONLY; The secret id. - SID *ID + SID *string // READ-ONLY; Thumbprint of the certificate. X509Thumbprint []byte @@ -81,7 +81,7 @@ type CertificateAttributes struct { // READ-ONLY; Reflects the deletion recovery level currently in effect for certificates in the current vault. If it contains // 'Purgeable', the certificate can be permanently deleted by a privileged user; otherwise, only the system can purge the // certificate, at the end of the retention interval. - RecoveryLevel *string + RecoveryLevel *DeletionRecoveryLevel // READ-ONLY; Last updated time in UTC. Updated *time.Time @@ -96,7 +96,7 @@ type CertificateOperation struct { CancellationRequested *bool // Error encountered, if any, during the certificate operation. - Error *ErrorInfo + Error *KeyVaultErrorError // Parameters for the issuer of the X509 component of a certificate. IssuerParameters *IssuerParameters @@ -118,7 +118,7 @@ type CertificateOperation struct { Target *string // READ-ONLY; The certificate id. - ID *ID + ID *string } // CertificatePolicy - Management policy for a certificate. @@ -142,7 +142,7 @@ type CertificatePolicy struct { X509CertificateProperties *X509CertificateProperties // READ-ONLY; The certificate id. - ID *ID + ID *string } // CertificateProperties - The certificate item containing certificate metadata. @@ -151,7 +151,7 @@ type CertificateProperties struct { Attributes *CertificateAttributes // Certificate identifier. - ID *ID + ID *string // Application specific metadata in the form of key-value pairs. Tags map[string]*string @@ -232,16 +232,16 @@ type DeletedCertificate struct { DeletedDate *time.Time // READ-ONLY; The certificate id. - ID *ID + ID *string // READ-ONLY; The key id. - KID *ID + KID *string // READ-ONLY; The management policy. Policy *CertificatePolicy // READ-ONLY; The secret id. - SID *ID + SID *string // READ-ONLY; The time when the certificate is scheduled to be purged, in UTC ScheduledPurgeDate *time.Time @@ -256,7 +256,7 @@ type DeletedCertificateProperties struct { Attributes *CertificateAttributes // Certificate identifier. - ID *ID + ID *string // The url of the recovery object, used to identify and recover the deleted certificate. RecoveryID *string @@ -379,7 +379,7 @@ type IssuerPropertiesListResult struct { // KeyProperties - Properties of the key pair backing a certificate. type KeyProperties struct { - // Elliptic curve name. + // Elliptic curve name. For valid values, see JsonWebKeyCurveName. Curve *CurveName // Indicates if the private key can be exported. Release policy must be provided when creating the first version of an exportable @@ -396,6 +396,17 @@ type KeyProperties struct { ReuseKey *bool } +type KeyVaultErrorError struct { + // READ-ONLY; The error code. + Code *string + + // READ-ONLY; The key vault server error. + InnerError *KeyVaultErrorError + + // READ-ONLY; The error message. + Message *string +} + // LifetimeAction - Action and its trigger that will be performed by Key Vault over the lifetime of a certificate. type LifetimeAction struct { // The action that will be executed. diff --git a/sdk/security/keyvault/azcertificates/models_serde.go b/sdk/security/keyvault/azcertificates/models_serde.go index 4cefb3d42b24..006cd463bf79 100644 --- a/sdk/security/keyvault/azcertificates/models_serde.go +++ b/sdk/security/keyvault/azcertificates/models_serde.go @@ -7,10 +7,9 @@ package azcertificates import ( "encoding/json" "fmt" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" ) // MarshalJSON implements the json.Marshaller interface for type AdministratorContact. @@ -967,6 +966,41 @@ func (k *KeyProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type KeyVaultErrorError. +func (k KeyVaultErrorError) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", k.Code) + populate(objectMap, "innererror", k.InnerError) + populate(objectMap, "message", k.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultErrorError. +func (k *KeyVaultErrorError) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &k.Code) + delete(rawMsg, key) + case "innererror": + err = unpopulate(val, "InnerError", &k.InnerError) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &k.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type LifetimeAction. func (l LifetimeAction) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/sdk/security/keyvault/azcertificates/options.go b/sdk/security/keyvault/azcertificates/options.go index 90830a78e822..8475b74c139e 100644 --- a/sdk/security/keyvault/azcertificates/options.go +++ b/sdk/security/keyvault/azcertificates/options.go @@ -73,12 +73,16 @@ type ImportCertificateOptions struct { type ListCertificatePropertiesOptions struct { // Specifies whether to include certificates which are not completely provisioned. IncludePending *bool + + // Maximum number of results to return in a page. If not specified the service will return up to 25 results. + Maxresults *int32 } // ListCertificatePropertiesVersionsOptions contains the optional parameters for the Client.NewListCertificatePropertiesVersionsPager // method. type ListCertificatePropertiesVersionsOptions struct { - // placeholder for future optional parameters + // Maximum number of results to return in a page. If not specified the service will return up to 25 results. + Maxresults *int32 } // ListDeletedCertificatePropertiesOptions contains the optional parameters for the Client.NewListDeletedCertificatePropertiesPager @@ -86,11 +90,15 @@ type ListCertificatePropertiesVersionsOptions struct { type ListDeletedCertificatePropertiesOptions struct { // Specifies whether to include certificates which are not completely provisioned. IncludePending *bool + + // Maximum number of results to return in a page. If not specified the service will return up to 25 results. + Maxresults *int32 } // ListIssuerPropertiesOptions contains the optional parameters for the Client.NewListIssuerPropertiesPager method. type ListIssuerPropertiesOptions struct { - // placeholder for future optional parameters + // Maximum number of results to return in a page. If not specified the service will return up to 25 results. + Maxresults *int32 } // MergeCertificateOptions contains the optional parameters for the Client.MergeCertificate method. diff --git a/sdk/security/keyvault/azcertificates/time_unix.go b/sdk/security/keyvault/azcertificates/time_unix.go index b9d731eb44ba..a9698ee84f6e 100644 --- a/sdk/security/keyvault/azcertificates/time_unix.go +++ b/sdk/security/keyvault/azcertificates/time_unix.go @@ -7,10 +7,9 @@ package azcertificates import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) type timeUnix time.Time diff --git a/sdk/security/keyvault/azcertificates/tsp-location.yaml b/sdk/security/keyvault/azcertificates/tsp-location.yaml index fd6b7b237219..6c0eee1b1f81 100644 --- a/sdk/security/keyvault/azcertificates/tsp-location.yaml +++ b/sdk/security/keyvault/azcertificates/tsp-location.yaml @@ -1,6 +1,5 @@ directory: specification/keyvault/Security.KeyVault.Certificates -commit: cac8bb6ffc89f41dcd9bffaa265ecc45ef2d83c1 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs additionalDirectories: -- specification/keyvault/Security.KeyVault.Common/ -# https://github.com/Azure/azure-rest-api-specs/tree/cac8bb6ffc89f41dcd9bffaa265ecc45ef2d83c1/specification/keyvault/Security.KeyVault.Certificates +- specification/keyvault/Security.KeyVault.Common diff --git a/sdk/security/keyvault/azkeys/CHANGELOG.md b/sdk/security/keyvault/azkeys/CHANGELOG.md index 8402310e6915..2321611755bd 100644 --- a/sdk/security/keyvault/azkeys/CHANGELOG.md +++ b/sdk/security/keyvault/azkeys/CHANGELOG.md @@ -1,5 +1,25 @@ # Release History +## 1.4.0-beta.2 (2025-05-13) +### Breaking Changes + +- Type of `DeletedKeyProperties.KID` has been changed from `*ID` to `*string` +- Type of `JSONWebKey.KID` has been changed from `*ID` to `*string` +- Type of `JSONWebKey.KeyOps` has been changed from `[]*KeyOperation` to `[]*string` +- Type of `KeyAttributes.RecoveryLevel` has been changed from `*string` to `*DeletionRecoveryLevel` +- Type of `KeyOperationResult.KID` has been changed from `*ID` to `*string` +- Type of `KeyProperties.KID` has been changed from `*ID` to `*string` + +### Features Added + +- New value `KeyOperationExport` added to enum type `KeyOperation` +- New value `SignatureAlgorithmRSNULL` added to enum type `SignatureAlgorithm` +- New enum type `DeletionRecoveryLevel` with values `DeletionRecoveryLevelCustomizedRecoverable`, `DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription`, `DeletionRecoveryLevelCustomizedRecoverablePurgeable`, `DeletionRecoveryLevelPurgeable`, `DeletionRecoveryLevelRecoverable`, `DeletionRecoveryLevelRecoverableProtectedSubscription`, `DeletionRecoveryLevelRecoverablePurgeable` +- New field `Maxresults` in struct `ListDeletedKeyPropertiesOptions` +- New field `Maxresults` in struct `ListKeyPropertiesOptions` +- New field `Maxresults` in struct `ListKeyPropertiesVersionsOptions` + + ## 1.4.0-beta.2 (Unreleased) ### Features Added diff --git a/sdk/security/keyvault/azkeys/build.go b/sdk/security/keyvault/azkeys/build.go deleted file mode 100644 index 16ea90bf8888..000000000000 --- a/sdk/security/keyvault/azkeys/build.go +++ /dev/null @@ -1,8 +0,0 @@ -//go:generate tsp-client update -//go:generate go run ./internal/transforms.go -//go:generate goimports -w . - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -package azkeys diff --git a/sdk/security/keyvault/azkeys/client.go b/sdk/security/keyvault/azkeys/client.go index 7862b63cb734..920e22e9e568 100644 --- a/sdk/security/keyvault/azkeys/client.go +++ b/sdk/security/keyvault/azkeys/client.go @@ -7,13 +7,13 @@ package azkeys import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "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" ) // Client - The key vault client performs cryptographic key operations and vault operations against the Key Vault service. @@ -196,6 +196,9 @@ func (client *Client) decryptCreateRequest(ctx context.Context, name string, ver return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{key-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{key-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath)) if err != nil { @@ -324,6 +327,9 @@ func (client *Client) encryptCreateRequest(ctx context.Context, name string, ver return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{key-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{key-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath)) if err != nil { @@ -447,6 +453,9 @@ func (client *Client) getKeyCreateRequest(ctx context.Context, name string, vers return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{key-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{key-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath)) if err != nil { @@ -508,6 +517,9 @@ func (client *Client) getKeyAttestationCreateRequest(ctx context.Context, name s return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{key-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{key-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath)) if err != nil { @@ -751,6 +763,9 @@ func (client *Client) listDeletedKeyPropertiesCreateRequest(ctx context.Context, } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "7.6-preview.2") + if options != nil && options.Maxresults != nil { + reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -806,6 +821,9 @@ func (client *Client) listKeyPropertiesCreateRequest(ctx context.Context, option } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "7.6-preview.2") + if options != nil && options.Maxresults != nil { + reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -865,6 +883,9 @@ func (client *Client) listKeyPropertiesVersionsCreateRequest(ctx context.Context } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "7.6-preview.2") + if options != nil && options.Maxresults != nil { + reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -1026,6 +1047,9 @@ func (client *Client) releaseCreateRequest(ctx context.Context, name string, ver return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{key-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{key-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath)) if err != nil { @@ -1212,6 +1236,9 @@ func (client *Client) signCreateRequest(ctx context.Context, name string, versio return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{key-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{key-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath)) if err != nil { @@ -1278,6 +1305,9 @@ func (client *Client) unwrapKeyCreateRequest(ctx context.Context, name string, v return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{key-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{key-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath)) if err != nil { @@ -1344,6 +1374,9 @@ func (client *Client) updateKeyCreateRequest(ctx context.Context, name string, v return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{key-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{key-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(host, urlPath)) if err != nil { @@ -1473,6 +1506,9 @@ func (client *Client) verifyCreateRequest(ctx context.Context, name string, vers return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{key-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{key-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath)) if err != nil { @@ -1541,6 +1577,9 @@ func (client *Client) wrapKeyCreateRequest(ctx context.Context, name string, ver return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{key-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{key-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(host, urlPath)) if err != nil { diff --git a/sdk/security/keyvault/azkeys/constants.go b/sdk/security/keyvault/azkeys/constants.go index b842a88eafa0..b57ab30e9a0c 100644 --- a/sdk/security/keyvault/azkeys/constants.go +++ b/sdk/security/keyvault/azkeys/constants.go @@ -4,7 +4,7 @@ package azkeys -// CurveName - Elliptic curve name. +// CurveName - Elliptic curve name. For valid values, see JsonWebKeyCurveName. type CurveName string const ( @@ -28,6 +28,59 @@ func PossibleCurveNameValues() []CurveName { } } +// DeletionRecoveryLevel - Reflects the deletion recovery level currently in effect for certificates in the current vault. +// If it contains 'Purgeable', the certificate can be permanently deleted by a privileged user; otherwise, only the system +// can purge the certificate, at the end of the retention interval. +type DeletionRecoveryLevel string + +const ( + // DeletionRecoveryLevelCustomizedRecoverable - Denotes a vault state in which deletion is recoverable without the possibility + // for immediate and permanent deletion (i.e. purge when 7 <= SoftDeleteRetentionInDays < 90).This level guarantees the recoverability + // of the deleted entity during the retention interval and while the subscription is still available. + DeletionRecoveryLevelCustomizedRecoverable DeletionRecoveryLevel = "CustomizedRecoverable" + // DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription - Denotes a vault and subscription state in which deletion + // is recoverable, immediate and permanent deletion (i.e. purge) is not permitted, and in which the subscription itself cannot + // be permanently canceled when 7 <= SoftDeleteRetentionInDays < 90. This level guarantees the recoverability of the deleted + // entity during the retention interval, and also reflects the fact that the subscription itself cannot be cancelled. + DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription DeletionRecoveryLevel = "CustomizedRecoverable+ProtectedSubscription" + // DeletionRecoveryLevelCustomizedRecoverablePurgeable - Denotes a vault state in which deletion is recoverable, and which + // also permits immediate and permanent deletion (i.e. purge when 7 <= SoftDeleteRetentionInDays < 90). This level guarantees + // the recoverability of the deleted entity during the retention interval, unless a Purge operation is requested, or the subscription + // is cancelled. + DeletionRecoveryLevelCustomizedRecoverablePurgeable DeletionRecoveryLevel = "CustomizedRecoverable+Purgeable" + // DeletionRecoveryLevelPurgeable - Denotes a vault state in which deletion is an irreversible operation, without the possibility + // for recovery. This level corresponds to no protection being available against a Delete operation; the data is irretrievably + // lost upon accepting a Delete operation at the entity level or higher (vault, resource group, subscription etc.) + DeletionRecoveryLevelPurgeable DeletionRecoveryLevel = "Purgeable" + // DeletionRecoveryLevelRecoverable - Denotes a vault state in which deletion is recoverable without the possibility for immediate + // and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity during the retention + // interval(90 days) and while the subscription is still available. System wil permanently delete it after 90 days, if not + // recovered + DeletionRecoveryLevelRecoverable DeletionRecoveryLevel = "Recoverable" + // DeletionRecoveryLevelRecoverableProtectedSubscription - Denotes a vault and subscription state in which deletion is recoverable + // within retention interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in which the subscription + // itself cannot be permanently canceled. System wil permanently delete it after 90 days, if not recovered + DeletionRecoveryLevelRecoverableProtectedSubscription DeletionRecoveryLevel = "Recoverable+ProtectedSubscription" + // DeletionRecoveryLevelRecoverablePurgeable - Denotes a vault state in which deletion is recoverable, and which also permits + // immediate and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity during the + // retention interval (90 days), unless a Purge operation is requested, or the subscription is cancelled. System wil permanently + // delete it after 90 days, if not recovered + DeletionRecoveryLevelRecoverablePurgeable DeletionRecoveryLevel = "Recoverable+Purgeable" +) + +// PossibleDeletionRecoveryLevelValues returns the possible values for the DeletionRecoveryLevel const type. +func PossibleDeletionRecoveryLevelValues() []DeletionRecoveryLevel { + return []DeletionRecoveryLevel{ + DeletionRecoveryLevelCustomizedRecoverable, + DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription, + DeletionRecoveryLevelCustomizedRecoverablePurgeable, + DeletionRecoveryLevelPurgeable, + DeletionRecoveryLevelRecoverable, + DeletionRecoveryLevelRecoverableProtectedSubscription, + DeletionRecoveryLevelRecoverablePurgeable, + } +} + // EncryptionAlgorithm - An algorithm used for encryption and decryption. type EncryptionAlgorithm string @@ -120,7 +173,7 @@ func PossibleKeyEncryptionAlgorithmValues() []KeyEncryptionAlgorithm { } } -// KeyOperation - JSON web key operations. +// KeyOperation - JSON web key operations. For more information, see JsonWebKeyOperation. type KeyOperation string const ( @@ -128,7 +181,8 @@ const ( KeyOperationDecrypt KeyOperation = "decrypt" // KeyOperationEncrypt - Indicates that the key can be used to encrypt. KeyOperationEncrypt KeyOperation = "encrypt" - + // KeyOperationExport - Indicates that the private component of the key can be exported. + KeyOperationExport KeyOperation = "export" // KeyOperationImport - Indicates that the key can be imported during creation. KeyOperationImport KeyOperation = "import" // KeyOperationSign - Indicates that the key can be used to sign. @@ -146,7 +200,7 @@ func PossibleKeyOperationValues() []KeyOperation { return []KeyOperation{ KeyOperationDecrypt, KeyOperationEncrypt, - + KeyOperationExport, KeyOperationImport, KeyOperationSign, KeyOperationUnwrapKey, @@ -203,7 +257,8 @@ func PossibleKeyTypeValues() []KeyType { } } -// SignatureAlgorithm - The signing/verification algorithm identifier. +// SignatureAlgorithm - The signing/verification algorithm identifier. For more information on possible algorithm types, see +// JsonWebKeySignatureAlgorithm. type SignatureAlgorithm string const ( @@ -233,6 +288,8 @@ const ( SignatureAlgorithmRS384 SignatureAlgorithm = "RS384" // SignatureAlgorithmRS512 - RSASSA-PKCS1-v1_5 using SHA-512, as described in https://tools.ietf.org/html/rfc7518 SignatureAlgorithmRS512 SignatureAlgorithm = "RS512" + // SignatureAlgorithmRSNULL - Reserved + SignatureAlgorithmRSNULL SignatureAlgorithm = "RSNULL" ) // PossibleSignatureAlgorithmValues returns the possible values for the SignatureAlgorithm const type. @@ -251,5 +308,6 @@ func PossibleSignatureAlgorithmValues() []SignatureAlgorithm { SignatureAlgorithmRS256, SignatureAlgorithmRS384, SignatureAlgorithmRS512, + SignatureAlgorithmRSNULL, } } diff --git a/sdk/security/keyvault/azkeys/models.go b/sdk/security/keyvault/azkeys/models.go index 64ef3d327afb..a3b3fdad5080 100644 --- a/sdk/security/keyvault/azkeys/models.go +++ b/sdk/security/keyvault/azkeys/models.go @@ -14,16 +14,16 @@ type BackupKeyResult struct { // CreateKeyParameters - The key create parameters. type CreateKeyParameters struct { - // REQUIRED; The type of key to create. + // REQUIRED; The type of key to create. For valid values, see JsonWebKeyType. Kty *KeyType - // Elliptic curve name. + // Elliptic curve name. For valid values, see JsonWebKeyCurveName. Curve *CurveName // The attributes of a key managed by the key vault service. KeyAttributes *KeyAttributes - // Json web key operations. + // Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. KeyOps []*KeyOperation // The key size in bits. For example: 2048, 3072, or 4096 for RSA. @@ -39,7 +39,7 @@ type CreateKeyParameters struct { Tags map[string]*string } -// DeletedKey - A DeletedKey consisting of a WebKey plus its Attributes and deletion info +// DeletedKey - A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info type DeletedKey struct { // The key management attributes. Attributes *KeyAttributes @@ -73,7 +73,7 @@ type DeletedKeyProperties struct { Attributes *KeyAttributes // Key identifier. - KID *ID + KID *string // The url of the recovery object, used to identify and recover the deleted key. RecoveryID *string @@ -128,7 +128,7 @@ type ImportKeyParameters struct { // JSONWebKey - As of http://tools.ietf.org/html/draft-ietf-jose-json-web-key-18 type JSONWebKey struct { - // Elliptic curve name. + // Elliptic curve name. For valid values, see JsonWebKeyCurveName. Crv *CurveName // RSA private exponent, or the D component of an EC private key. @@ -147,10 +147,10 @@ type JSONWebKey struct { K []byte // Key identifier. - KID *ID + KID *string - // Json web key operations. - KeyOps []*KeyOperation + // Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. + KeyOps []*string // JsonWebKey Key Type (kty), as defined in https://tools.ietf.org/html/draft-ietf-jose-json-web-algorithms-40. Kty *KeyType @@ -194,9 +194,6 @@ type KeyAttestation struct { // KeyAttributes - The attributes of a key managed by the key vault service. type KeyAttributes struct { - // The key or key version attestation information. - Attestation *KeyAttestation - // Determines whether the object is enabled. Enabled *bool @@ -210,6 +207,9 @@ type KeyAttributes struct { // Not before date in UTC. NotBefore *time.Time + // READ-ONLY; The key or key version attestation information. + Attestation *KeyAttestation + // READ-ONLY; Creation time in UTC. Created *time.Time @@ -222,7 +222,7 @@ type KeyAttributes struct { // READ-ONLY; Reflects the deletion recovery level currently in effect for keys in the current vault. If it contains 'Purgeable' // the key can be permanently deleted by a privileged user; otherwise, only the system can purge the key, at the end of the // retention interval. - RecoveryLevel *string + RecoveryLevel *DeletionRecoveryLevel // READ-ONLY; Last updated time in UTC. Updated *time.Time @@ -277,7 +277,7 @@ type KeyOperationResult struct { IV []byte // READ-ONLY; Key identifier - KID *ID + KID *string // READ-ONLY; The result of the operation. Result []byte @@ -289,7 +289,7 @@ type KeyProperties struct { Attributes *KeyAttributes // Key identifier. - KID *ID + KID *string // Application specific metadata in the form of key-value pairs. Tags map[string]*string @@ -411,7 +411,7 @@ type RestoreKeyParameters struct { // SignParameters - The key operations parameters. type SignParameters struct { - // REQUIRED; The signing/verification algorithm identifier. + // REQUIRED; The signing/verification algorithm identifier. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Algorithm *SignatureAlgorithm // REQUIRED; The value to operate on. @@ -423,7 +423,7 @@ type UpdateKeyParameters struct { // The attributes of a key managed by the key vault service. KeyAttributes *KeyAttributes - // Json web key operations. + // Json web key operations. For more information on possible key operations, see JsonWebKeyOperation. KeyOps []*KeyOperation // The policy rules under which the key can be exported. @@ -435,7 +435,7 @@ type UpdateKeyParameters struct { // VerifyParameters - The key verify parameters. type VerifyParameters struct { - // REQUIRED; The signing/verification algorithm. + // REQUIRED; The signing/verification algorithm. For more information on possible algorithm types, see JsonWebKeySignatureAlgorithm. Algorithm *SignatureAlgorithm // REQUIRED; The digest used for signing. diff --git a/sdk/security/keyvault/azkeys/models_serde.go b/sdk/security/keyvault/azkeys/models_serde.go index 2c171ea61506..af24d58f1d40 100644 --- a/sdk/security/keyvault/azkeys/models_serde.go +++ b/sdk/security/keyvault/azkeys/models_serde.go @@ -7,10 +7,9 @@ package azkeys import ( "encoding/json" "fmt" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" ) // MarshalJSON implements the json.Marshaller interface for type BackupKeyResult. diff --git a/sdk/security/keyvault/azkeys/options.go b/sdk/security/keyvault/azkeys/options.go index 556e794f1419..fb9dacbd3ef5 100644 --- a/sdk/security/keyvault/azkeys/options.go +++ b/sdk/security/keyvault/azkeys/options.go @@ -61,17 +61,20 @@ type ImportKeyOptions struct { // ListDeletedKeyPropertiesOptions contains the optional parameters for the Client.NewListDeletedKeyPropertiesPager method. type ListDeletedKeyPropertiesOptions struct { - // placeholder for future optional parameters + // Maximum number of results to return in a page. If not specified the service will return up to 25 results. + Maxresults *int32 } // ListKeyPropertiesOptions contains the optional parameters for the Client.NewListKeyPropertiesPager method. type ListKeyPropertiesOptions struct { - // placeholder for future optional parameters + // Maximum number of results to return in a page. If not specified the service will return up to 25 results. + Maxresults *int32 } // ListKeyPropertiesVersionsOptions contains the optional parameters for the Client.NewListKeyPropertiesVersionsPager method. type ListKeyPropertiesVersionsOptions struct { - // placeholder for future optional parameters + // Maximum number of results to return in a page. If not specified the service will return up to 25 results. + Maxresults *int32 } // PurgeDeletedKeyOptions contains the optional parameters for the Client.PurgeDeletedKey method. diff --git a/sdk/security/keyvault/azkeys/responses.go b/sdk/security/keyvault/azkeys/responses.go index 617910427ba1..2572ed77bc40 100644 --- a/sdk/security/keyvault/azkeys/responses.go +++ b/sdk/security/keyvault/azkeys/responses.go @@ -24,7 +24,7 @@ type DecryptResponse struct { // DeleteKeyResponse contains the response from method Client.DeleteKey. type DeleteKeyResponse struct { - // A DeletedKey consisting of a WebKey plus its Attributes and deletion info + // A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info DeletedKey } @@ -36,7 +36,7 @@ type EncryptResponse struct { // GetDeletedKeyResponse contains the response from method Client.GetDeletedKey. type GetDeletedKeyResponse struct { - // A DeletedKey consisting of a WebKey plus its Attributes and deletion info + // A DeletedKeyBundle consisting of a WebKey plus its Attributes and deletion info DeletedKey } diff --git a/sdk/security/keyvault/azkeys/time_unix.go b/sdk/security/keyvault/azkeys/time_unix.go index 922f0854756b..c46295ba9159 100644 --- a/sdk/security/keyvault/azkeys/time_unix.go +++ b/sdk/security/keyvault/azkeys/time_unix.go @@ -7,10 +7,9 @@ package azkeys import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) type timeUnix time.Time diff --git a/sdk/security/keyvault/azkeys/tsp-location.yaml b/sdk/security/keyvault/azkeys/tsp-location.yaml index 8caa04ce0331..73340b42eef8 100644 --- a/sdk/security/keyvault/azkeys/tsp-location.yaml +++ b/sdk/security/keyvault/azkeys/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/keyvault/Security.KeyVault.Keys -commit: cac8bb6ffc89f41dcd9bffaa265ecc45ef2d83c1 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs additionalDirectories: -- specification/keyvault/Security.KeyVault.Common/ +- specification/keyvault/Security.KeyVault.Common diff --git a/sdk/security/keyvault/azsecrets/CHANGELOG.md b/sdk/security/keyvault/azsecrets/CHANGELOG.md index f07d6f5467d8..9c9d2fd84454 100644 --- a/sdk/security/keyvault/azsecrets/CHANGELOG.md +++ b/sdk/security/keyvault/azsecrets/CHANGELOG.md @@ -1,5 +1,24 @@ # Release History +## 1.4.0-beta.2 (2025-05-13) +### Breaking Changes + +- Type of `DeletedSecret.ID` has been changed from `*ID` to `*string` +- Type of `DeletedSecret.KID` has been changed from `*ID` to `*string` +- Type of `DeletedSecretProperties.ID` has been changed from `*ID` to `*string` +- Type of `Secret.ID` has been changed from `*ID` to `*string` +- Type of `Secret.KID` has been changed from `*ID` to `*string` +- Type of `SecretAttributes.RecoveryLevel` has been changed from `*string` to `*DeletionRecoveryLevel` +- Type of `SecretProperties.ID` has been changed from `*ID` to `*string` + +### Features Added + +- New enum type `DeletionRecoveryLevel` with values `DeletionRecoveryLevelCustomizedRecoverable`, `DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription`, `DeletionRecoveryLevelCustomizedRecoverablePurgeable`, `DeletionRecoveryLevelPurgeable`, `DeletionRecoveryLevelRecoverable`, `DeletionRecoveryLevelRecoverableProtectedSubscription`, `DeletionRecoveryLevelRecoverablePurgeable` +- New field `Maxresults` in struct `ListDeletedSecretPropertiesOptions` +- New field `Maxresults` in struct `ListSecretPropertiesOptions` +- New field `Maxresults` in struct `ListSecretPropertiesVersionsOptions` + + ## 1.4.0-beta.2 (Unreleased) ### Features Added diff --git a/sdk/security/keyvault/azsecrets/build.go b/sdk/security/keyvault/azsecrets/build.go deleted file mode 100644 index 758cc266c7d3..000000000000 --- a/sdk/security/keyvault/azsecrets/build.go +++ /dev/null @@ -1,9 +0,0 @@ -//go:generate tsp-client update -//go:generate go run ./internal/transforms.go -//go:generate rm ./constants.go -//go:generate goimports -w . - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -package azsecrets diff --git a/sdk/security/keyvault/azsecrets/client.go b/sdk/security/keyvault/azsecrets/client.go index 587ffe2e5e9b..474280b222a9 100644 --- a/sdk/security/keyvault/azsecrets/client.go +++ b/sdk/security/keyvault/azsecrets/client.go @@ -7,13 +7,13 @@ package azsecrets import ( "context" "errors" - "net/http" - "net/url" - "strings" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "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" ) // Client - The key vault client performs cryptographic key operations and vault operations against the Key Vault service. @@ -236,6 +236,9 @@ func (client *Client) getSecretCreateRequest(ctx context.Context, name string, v return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{secret-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{secret-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(host, urlPath)) if err != nil { @@ -298,6 +301,9 @@ func (client *Client) listDeletedSecretPropertiesCreateRequest(ctx context.Conte } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "7.6-preview.2") + if options != nil && options.Maxresults != nil { + reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -353,6 +359,9 @@ func (client *Client) listSecretPropertiesCreateRequest(ctx context.Context, opt } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "7.6-preview.2") + if options != nil && options.Maxresults != nil { + reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -413,6 +422,9 @@ func (client *Client) listSecretPropertiesVersionsCreateRequest(ctx context.Cont } reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "7.6-preview.2") + if options != nil && options.Maxresults != nil { + reqQP.Set("maxresults", strconv.FormatInt(int64(*options.Maxresults), 10)) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -694,6 +706,9 @@ func (client *Client) updateSecretPropertiesCreateRequest(ctx context.Context, n return nil, errors.New("parameter name cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{secret-name}", url.PathEscape(name)) + if version == "" { + return nil, errors.New("parameter version cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{secret-version}", url.PathEscape(version)) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(host, urlPath)) if err != nil { diff --git a/sdk/security/keyvault/azsecrets/constants.go b/sdk/security/keyvault/azsecrets/constants.go new file mode 100644 index 000000000000..50a27b0e544f --- /dev/null +++ b/sdk/security/keyvault/azsecrets/constants.go @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. + +package azsecrets + +// DeletionRecoveryLevel - Reflects the deletion recovery level currently in effect for secrets in the current vault. If it +// contains 'Purgeable', the secret can be permanently deleted by a privileged user; otherwise, only the system can purge +// the secret, at the end of the retention interval. +type DeletionRecoveryLevel string + +const ( + // DeletionRecoveryLevelCustomizedRecoverable - Denotes a vault state in which deletion is recoverable without the possibility + // for immediate and permanent deletion (i.e. purge when 7 <= SoftDeleteRetentionInDays < 90).This level guarantees the recoverability + // of the deleted entity during the retention interval and while the subscription is still available. + DeletionRecoveryLevelCustomizedRecoverable DeletionRecoveryLevel = "CustomizedRecoverable" + // DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription - Denotes a vault and subscription state in which deletion + // is recoverable, immediate and permanent deletion (i.e. purge) is not permitted, and in which the subscription itself cannot + // be permanently canceled when 7 <= SoftDeleteRetentionInDays < 90. This level guarantees the recoverability of the deleted + // entity during the retention interval, and also reflects the fact that the subscription itself cannot be cancelled. + DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription DeletionRecoveryLevel = "CustomizedRecoverable+ProtectedSubscription" + // DeletionRecoveryLevelCustomizedRecoverablePurgeable - Denotes a vault state in which deletion is recoverable, and which + // also permits immediate and permanent deletion (i.e. purge when 7 <= SoftDeleteRetentionInDays < 90). This level guarantees + // the recoverability of the deleted entity during the retention interval, unless a Purge operation is requested, or the subscription + // is cancelled. + DeletionRecoveryLevelCustomizedRecoverablePurgeable DeletionRecoveryLevel = "CustomizedRecoverable+Purgeable" + // DeletionRecoveryLevelPurgeable - Denotes a vault state in which deletion is an irreversible operation, without the possibility + // for recovery. This level corresponds to no protection being available against a Delete operation; the data is irretrievably + // lost upon accepting a Delete operation at the entity level or higher (vault, resource group, subscription etc.) + DeletionRecoveryLevelPurgeable DeletionRecoveryLevel = "Purgeable" + // DeletionRecoveryLevelRecoverable - Denotes a vault state in which deletion is recoverable without the possibility for immediate + // and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity during the retention + // interval (90 days) and while the subscription is still available. System wil permanently delete it after 90 days, if not + // recovered + DeletionRecoveryLevelRecoverable DeletionRecoveryLevel = "Recoverable" + // DeletionRecoveryLevelRecoverableProtectedSubscription - Denotes a vault and subscription state in which deletion is recoverable + // within retention interval (90 days), immediate and permanent deletion (i.e. purge) is not permitted, and in which the subscription + // itself cannot be permanently canceled. System wil permanently delete it after 90 days, if not recovered + DeletionRecoveryLevelRecoverableProtectedSubscription DeletionRecoveryLevel = "Recoverable+ProtectedSubscription" + // DeletionRecoveryLevelRecoverablePurgeable - Denotes a vault state in which deletion is recoverable, and which also permits + // immediate and permanent deletion (i.e. purge). This level guarantees the recoverability of the deleted entity during the + // retention interval (90 days), unless a Purge operation is requested, or the subscription is cancelled. System wil permanently + // delete it after 90 days, if not recovered + DeletionRecoveryLevelRecoverablePurgeable DeletionRecoveryLevel = "Recoverable+Purgeable" +) + +// PossibleDeletionRecoveryLevelValues returns the possible values for the DeletionRecoveryLevel const type. +func PossibleDeletionRecoveryLevelValues() []DeletionRecoveryLevel { + return []DeletionRecoveryLevel{ + DeletionRecoveryLevelCustomizedRecoverable, + DeletionRecoveryLevelCustomizedRecoverableProtectedSubscription, + DeletionRecoveryLevelCustomizedRecoverablePurgeable, + DeletionRecoveryLevelPurgeable, + DeletionRecoveryLevelRecoverable, + DeletionRecoveryLevelRecoverableProtectedSubscription, + DeletionRecoveryLevelRecoverablePurgeable, + } +} diff --git a/sdk/security/keyvault/azsecrets/models.go b/sdk/security/keyvault/azsecrets/models.go index f6474eebbf4e..9dcf4f7e6ddb 100644 --- a/sdk/security/keyvault/azsecrets/models.go +++ b/sdk/security/keyvault/azsecrets/models.go @@ -22,7 +22,7 @@ type DeletedSecret struct { ContentType *string // The secret id. - ID *ID + ID *string // The url of the recovery object, used to identify and recover the deleted secret. RecoveryID *string @@ -38,7 +38,7 @@ type DeletedSecret struct { // READ-ONLY; If this is a secret backing a KV certificate, then this field specifies the corresponding key backing the KV // certificate. - KID *ID + KID *string // READ-ONLY; True if the secret's lifetime is managed by key vault. If this is a secret backing a certificate, then managed // will be true. @@ -57,7 +57,7 @@ type DeletedSecretProperties struct { ContentType *string // Secret identifier. - ID *ID + ID *string // The url of the recovery object, used to identify and recover the deleted secret. RecoveryID *string @@ -101,7 +101,7 @@ type Secret struct { ContentType *string // The secret id. - ID *ID + ID *string // Application specific metadata in the form of key-value pairs. Tags map[string]*string @@ -111,7 +111,7 @@ type Secret struct { // READ-ONLY; If this is a secret backing a KV certificate, then this field specifies the corresponding key backing the KV // certificate. - KID *ID + KID *string // READ-ONLY; True if the secret's lifetime is managed by key vault. If this is a secret backing a certificate, then managed // will be true. @@ -138,7 +138,7 @@ type SecretAttributes struct { // READ-ONLY; Reflects the deletion recovery level currently in effect for secrets in the current vault. If it contains 'Purgeable', // the secret can be permanently deleted by a privileged user; otherwise, only the system can purge the secret, at the end // of the retention interval. - RecoveryLevel *string + RecoveryLevel *DeletionRecoveryLevel // READ-ONLY; Last updated time in UTC. Updated *time.Time @@ -153,7 +153,7 @@ type SecretProperties struct { ContentType *string // Secret identifier. - ID *ID + ID *string // Application specific metadata in the form of key-value pairs. Tags map[string]*string diff --git a/sdk/security/keyvault/azsecrets/models_serde.go b/sdk/security/keyvault/azsecrets/models_serde.go index 3be6674cb945..e62c48357f92 100644 --- a/sdk/security/keyvault/azsecrets/models_serde.go +++ b/sdk/security/keyvault/azsecrets/models_serde.go @@ -7,10 +7,9 @@ package azsecrets import ( "encoding/json" "fmt" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" ) // MarshalJSON implements the json.Marshaller interface for type BackupSecretResult. diff --git a/sdk/security/keyvault/azsecrets/options.go b/sdk/security/keyvault/azsecrets/options.go index f97b83ec5305..3ea7b0dfa448 100644 --- a/sdk/security/keyvault/azsecrets/options.go +++ b/sdk/security/keyvault/azsecrets/options.go @@ -27,18 +27,21 @@ type GetSecretOptions struct { // ListDeletedSecretPropertiesOptions contains the optional parameters for the Client.NewListDeletedSecretPropertiesPager // method. type ListDeletedSecretPropertiesOptions struct { - // placeholder for future optional parameters + // Maximum number of results to return in a page. If not specified the service will return up to 25 results. + Maxresults *int32 } // ListSecretPropertiesOptions contains the optional parameters for the Client.NewListSecretPropertiesPager method. type ListSecretPropertiesOptions struct { - // placeholder for future optional parameters + // Maximum number of results to return in a page. If not specified the service will return up to 25 results. + Maxresults *int32 } // ListSecretPropertiesVersionsOptions contains the optional parameters for the Client.NewListSecretPropertiesVersionsPager // method. type ListSecretPropertiesVersionsOptions struct { - // placeholder for future optional parameters + // Maximum number of results to return in a page. If not specified the service will return up to 25 results. + Maxresults *int32 } // PurgeDeletedSecretOptions contains the optional parameters for the Client.PurgeDeletedSecret method. diff --git a/sdk/security/keyvault/azsecrets/time_unix.go b/sdk/security/keyvault/azsecrets/time_unix.go index b8ab94ea1e16..ee5efb2bbf03 100644 --- a/sdk/security/keyvault/azsecrets/time_unix.go +++ b/sdk/security/keyvault/azsecrets/time_unix.go @@ -7,10 +7,9 @@ package azsecrets import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) type timeUnix time.Time diff --git a/sdk/security/keyvault/azsecrets/tsp-location.yaml b/sdk/security/keyvault/azsecrets/tsp-location.yaml index fd3bb30f243c..9b06d5dc0ad4 100644 --- a/sdk/security/keyvault/azsecrets/tsp-location.yaml +++ b/sdk/security/keyvault/azsecrets/tsp-location.yaml @@ -1,5 +1,5 @@ directory: specification/keyvault/Security.KeyVault.Secrets -commit: cac8bb6ffc89f41dcd9bffaa265ecc45ef2d83c1 +commit: 079f70d6f2b754db6b736e117196104efd2dd496 repo: Azure/azure-rest-api-specs additionalDirectories: -- specification/keyvault/Security.KeyVault.Common/ +- specification/keyvault/Security.KeyVault.Common